From: Erik V. <ev...@us...> - 2011-12-18 11:59:44
|
rails/game/StockRound.java | 51 +++++++++-------- rails/game/specific/_18EU/FinalMinorExchangeRound.java | 4 + 2 files changed, 31 insertions(+), 24 deletions(-) New commits: commit fa62b37076e0753f6fa32c2af220ac880c784be3 Author: Erik Vos <eri...@xs...> Date: Sun Dec 18 12:58:58 2011 +0100 Fixed 18EU bug: sold out companies could raise value at end of FME round. Raising stock value is now controlled by a new StockRound attribute named 'raiseIfSoldOut', which is normally true. This new attribute should be set to false at initiating any subclasses that call the generic finishRound() but where stock price should not change. This is now done in 18EU/FinalMinorExchangeRound. diff --git a/rails/game/StockRound.java b/rails/game/StockRound.java index 3bbc525..3c469c3 100644 --- a/rails/game/StockRound.java +++ b/rails/game/StockRound.java @@ -56,6 +56,7 @@ public class StockRound extends Round { /* Rules */ protected int sequenceRule; + protected boolean raiseIfSoldOut; /** * Constructor with the GameManager, will call super class (Round's) Constructor to initialize @@ -71,6 +72,8 @@ public class StockRound extends Round { sequenceRule = getGameParameterAsInt(GameDef.Parm.STOCK_ROUND_SEQUENCE); + raiseIfSoldOut = true; + guiHints.setVisibilityHint(GuiDef.Panel.MAP, true); guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET, true); guiHints.setActivePanel(GuiDef.Panel.STATUS); @@ -417,11 +420,11 @@ public class StockRound extends Round { // and double shares for now. choiceOfPresidentExchangeCerts = uniqueCertsCount[1] > 1 && uniqueCertsCount[2] > 0; - // If a presidency dump is possible, extra (single) share(s) may be sold - // that aren't even owned - extraSingleShares = Math.min( - presidentShare/shareUnit, - (maxShareToSell-dumpThreshold)/shareUnit+1); + // If a presidency dump is possible, extra (single) share(s) may be sold + // that aren't even owned + extraSingleShares = Math.min( + presidentShare/shareUnit, + (maxShareToSell-dumpThreshold)/shareUnit+1); } // What number of shares can we sell if we cannot dump? @@ -1344,24 +1347,26 @@ public class StockRound extends Round { ReportBuffer.add(LocalText.getText("END_SR", String.valueOf(getStockRoundNumber()))); - /* Check if any companies are sold out. */ - for (PublicCompanyI company : gameManager.getCompaniesInRunningOrder()) { - if (company.hasStockPrice() && company.isSoldOut()) { - StockSpaceI oldSpace = company.getCurrentSpace(); - stockMarket.soldOut(company); - StockSpaceI newSpace = company.getCurrentSpace(); - if (newSpace != oldSpace) { - ReportBuffer.add(LocalText.getText("SoldOut", - company.getName(), - Bank.format(oldSpace.getPrice()), - oldSpace.getName(), - Bank.format(newSpace.getPrice()), - newSpace.getName())); - } else { - ReportBuffer.add(LocalText.getText("SoldOutNoRaise", - company.getName(), - Bank.format(newSpace.getPrice()), - newSpace.getName())); + if (raiseIfSoldOut) { + /* Check if any companies are sold out. */ + for (PublicCompanyI company : gameManager.getCompaniesInRunningOrder()) { + if (company.hasStockPrice() && company.isSoldOut()) { + StockSpaceI oldSpace = company.getCurrentSpace(); + stockMarket.soldOut(company); + StockSpaceI newSpace = company.getCurrentSpace(); + if (newSpace != oldSpace) { + ReportBuffer.add(LocalText.getText("SoldOut", + company.getName(), + Bank.format(oldSpace.getPrice()), + oldSpace.getName(), + Bank.format(newSpace.getPrice()), + newSpace.getName())); + } else { + ReportBuffer.add(LocalText.getText("SoldOutNoRaise", + company.getName(), + Bank.format(newSpace.getPrice()), + newSpace.getName())); + } } } } diff --git a/rails/game/specific/_18EU/FinalMinorExchangeRound.java b/rails/game/specific/_18EU/FinalMinorExchangeRound.java index 79bb761..3e96542 100644 --- a/rails/game/specific/_18EU/FinalMinorExchangeRound.java +++ b/rails/game/specific/_18EU/FinalMinorExchangeRound.java @@ -23,6 +23,8 @@ public class FinalMinorExchangeRound extends StockRound_18EU { guiHints.setVisibilityHint(GuiDef.Panel.MAP, true); guiHints.setActivePanel(GuiDef.Panel.STATUS); + + raiseIfSoldOut = false; } public void start(Player playerToStartFMERound) { @@ -56,7 +58,7 @@ public class FinalMinorExchangeRound extends StockRound_18EU { } List<PublicCompanyI> comps = - companyManager.getAllPublicCompanies(); + companyManager.getAllPublicCompanies(); List<PublicCompanyI> minors = new ArrayList<PublicCompanyI>(); List<PublicCompanyI> targetCompanies = new ArrayList<PublicCompanyI>(); String type; |