From: Erik V. <ev...@us...> - 2009-01-08 19:59:45
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164/rails/game Modified Files: StartRound_1830.java StartItem.java StartRound_1835.java StartRound.java Log Message: Start item status tooltips & colours Index: StartRound_1830.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1830.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StartRound_1830.java 23 Dec 2008 19:58:36 -0000 1.16 --- StartRound_1830.java 8 Jan 2009 19:59:39 -0000 1.17 *************** *** 2,7 **** package rails.game; - import java.util.List; - import rails.game.action.*; import rails.game.move.MoveSet; --- 2,5 ---- *************** *** 156,168 **** } - /** - * Return the start items, marked as appropriate for an 1830-style auction. - */ - @Override - public List<StartItem> getStartItems() { - - return itemsToSell; - } - /*----- MoveSet methods -----*/ /** --- 154,157 ---- Index: StartItem.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartItem.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** StartItem.java 7 Jan 2009 21:03:24 -0000 1.15 --- StartItem.java 8 Jan 2009 19:59:39 -0000 1.16 *************** *** 47,60 **** public static final int BIDDABLE = 1; public static final int BUYABLE = 2; ! public static final int AUCTIONED = 3; ! public static final int NEEDS_SHARE_PRICE = 4; // TODO No longer used (may // not be true after // bidding), needs code // cleanup ! public static final int SOLD = 5; public static final String[] statusName = ! new String[] { "Unavailable", "Biddable", "Buyable", "Auctioned", ! "NeedingSharePrice", "Sold" }; // For initialisation purposes only --- 47,61 ---- public static final int BIDDABLE = 1; public static final int BUYABLE = 2; ! public static final int SELECTABLE = 3; ! public static final int AUCTIONED = 4; ! public static final int NEEDS_SHARE_PRICE = 5; // TODO No longer used (may // not be true after // bidding), needs code // cleanup ! public static final int SOLD = 6; public static final String[] statusName = ! new String[] { "Unavailable", "Biddable", "Buyable", "Selectable", ! "Auctioned", "NeedingSharePrice", "Sold" }; // For initialisation purposes only *************** *** 466,469 **** --- 467,474 ---- } + public ModelObject getStatusModel () { + return status; + } + public String getStatusName() { return statusName[status.intValue()]; *************** *** 506,508 **** --- 511,517 ---- } + public String getText () { + return toString(); + } + } Index: StartRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** StartRound.java 23 Dec 2008 19:59:06 -0000 1.22 --- StartRound.java 8 Jan 2009 19:59:39 -0000 1.23 *************** *** 328,337 **** /** ! * Get a list of items that may be bought immediately. * * @return An array of start items, possibly empry. */ ! public abstract List<StartItem> getStartItems(); /** --- 328,340 ---- /** ! * Get the current list of start items. * * @return An array of start items, possibly empry. */ ! public List<StartItem> getStartItems() { ! ! return itemsToSell; ! } /** Index: StartRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1835.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** StartRound_1835.java 4 Jan 2009 13:09:27 -0000 1.17 --- StartRound_1835.java 8 Jan 2009 19:59:39 -0000 1.18 *************** *** 146,186 **** } - @Override - public List<StartItem> getStartItems() { - Player currentPlayer = getCurrentPlayer(); - int cashToSpend = currentPlayer.getCash(); - // List<StartItem> startItems = startPacket.getItems(); - int row; - int minRow = 0; - int items = 0; - - // for (StartItem item : startItems) - for (StartItem item : itemsToSell) { - if (item.isSold()) { - item.setStatus(StartItem.SOLD); - } else if (item.getBasePrice() > cashToSpend) { - item.setStatus(StartItem.UNAVAILABLE); - } else if (variant.equalsIgnoreCase(CLEMENS_VARIANT)) { - item.setStatus(StartItem.BUYABLE); - } else { - row = item.getRow(); - if (minRow == 0) minRow = row; - if (row == minRow) { - // Allow all items in the top row. - item.setStatus(StartItem.BUYABLE); - items++; - } else if (row == minRow + 1 && items == 1) { - // Allow the first item in the next row if the - // top row has only one item. - item.setStatus(StartItem.BUYABLE); - } else { - item.setStatus(StartItem.UNAVAILABLE); - } - } - } - - return itemsToSell; - } - /*----- MoveSet methods -----*/ --- 146,149 ---- |