Update of /cvsroot/rails/18xx/rails/game/specific/_1856
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21015/rails/game/specific/_1856
Modified Files:
CGRFormationRound.java
Log Message:
Fixed bookkeeping on sold bonus tokens, in particular in relation to dropping duplicate tokens acquired by the CGR
Index: CGRFormationRound.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** CGRFormationRound.java 27 Dec 2009 23:17:19 -0000 1.26
--- CGRFormationRound.java 28 Dec 2009 13:21:12 -0000 1.27
***************
*** 6,9 ****
--- 6,11 ----
import rails.game.action.*;
import rails.game.move.CashMove;
+ import rails.game.special.SellBonusToken;
+ import rails.game.special.SpecialPropertyI;
import rails.game.state.BooleanState;
import rails.game.state.IntegerState;
***************
*** 544,548 ****
if (cgr.getBonuses() != null) {
for (Bonus b : cgr.getBonuses()) {
! if (b.equals(bonus)) continue bonuses;
}
}
--- 546,565 ----
if (cgr.getBonuses() != null) {
for (Bonus b : cgr.getBonuses()) {
! if (b.equals(bonus)) {
! // Remove this duplicate bonus token.
! // Check if it should be made available again.
! List<SellBonusToken> commonSP = gameManager.getSpecialProperties(SellBonusToken.class, true);
! if (commonSP != null) {
! for (SellBonusToken sp : commonSP) {
! if (sp.getName().equalsIgnoreCase(b.getName())) {
! sp.makeResellable();
! log.debug("BonusToken "+b.getName()+" made sellable again");
! break;
! }
! }
! }
! log.debug("Duplicate BonusToken "+b.getName()+" not added to "+cgrName);
! continue bonuses;
! }
}
}
|