From: Erik V. <ev...@us...> - 2009-12-26 13:44:38
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16514/rails/game Modified Files: OperatingRound.java Log Message: Removed option to select "common" actions in case of forced actions (i.e. a train discard). Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** OperatingRound.java 26 Dec 2009 12:48:31 -0000 1.83 --- OperatingRound.java 26 Dec 2009 13:44:26 -0000 1.84 *************** *** 1978,2026 **** } ! setBonusTokenLays(); ! ! setDestinationActions(); ! ! setGameSpecificPossibleActions(); ! ! // Can private companies be bought? ! if (getCurrentPhase().isPrivateSellingAllowed()) { ! ! // Create a list of players with the current one in front ! int currentPlayerIndex = operatingCompany.getPresident().getIndex(); ! Player player; ! int minPrice, maxPrice; ! for (int i = currentPlayerIndex; i < currentPlayerIndex ! + numberOfPlayers; i++) { ! player = players.get(i % numberOfPlayers); ! for (PrivateCompanyI privComp : player.getPortfolio().getPrivateCompanies()) { ! minPrice = ! (int) (privComp.getBasePrice() * operatingCompany.getLowerPrivatePriceFactor()); ! maxPrice = ! (int) (privComp.getBasePrice() * operatingCompany.getUpperPrivatePriceFactor()); ! possibleActions.add(new BuyPrivate(privComp, minPrice, ! maxPrice)); } } ! } ! ! // Are there any "common" special properties, ! // i.e. properties that are available to everyone? ! List<SpecialPropertyI> commonSP = gameManager.getCommonSpecialProperties(); ! if (commonSP != null) { ! SellBonusToken sbt; ! loop: for (SpecialPropertyI sp : commonSP) { ! if (sp instanceof SellBonusToken) { ! sbt = (SellBonusToken) sp; ! // Can't buy if already owned ! if (operatingCompany.getBonuses() != null) { ! for (Bonus bonus : operatingCompany.getBonuses()) { ! if (bonus.getName().equals(sp.getName())) continue loop; ! } ! } ! possibleActions.add (new BuyBonusToken (sbt)); ! } ! } } --- 1978,2031 ---- } ! // The following additional "common" actions are only available if the ! // primary action is not forced. ! if (step >= 0) { ! ! setBonusTokenLays(); ! setDestinationActions(); ! ! setGameSpecificPossibleActions(); ! ! // Can private companies be bought? ! if (getCurrentPhase().isPrivateSellingAllowed()) { ! ! // Create a list of players with the current one in front ! int currentPlayerIndex = operatingCompany.getPresident().getIndex(); ! Player player; ! int minPrice, maxPrice; ! for (int i = currentPlayerIndex; i < currentPlayerIndex ! + numberOfPlayers; i++) { ! player = players.get(i % numberOfPlayers); ! for (PrivateCompanyI privComp : player.getPortfolio().getPrivateCompanies()) { ! ! minPrice = ! (int) (privComp.getBasePrice() * operatingCompany.getLowerPrivatePriceFactor()); ! maxPrice = ! (int) (privComp.getBasePrice() * operatingCompany.getUpperPrivatePriceFactor()); ! possibleActions.add(new BuyPrivate(privComp, minPrice, ! maxPrice)); ! } } } ! ! // Are there any "common" special properties, ! // i.e. properties that are available to everyone? ! List<SpecialPropertyI> commonSP = gameManager.getCommonSpecialProperties(); ! if (commonSP != null) { ! SellBonusToken sbt; ! loop: for (SpecialPropertyI sp : commonSP) { ! if (sp instanceof SellBonusToken) { ! sbt = (SellBonusToken) sp; ! // Can't buy if already owned ! if (operatingCompany.getBonuses() != null) { ! for (Bonus bonus : operatingCompany.getBonuses()) { ! if (bonus.getName().equals(sp.getName())) continue loop; ! } ! } ! possibleActions.add (new BuyBonusToken (sbt)); ! } ! } ! } } |