From: Erik V. <ev...@us...> - 2008-12-23 19:58:47
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27219/rails/game Modified Files: StartRound_1830.java Log Message: Apply new round initialisation logic. Fixed rare problem in counting passes. Index: StartRound_1830.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1830.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** StartRound_1830.java 10 Oct 2008 19:56:30 -0000 1.15 --- StartRound_1830.java 23 Dec 2008 19:58:36 -0000 1.16 *************** *** 2,11 **** package rails.game; ! import java.util.*; ! import rails.game.action.BidStartItem; ! import rails.game.action.BuyStartItem; ! import rails.game.action.StartItemAction; ! import rails.game.action.NullAction; import rails.game.move.MoveSet; import rails.util.LocalText; --- 2,8 ---- package rails.game; ! import java.util.List; ! import rails.game.action.*; import rails.game.move.MoveSet; import rails.util.LocalText; *************** *** 20,40 **** * Constructor, only to be used in dynamic instantiation. */ ! public StartRound_1830() { ! super(); hasBidding = true; } /** * Start the 1830-style start round. ! * * @param startPacket The startpacket to be sold in this start round. */ ! public void start(StartPacket startPacket) { ! super.start(startPacket); ! bidIncrement = startPacket.getModulus(); setPossibleActions(); } public boolean setPossibleActions() { --- 17,39 ---- * Constructor, only to be used in dynamic instantiation. */ ! public StartRound_1830(GameManagerI gameManager) { ! super(gameManager); hasBidding = true; + bidIncrement = startPacket.getModulus(); } /** * Start the 1830-style start round. ! * * @param startPacket The startpacket to be sold in this start round. */ ! @Override ! public void start() { ! super.start(); setPossibleActions(); } + @Override public boolean setPossibleActions() { *************** *** 45,50 **** if (StartPacket.getStartPacket().areAllSold()) return false; - StartItem auctionItem = (StartItem) auctionItemState.getObject(); - while (possibleActions.isEmpty()) { --- 44,47 ---- *************** *** 56,65 **** // Don't include } else if (item.getStatus() == StartItem.AUCTIONED) { ! item.setStatus(StartItem.AUCTIONED); if (currentPlayer.getFreeCash() ! + auctionItem.getBid(currentPlayer) >= auctionItem.getMinimumBid()) { BidStartItem possibleAction = ! new BidStartItem(auctionItem, ! auctionItem.getMinimumBid(), startPacket.getModulus(), true); possibleActions.add(possibleAction); --- 53,62 ---- // Don't include } else if (item.getStatus() == StartItem.AUCTIONED) { ! if (currentPlayer.getFreeCash() ! + item.getBid(currentPlayer) >= item.getMinimumBid()) { BidStartItem possibleAction = ! new BidStartItem(item, ! item.getMinimumBid(), startPacket.getModulus(), true); possibleActions.add(possibleAction); *************** *** 67,70 **** --- 64,68 ---- } else { // Can't bid: Autopass + numPasses.add(1); break; } *************** *** 161,164 **** --- 159,163 ---- * Return the start items, marked as appropriate for an 1830-style auction. */ + @Override public List<StartItem> getStartItems() { *************** *** 169,177 **** /** * The current player bids on a given start item. ! * * @param playerName The name of the current player (for checking purposes). * @param itemName The name of the start item on which the bid is placed. * @param amount The bid amount. */ protected boolean bid(String playerName, BidStartItem bidItem) { --- 168,177 ---- /** * The current player bids on a given start item. ! * * @param playerName The name of the current player (for checking purposes). * @param itemName The name of the start item on which the bid is placed. * @param amount The bid amount. */ + @Override protected boolean bid(String playerName, BidStartItem bidItem) { *************** *** 272,278 **** /** * Process a player's pass. ! * * @param playerName The name of the current player (for checking purposes). */ protected boolean pass(String playerName) { --- 272,279 ---- /** * Process a player's pass. ! * * @param playerName The name of the current player (for checking purposes). */ + @Override protected boolean pass(String playerName) { *************** *** 305,309 **** if (auctionItem != null) { ! if (numPasses.intValue() == auctionItem.getBidders() - 1) { // All but the highest bidder have passed. int price = auctionItem.getBid(); --- 306,310 ---- if (auctionItem != null) { ! if (numPasses.intValue() >= auctionItem.getBidders() - 1) { // All but the highest bidder have passed. int price = auctionItem.getBid(); *************** *** 375,378 **** --- 376,380 ---- } + @Override public String getHelp() { return "1830 Start Round help text"; |