From: Erik V. <ev...@us...> - 2010-03-04 22:08:17
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17033/rails/game Modified Files: TrainTypeI.java PublicCompanyI.java PublicCompany.java TrainType.java Log Message: Various changes for 1835 Index: TrainTypeI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainTypeI.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TrainTypeI.java 4 Feb 2010 22:22:59 -0000 1.13 --- TrainTypeI.java 4 Mar 2010 22:08:09 -0000 1.14 *************** *** 109,111 **** --- 109,113 ---- public TrainManager getTrainManager(); + public String getInfo(); + } Index: TrainType.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainType.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TrainType.java 4 Feb 2010 22:23:01 -0000 1.30 --- TrainType.java 4 Mar 2010 22:08:09 -0000 1.31 *************** *** 9,14 **** import rails.game.state.BooleanState; import rails.game.state.IntegerState; ! import rails.util.LocalText; ! import rails.util.Tag; public class TrainType --- 9,13 ---- import rails.game.state.BooleanState; import rails.game.state.IntegerState; ! import rails.util.*; public class TrainType *************** *** 476,478 **** --- 475,499 ---- } + public String getInfo() { + StringBuilder b = new StringBuilder ("<html>"); + b.append(LocalText.getText("TrainInfo", name, Bank.format(cost), amount)); + if (Util.hasValue(startedPhaseName)) { + appendInfoText(b, LocalText.getText("StartsPhase", startedPhaseName)); + } + if (rustedTrainTypeName != null) { + appendInfoText(b, LocalText.getText("RustsTrains", rustedTrainTypeName)); + } + if (releasedTrainTypeName != null) { + appendInfoText(b, LocalText.getText("ReleasesTrains", releasedTrainTypeName)); + } + if (b.length() == 6) b.append(LocalText.getText("None")); + + return b.toString(); + } + + private void appendInfoText (StringBuilder b, String text) { + if (text == null || text.length() == 0) return; + if (b.length() > 6) b.append("<br>"); + b.append(text); + } } Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** PublicCompany.java 1 Mar 2010 22:27:31 -0000 1.89 --- PublicCompany.java 4 Mar 2010 22:08:09 -0000 1.90 *************** *** 31,35 **** protected static final int WHEN_FLOATED = 1; protected static final int START_OF_FIRST_OR = 2; ! // Base token lay cost calculation methods public static final String BASE_COST_SEQUENCE = "sequence"; --- 31,35 ---- protected static final int WHEN_FLOATED = 1; protected static final int START_OF_FIRST_OR = 2; ! // Base token lay cost calculation methods public static final String BASE_COST_SEQUENCE = "sequence"; *************** *** 192,195 **** --- 192,200 ---- protected IntegerState shareUnit; + /** What number of share units relates to the share price + * (normally 1, but 2 for 1835 Prussian) + */ + protected int shareUnitsForSharePrice = 1; + /** At what percentage sold does the company float */ protected int floatPerc = 0; *************** *** 268,272 **** * element */ ! public void configureFromXML(Tag tag) throws ConfigurationException { longName = tag.getAttributeAsString("longname", name); --- 273,278 ---- * element */ ! @Override ! public void configureFromXML(Tag tag) throws ConfigurationException { longName = tag.getAttributeAsString("longname", name); *************** *** 297,300 **** --- 303,308 ---- shareUnit = new IntegerState (name+"_ShareUnit", shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT)); + shareUnitsForSharePrice + = shareUnitTag.getAttributeAsInteger("sharePriceUnits", shareUnitsForSharePrice); } *************** *** 342,346 **** // Special properties (as in the 1835 black minors) super.configureFromXML(tag); ! // TODO Normally set in the default train type. May be wrong place. // Ridiculous to reparse with each train type. --- 350,354 ---- // Special properties (as in the 1835 black minors) super.configureFromXML(tag); ! // TODO Normally set in the default train type. May be wrong place. // Ridiculous to reparse with each train type. *************** *** 1381,1385 **** } ! @Override public String toString() { return name; --- 1389,1397 ---- } ! public int getShareUnitsForSharePrice() { ! return shareUnitsForSharePrice; ! } ! ! @Override public String toString() { return name; *************** *** 1636,1640 **** tilesLaidThisTurn.appendWithDelimiter(Bank.format(cost), ","); } ! public ModelObject getTilesLaidThisTurnModel() { return tilesLaidThisTurn; --- 1648,1652 ---- tilesLaidThisTurn.appendWithDelimiter(Bank.format(cost), ","); } ! public ModelObject getTilesLaidThisTurnModel() { return tilesLaidThisTurn; *************** *** 1658,1664 **** /** ! * Calculate the cost of laying a token, given the hex where * the token is laid. This only makes a diofference for de "distance" method. ! * @param hex The hex where the token is to be laid. * @return The cost of laying that token. */ --- 1670,1676 ---- /** ! * Calculate the cost of laying a token, given the hex where * the token is laid. This only makes a diofference for de "distance" method. ! * @param hex The hex where the token is to be laid. * @return The cost of laying that token. */ *************** *** 1669,1673 **** if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { int index = getNumberOfLaidBaseTokens(); ! if (index >= baseTokenLayCost.length) { index = baseTokenLayCost.length - 1; --- 1681,1685 ---- if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { int index = getNumberOfLaidBaseTokens(); ! if (index >= baseTokenLayCost.length) { index = baseTokenLayCost.length - 1; *************** *** 1686,1690 **** } } ! /** Return all possible token lay costs to be incurred for the * company's next token lay. In the "distance" method, this will be an array. --- 1698,1702 ---- } } ! /** Return all possible token lay costs to be incurred for the * company's next token lay. In the "distance" method, this will be an array. *************** *** 1692,1696 **** */ public int[] getBaseTokenLayCosts () { ! if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { return new int[] {getBaseTokenLayCost(null)}; --- 1704,1708 ---- */ public int[] getBaseTokenLayCosts () { ! if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { return new int[] {getBaseTokenLayCost(null)}; *************** *** 1706,1710 **** return new int[] {0}; } ! } --- 1718,1722 ---- return new int[] {0}; } ! } Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PublicCompanyI.java 28 Feb 2010 21:38:05 -0000 1.49 --- PublicCompanyI.java 4 Mar 2010 22:08:09 -0000 1.50 *************** *** 232,235 **** --- 232,236 ---- */ public int getShareUnit(); + public int getShareUnitsForSharePrice(); /** *************** *** 292,296 **** public void layTileInNoMapMode(int cost); ! public ModelObject getTilesLaidThisTurnModel(); --- 293,297 ---- public void layTileInNoMapMode(int cost); ! public ModelObject getTilesLaidThisTurnModel(); *************** *** 300,304 **** public void layBaseTokenInNoMapMode(int cost); ! public ModelObject getTokensLaidThisTurnModel(); --- 301,305 ---- public void layBaseTokenInNoMapMode(int cost); ! public ModelObject getTokensLaidThisTurnModel(); |