From: <ev...@us...> - 2010-11-09 15:45:53
|
Revision: 1458 http://rails.svn.sourceforge.net/rails/?rev=1458&view=rev Author: evos Date: 2010-11-09 15:45:47 +0000 (Tue, 09 Nov 2010) Log Message: ----------- Replace bank cash display by "BROKEN" once that is the case. Modified Paths: -------------- trunk/18xx/LocalisedText.properties trunk/18xx/rails/game/Bank.java trunk/18xx/rails/game/model/CashModel.java Modified: trunk/18xx/LocalisedText.properties =================================================================== --- trunk/18xx/LocalisedText.properties 2010-10-30 12:17:07 UTC (rev 1457) +++ trunk/18xx/LocalisedText.properties 2010-11-09 15:45:47 UTC (rev 1458) @@ -26,7 +26,8 @@ BID=Bid BID_ITEM_LOG={0} bids {1} on {2}. Remaining free cash {3}. BID_ITEM={0} bids {1} on {2}. -BidMustBeMultipleOf=Invalid bid {0}: must be multiple of {1} +BidMustBeMultipleOf=Invalid bid {0}: must be multiple of {1} +BROKEN=BROKEN BUY=Buy BUY_PRIVATE=Buy Private BUY_SHARE_LOG={0} buys a {1}% share of {2} from {3} for {4}. Modified: trunk/18xx/rails/game/Bank.java =================================================================== --- trunk/18xx/rails/game/Bank.java 2010-10-30 12:17:07 UTC (rev 1457) +++ trunk/18xx/rails/game/Bank.java 2010-11-09 15:45:47 UTC (rev 1458) @@ -146,6 +146,7 @@ */ if (money.getCash() <= 0 && !broken.booleanValue()) { broken.set(true); + money.setText(LocalText.getText("BROKEN")); GameManager.getInstance().registerBrokenBank(); } } Modified: trunk/18xx/rails/game/model/CashModel.java =================================================================== --- trunk/18xx/rails/game/model/CashModel.java 2010-10-30 12:17:07 UTC (rev 1457) +++ trunk/18xx/rails/game/model/CashModel.java 2010-11-09 15:45:47 UTC (rev 1458) @@ -2,17 +2,22 @@ package rails.game.model; import rails.game.*; +import rails.game.state.StringState; public class CashModel extends ModelObject { - private int cash; - private CashHolder owner; + protected int cash; + protected CashHolder owner; + /** Text to be displayed instead of the cash amount (if length > 0) */ + protected StringState displayText = new StringState("BankCashDisplayText", ""); + public static final int SUPPRESS_ZERO = 1; public CashModel(CashHolder owner) { cash = 0; this.owner = owner; + displayText.addDependent(this); } public void setCash(int newCash) { @@ -36,7 +41,10 @@ */ @Override public String getText() { - if (cash == 0 && (option & SUPPRESS_ZERO) > 0 + String fixedText = displayText.getText(); + if (!"".equals(fixedText)) { + return fixedText; + } else if (cash == 0 && (option & SUPPRESS_ZERO) > 0 || owner instanceof PublicCompanyI && !((PublicCompanyI) owner).hasStarted()) { return ""; @@ -45,4 +53,7 @@ } } + public void setText (String text) { + displayText.set (text); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |