From: Erik V. <ev...@us...> - 2009-12-08 21:16:59
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25928/rails/game Modified Files: Round.java StartRound_1830.java StartRound.java Log Message: Fixed bug in determining end of round Index: StartRound_1830.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1830.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** StartRound_1830.java 27 Nov 2009 20:35:18 -0000 1.26 --- StartRound_1830.java 8 Dec 2009 19:32:44 -0000 1.27 *************** *** 33,36 **** --- 33,58 ---- @Override + public boolean process(PossibleAction action) { + + if (!super.process(action)) return false; + + // Assign any further items that have been bid exactly once + // and don't need any further player intervention, such + // as setting a start price + StartItem item; + while ((item = startPacket.getFirstUnsoldItem()) != null + && item.getBidders() == 1 && item.needsPriceSetting() == null) { + assignItem(item.getBidder(), item, item.getBid(), 0); + + // Check if this has exhausted the start packet + if (startPacket.areAllSold()) { + finishRound(); + break; + } + } + return true; + } + + @Override public boolean setPossibleActions() { *************** *** 39,43 **** possibleActions.clear(); ! if (startPacket.areAllSold()) return false; if (currentPlayer == startPlayer) ReportBuffer.add(""); --- 61,65 ---- possibleActions.clear(); ! //if (startPacket.areAllSold()) return false; // SHOULDN'T GET HERE THEN if (currentPlayer == startPlayer) ReportBuffer.add(""); *************** *** 85,89 **** break; // No more actions possible! } else { ! // Otherwise, buy it now. assignItem(item.getBidder(), item, item.getBid(), 0); } --- 107,112 ---- break; // No more actions possible! } else { ! // ERROR, this should have been detected in process()! ! log.error("??? Wrong place to assign item "+item.getName()); assignItem(item.getBidder(), item, item.getBid(), 0); } *************** *** 132,138 **** * loop. go to next round if that happened */ ! if (gameManager.getStartPacket().areAllSold()) { ! return false; ! } if (possibleActions.isEmpty()) { --- 155,161 ---- * loop. go to next round if that happened */ ! //if (gameManager.getStartPacket().areAllSold()) { ! // return false; ! //} if (possibleActions.isEmpty()) { Index: StartRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** StartRound.java 27 Nov 2009 20:35:18 -0000 1.31 --- StartRound.java 8 Dec 2009 19:32:44 -0000 1.32 *************** *** 138,149 **** possibleActions.clear(); finishRound(); - // } else if (!setPossibleActions()) { - /* - * If nobody can do anything, keep executing Operating and Start - * rounds until someone has got enough money to buy one of the - * remaining items. The game mechanism ensures that this will - * ultimately be possible. - */ - // finishRound(); } --- 138,141 ---- |