You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: Erik V. <ev...@us...> - 2010-01-16 14:09:59
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4766/rails/game/specific/_1856 Modified Files: StockRound_1856.java Log Message: Fixed escrow message Index: StockRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/StockRound_1856.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** StockRound_1856.java 31 Oct 2009 17:08:26 -0000 1.12 --- StockRound_1856.java 16 Jan 2010 14:09:51 -0000 1.13 *************** *** 48,57 **** @Override ! protected CashHolder getSharePriceRecipient(PublicCertificateI cert, int price) { CashHolder recipient; Portfolio oldHolder = (Portfolio) cert.getHolder(); ! if (price != 0 && !cert.getCompany().getName().equalsIgnoreCase(PublicCompany_CGR.NAME) && oldHolder == ipo) { --- 48,57 ---- @Override ! protected CashHolder getSharePriceRecipient(PublicCertificateI cert, int cost) { CashHolder recipient; Portfolio oldHolder = (Portfolio) cert.getHolder(); ! if (cost != 0 && !cert.getCompany().getName().equalsIgnoreCase(PublicCompany_CGR.NAME) && oldHolder == ipo) { *************** *** 67,72 **** && !comp.hasReachedDestination()) { recipient = oldHolder.getOwner(); // i.e. the Bank ! comp.addMoneyInEscrow(price); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", Bank.format(comp.getMoneyInEscrow()), comp.getName() )); --- 67,73 ---- && !comp.hasReachedDestination()) { recipient = oldHolder.getOwner(); // i.e. the Bank ! comp.addMoneyInEscrow(cost); ReportBuffer.addWaiting(LocalText.getText("HoldMoneyInEscrow", + Bank.format(cost), Bank.format(comp.getMoneyInEscrow()), comp.getName() )); |
From: Erik V. <ev...@us...> - 2010-01-16 14:09:42
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4726 Removed Files: games.properties Log Message: games.properties no longer used --- games.properties DELETED --- |
From: Erik V. <ev...@us...> - 2010-01-16 14:09:41
|
Update of /cvsroot/rails/18xx/rails/util In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4726/rails/util Modified Files: Config.java Log Message: games.properties no longer used Index: Config.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/Config.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Config.java 27 Dec 2009 18:30:31 -0000 1.10 --- Config.java 16 Jan 2010 14:09:33 -0000 1.11 *************** *** 20,24 **** /* It will be reset from GameTest. */ private static String myConfigFile = "my.properties"; ! private static String gamesConfigFile = "games.properties"; /** One Properties object for all properties */ --- 20,24 ---- /* It will be reset from GameTest. */ private static String myConfigFile = "my.properties"; ! //private static String gamesConfigFile = "games.properties"; /** One Properties object for all properties */ *************** *** 54,58 **** /* List the property files to read here */ load(myConfigFile, false); ! load(gamesConfigFile, false); setDefaults(); loaded = true; --- 54,58 ---- /* List the property files to read here */ load(myConfigFile, false); ! //load(gamesConfigFile, false); setDefaults(); loaded = true; |
From: Erik V. <ev...@us...> - 2010-01-15 20:21:48
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11332/rails/game Modified Files: OperatingRound.java Log Message: Fixed addressed player for train discards Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** OperatingRound.java 15 Jan 2010 19:55:59 -0000 1.90 --- OperatingRound.java 15 Jan 2010 20:21:28 -0000 1.91 *************** *** 2245,2248 **** --- 2245,2249 ---- player = gameManager.getPlayerByIndex(i); if (excessTrainCompanies.containsKey(player)) { + setCurrentPlayer(player); list = excessTrainCompanies.get(player); for (PublicCompanyI comp : list) { *************** *** 2252,2256 **** // We come back here until all excess trains have been // discarded. - setCurrentPlayer(player); return; } --- 2253,2256 ---- |
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6617/rails/game Modified Files: Bank.java TileManager.java Game.java GameDef.java GameManagerI.java ReportBuffer.java Round.java TrainManager.java ShareSellingRound.java StockRound.java TreasuryShareRound.java ComponentManager.java OperatingRound.java RoundI.java GameManager.java GameOption.java Log Message: Moved various non-changing variables to gameParameters (via GameDef.Parm). Cleanups. Index: TreasuryShareRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TreasuryShareRound.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TreasuryShareRound.java 14 Jan 2010 20:57:23 -0000 1.16 --- TreasuryShareRound.java 15 Jan 2010 19:55:59 -0000 1.17 *************** *** 127,131 **** operatingCompany.getPortfolio().getShare(operatingCompany); // Max share that may be owned ! int maxShare = gameManager.getTreasuryShareLimit(); // Max number of shares to add int maxBuyable = --- 127,131 ---- operatingCompany.getPortfolio().getShare(operatingCompany); // Max share that may be owned ! int maxShare = getGameParameterAsInt(GameDef.Parm.TREASURY_SHARE_LIMIT); // Max number of shares to add int maxBuyable = *************** *** 179,183 **** /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, bank.getPoolShareLimit() - pool.getShare(company)); if (maxShareToSell == 0) continue; --- 179,184 ---- /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, ! getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT) - pool.getShare(company)); if (maxShareToSell == 0) continue; *************** *** 307,314 **** // Check if company would exceed the per-company share limit ! if (portfolio.getShare(company) + shares * company.getShareUnit() > gameManager.getTreasuryShareLimit()) { errMsg = LocalText.getText("TreasuryOverHoldLimit", ! String.valueOf(gameManager.getTreasuryShareLimit())); break; } --- 308,317 ---- // Check if company would exceed the per-company share limit ! int treasuryShareLimit = getGameParameterAsInt(GameDef.Parm.TREASURY_SHARE_LIMIT); ! if (portfolio.getShare(company) + shares * company.getShareUnit() ! > treasuryShareLimit) { errMsg = LocalText.getText("TreasuryOverHoldLimit", ! String.valueOf(treasuryShareLimit)); break; } *************** *** 424,428 **** // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() > bank.getPoolShareLimit()) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; --- 427,432 ---- // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() ! > getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT)) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; Index: ReportBuffer.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ReportBuffer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReportBuffer.java 27 Nov 2009 20:34:01 -0000 1.7 --- ReportBuffer.java 15 Jan 2010 19:55:59 -0000 1.8 *************** *** 116,120 **** reportPathname = reportDirectory + "/" + GameManager.getInstance().getGameName() + "_" ! + GameManager.getInstance().getKey() + "_" + dateFormat.format(new Date()) + "." + reportFilenameExtension; --- 116,120 ---- reportPathname = reportDirectory + "/" + GameManager.getInstance().getGameName() + "_" ! + GameManager.getInstance().getGMKey() + "_" + dateFormat.format(new Date()) + "." + reportFilenameExtension; Index: TileManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileManager.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TileManager.java 4 Nov 2009 20:33:22 -0000 1.13 --- TileManager.java 15 Jan 2010 19:55:59 -0000 1.14 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import rails.util.LocalText; import rails.util.Tag; public class TileManager implements ConfigurableComponentI { protected Map<Integer, TileI> tileMap = new HashMap<Integer, TileI>(); protected List<Integer> tileIds = new ArrayList<Integer>(); private static List<String> directories = new ArrayList<String>(); /** * No-args constructor. */ public TileManager() { } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tileSetTop) throws ConfigurationException { /* * Note: prefix se is used for elements from TileSet.xml, prefix te for * elements from Tiles.xml. */ String tileDefFileName = tileSetTop.getAttributeAsString("tiles"); if (tileDefFileName == null) throw new ConfigurationException(LocalText.getText("NoTilesXML")); directories.add("data/" + ComponentManager.getGameName()); Tag tileDefTop = Tag.findTopTagInFile(tileDefFileName, directories, "Tiles"); if (tileDefTop == null) throw new ConfigurationException(LocalText.getText("NoTilesTag")); List<Tag> tileSetList = tileSetTop.getChildren("Tile"); List<Tag> tileDefList = tileDefTop.getChildren("Tile"); /* * The XML files TileSet.xml and Tiles.xml are read side by side, as * each one configures different tile aspects. The reason for having two * XML files is, that Tiles.xml defines per-tile aspects that are the * same for all games (such as the colour, tracks and stations; this * file is an automatically generated subset of the generic file * tiles/Tiles.xml), whereas TileSet.xml specifies the aspects that are * (or can be) specific to each rails.game (such as the possible * upgrades). <p>TileSet.xml is leading. */ int tileId; TileI tile; // Creates maps to the tile definitions in both files. Map<Integer, Tag> tileSetMap = new HashMap<Integer, Tag>(); Map<Integer, Tag> tileDefMap = new HashMap<Integer, Tag>(); for (Tag tileSetTag : tileSetList) { tileId = tileSetTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTilesetID", String.valueOf(tileId))); } tileSetMap.put(tileId, tileSetTag); tileIds.add(tileId); } for (Tag tileDefTag : tileDefList) { tileId = tileDefTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileDefMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTileID", String.valueOf(tileId))); } else if (!tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "TileMissingInTileSet", String.valueOf(tileId))); } tileDefMap.put(tileId, tileDefTag); } // Create the Tile objects (must be done before further parsing) for (Integer id : tileSetMap.keySet()) { tile = new Tile(id); tileMap.put(id, tile); } // Finally, parse the <Tile> subtags for (Integer id : tileMap.keySet()) { tile = tileMap.get(id); tile.configureFromXML(tileSetMap.get(id), tileDefMap.get(id)); } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (TileI tile : tileMap.values()) { tile.finishConfiguration(this); } } public TileI getTile(int id) { return tileMap.get(id); } /** Get the tile IDs in the XML definition sequence */ public List<Integer> getTileIds() { return tileIds; } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import rails.util.LocalText; import rails.util.Tag; public class TileManager implements ConfigurableComponentI { protected Map<Integer, TileI> tileMap = new HashMap<Integer, TileI>(); protected List<Integer> tileIds = new ArrayList<Integer>(); private static List<String> directories = new ArrayList<String>(); /** * No-args constructor. */ public TileManager() { } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tileSetTop) throws ConfigurationException { /* * Note: prefix se is used for elements from TileSet.xml, prefix te for * elements from Tiles.xml. */ String tileDefFileName = tileSetTop.getAttributeAsString("tiles"); if (tileDefFileName == null) throw new ConfigurationException(LocalText.getText("NoTilesXML")); //directories.add("data/" + ComponentManager.getGameName()); directories.add("data/" + GameManager.getInstance().getGameName()); Tag tileDefTop = Tag.findTopTagInFile(tileDefFileName, directories, "Tiles"); if (tileDefTop == null) throw new ConfigurationException(LocalText.getText("NoTilesTag")); List<Tag> tileSetList = tileSetTop.getChildren("Tile"); List<Tag> tileDefList = tileDefTop.getChildren("Tile"); /* * The XML files TileSet.xml and Tiles.xml are read side by side, as * each one configures different tile aspects. The reason for having two * XML files is, that Tiles.xml defines per-tile aspects that are the * same for all games (such as the colour, tracks and stations; this * file is an automatically generated subset of the generic file * tiles/Tiles.xml), whereas TileSet.xml specifies the aspects that are * (or can be) specific to each rails.game (such as the possible * upgrades). <p>TileSet.xml is leading. */ int tileId; TileI tile; // Creates maps to the tile definitions in both files. Map<Integer, Tag> tileSetMap = new HashMap<Integer, Tag>(); Map<Integer, Tag> tileDefMap = new HashMap<Integer, Tag>(); for (Tag tileSetTag : tileSetList) { tileId = tileSetTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTilesetID", String.valueOf(tileId))); } tileSetMap.put(tileId, tileSetTag); tileIds.add(tileId); } for (Tag tileDefTag : tileDefList) { tileId = tileDefTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileDefMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTileID", String.valueOf(tileId))); } else if (!tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "TileMissingInTileSet", String.valueOf(tileId))); } tileDefMap.put(tileId, tileDefTag); } // Create the Tile objects (must be done before further parsing) for (Integer id : tileSetMap.keySet()) { tile = new Tile(id); tileMap.put(id, tile); } // Finally, parse the <Tile> subtags for (Integer id : tileMap.keySet()) { tile = tileMap.get(id); tile.configureFromXML(tileSetMap.get(id), tileDefMap.get(id)); } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (TileI tile : tileMap.values()) { tile.finishConfiguration(this); } } public TileI getTile(int id) { return tileMap.get(id); } /** Get the tile IDs in the XML definition sequence */ public List<Integer> getTileIds() { return tileIds; } } \ No newline at end of file Index: RoundI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/RoundI.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RoundI.java 25 Nov 2009 18:44:45 -0000 1.13 --- RoundI.java 15 Jan 2010 19:55:59 -0000 1.14 *************** *** 31,33 **** --- 31,34 ---- public String getRoundName(); + } Index: TrainManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainManager.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TrainManager.java 8 Dec 2009 19:31:32 -0000 1.24 --- TrainManager.java 15 Jan 2010 19:55:59 -0000 1.25 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected Map<String, TrainI> trainMap = new HashMap<String, TrainI>(); protected boolean buyAtFaceValueBetweenDifferentPresidents = false; // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; protected GameManagerI gameManager = null; protected Bank bank = null; // Non-game attributes protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special buyAtFaceValueBetweenDifferentPresidents = rulesTag.getChild("FaceValueIfDifferentPresidents") != null; } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { this.gameManager = gameManager; bank = gameManager.getBank(); ipo = bank.getIpo(); unavailable = bank.getUnavailable(); for (TrainTypeI type : lTrainTypes) { type.finishConfiguration(gameManager); } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(bank); } public void addTrain (String uniqueID, TrainI train) { trainMap.put(uniqueID, train); } public TrainI getTrainByUniqueId(String id) { return trainMap.get(id); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); nextType = (lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(bank); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { gameManager.getPhaseManager().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(bank); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public String getTrainCostOverview() { StringBuffer b = new StringBuffer(); for (TrainTypeI type : lTrainTypes) { if (b.length() > 1) b.append(" "); b.append(type.getName()).append(":").append(Bank.format(type.getCost())); if (type.getFirstExchangeCost() > 0) { b.append("(").append(Bank.format(type.getFirstExchangeCost())).append(")"); } } return b.toString(); } public TrainTypeI getTypeByName(String name) { return mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } public boolean buyAtFaceValueBetweenDifferentPresidents() { return buyAtFaceValueBetweenDifferentPresidents; } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected Map<String, TrainI> trainMap = new HashMap<String, TrainI>(); // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; protected GameManagerI gameManager = null; protected Bank bank = null; // Non-game attributes protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special GameManager.getInstance().setGameParameter(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS, rulesTag.getChild("FaceValueIfDifferentPresidents") != null); } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { this.gameManager = gameManager; bank = gameManager.getBank(); ipo = bank.getIpo(); unavailable = bank.getUnavailable(); for (TrainTypeI type : lTrainTypes) { type.finishConfiguration(gameManager); } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(bank); } public void addTrain (String uniqueID, TrainI train) { trainMap.put(uniqueID, train); } public TrainI getTrainByUniqueId(String id) { return trainMap.get(id); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); nextType = (lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(bank); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { gameManager.getPhaseManager().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(bank); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public String getTrainCostOverview() { StringBuffer b = new StringBuffer(); for (TrainTypeI type : lTrainTypes) { if (b.length() > 1) b.append(" "); b.append(type.getName()).append(":").append(Bank.format(type.getCost())); if (type.getFirstExchangeCost() > 0) { b.append("(").append(Bank.format(type.getFirstExchangeCost())).append(")"); } } return b.toString(); } public TrainTypeI getTypeByName(String name) { return mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } } \ No newline at end of file Index: Bank.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Bank.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Bank.java 26 Nov 2009 20:11:39 -0000 1.17 --- Bank.java 15 Jan 2010 19:55:55 -0000 1.18 *************** *** 12,16 **** /** Default limit of shares in the bank pool */ - private static final int DEFAULT_POOL_SHARE_LIMIT = 50; private static final int DEFAULT_BANK_AMOUNT = 12000; private static final String DEFAULT_MONEY_FORMAT = "$@"; --- 12,15 ---- *************** *** 41,46 **** private String moneyFormat = null; - private int poolShareLimit = DEFAULT_POOL_SHARE_LIMIT; - protected static Logger log = Logger.getLogger(Bank.class.getPackage().getName()); --- 40,43 ---- *************** *** 119,129 **** /** - * @param percentage of a company allowed to be in the Bank pool. - */ - public void setPoolShareLimit(int percentage) { - poolShareLimit = percentage; - } - - /** * @return IPO Portfolio */ --- 116,119 ---- *************** *** 203,215 **** } - /** - * Get the maximum share percentage that may be sold to the Bank Pool. - * - * @return The maximum percentage. - */ - public int getPoolShareLimit() { - return poolShareLimit; - } - public static String format(int amount) { // Replace @ with the amount --- 193,196 ---- Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** GameManager.java 14 Jan 2010 21:02:39 -0000 1.75 --- GameManager.java 15 Jan 2010 19:55:59 -0000 1.76 *************** *** 67,72 **** new HashMap<String, Portfolio> (); - protected int playerShareLimit = 60; - protected int treasuryShareLimit = 50; // For some games protected IntegerState playerCertificateLimit = new IntegerState ("PlayerCertificateLimit", 0); --- 67,70 ---- *************** *** 110,115 **** new EnumMap<GuiDef.Parm, Boolean>(GuiDef.Parm.class); - //protected int stockRoundSequenceRule = StockRound.SELL_BUY_SELL; - /** * Map of GameManager instances. --- 108,111 ---- *************** *** 128,135 **** * This is possible,because the server processes all player actions * in one thread. The key will be set in process(), which is where server ! * processing currently starts (in the furtire it will probably be moved ! * to the then needed communication interface). The key ! * can be retrieved (via NDC.peek()) anywhere. ! * <p>For now, the key is a fixed string, but that may change in the future. */ protected static Map<String, GameManagerI> gameManagerMap --- 124,132 ---- * This is possible,because the server processes all player actions * in one thread. The key will be set in process(), which is where server ! * processing currently starts (in the future it will probably be moved ! * to the communication interface that will be added by then). ! * The key can be retrieved (via NDC.peek()) anywhere. ! * <p> ! * For now, the key is a fixed string, but that may change in the future. */ protected static Map<String, GameManagerI> gameManagerMap *************** *** 161,165 **** protected String gmName; ! protected String key; protected StartPacket startPacket; --- 158,162 ---- protected String gmName; ! protected String gmKey; protected StartPacket startPacket; *************** *** 180,186 **** --- 177,185 ---- /* Some standard tags for conditional attributes */ public static final String VARIANT_KEY = "Variant"; + /* No longer used (temporarily?) public static final String OPTION_TAG = "GameOption"; public static final String IF_OPTION_TAG = "IfOption"; public static final String ATTRIBUTES_TAG = "Attributes"; + */ protected static Logger log = *************** *** 193,197 **** public GameManager() { gmName = GM_NAME; ! key = GM_KEY; NDC.clear(); NDC.push (GM_KEY); --- 192,196 ---- public GameManager() { gmName = GM_NAME; ! gmKey = GM_KEY; NDC.clear(); NDC.push (GM_KEY); *************** *** 212,216 **** --- 211,220 ---- throw new ConfigurationException("No name specified in Game tag"); + gameOptions = tag.getGameOptions(); + + initGameParameters(); + // Get any available game options + /* THIS IS NOT CURRENTLY USED, but I leave it in for another while (EV) GameOption option; String optionName, optionType, optionValues, optionDefault; *************** *** 238,317 **** } } ! // StockRound class and other properties ! // Set default rule(s) ! gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! GameDef.Parm.STOCK_ROUND_SEQUENCE.defaultValueAsInt()); - Tag srTag = tag.getChild("StockRound"); - if (srTag != null) { - String srClassName = - srTag.getAttributeAsString("class", "rails.game.StockRound"); - try { - stockRoundClass = - Class.forName(srClassName).asSubclass(StockRound.class); - } catch (ClassNotFoundException e) { - throw new ConfigurationException("Cannot find class " - + srClassName, e); - } - String stockRoundSequenceRuleString = - srTag.getAttributeAsString("sequence"); - if (Util.hasValue(stockRoundSequenceRuleString)) { - if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuySell")) { - //stockRoundSequenceRule = StockRound.SELL_BUY_SELL; - gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, - StockRound.SELL_BUY_SELL); - } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuy")) { - //stockRoundSequenceRule = StockRound.SELL_BUY; - gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, - StockRound.SELL_BUY); - } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuyOrBuySell")) { - //stockRoundSequenceRule = StockRound.SELL_BUY_OR_BUY_SELL; - gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, - StockRound.SELL_BUY_OR_BUY_SELL); - } - } ! skipFirstStockRound = ! srTag.getAttributeAsBoolean("skipFirst", ! skipFirstStockRound); ! } ! // OperatingRound class ! Tag orTag = tag.getChild("OperatingRound"); ! if (orTag != null) { ! String orClassName = ! orTag.getAttributeAsString("class", ! "rails.game.OperatingRound"); ! try { ! operatingRoundClass = ! Class.forName(orClassName).asSubclass( ! OperatingRound.class); ! } catch (ClassNotFoundException e) { ! throw new ConfigurationException("Cannot find class " ! + orClassName, e); ! } ! } ! /* Max. % of shares of one company that a player may hold */ ! Tag shareLimitTag = tag.getChild("PlayerShareLimit"); ! if (shareLimitTag != null) { ! playerShareLimit = shareLimitTag.getAttributeAsInteger("percentage", playerShareLimit); ! } ! /* Max. % of shares of one company that the bank pool may hold */ ! Tag poolLimitTag = tag.getChild("BankPoolShareLimit"); ! if (poolLimitTag != null) { ! bank.setPoolShareLimit(poolLimitTag.getAttributeAsInteger("percentage")); ! } ! /* Max. % of own shares that a company treasury may hold */ ! Tag treasuryLimitTag = tag.getChild("TreasuryShareLimit"); ! if (treasuryLimitTag != null) { ! treasuryShareLimit = ! treasuryLimitTag.getAttributeAsInteger("percentage", ! treasuryShareLimit); } /* End of rails.game criteria */ Tag endOfGameTag = tag.getChild("EndOfGame"); --- 242,325 ---- } } + */ ! Tag gameParmTag = tag.getChild("GameParameters"); ! if (gameParmTag != null) { ! // StockRound class and other properties ! Tag srTag = gameParmTag.getChild("StockRound"); ! if (srTag != null) { ! String srClassName = ! srTag.getAttributeAsString("class", "rails.game.StockRound"); ! try { ! stockRoundClass = ! Class.forName(srClassName).asSubclass(StockRound.class); ! } catch (ClassNotFoundException e) { ! throw new ConfigurationException("Cannot find class " ! + srClassName, e); ! } ! String stockRoundSequenceRuleString = ! srTag.getAttributeAsString("sequence"); ! if (Util.hasValue(stockRoundSequenceRuleString)) { ! if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuySell")) { ! setGameParameter(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY_SELL); ! } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuy")) { ! setGameParameter(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY); ! } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuyOrBuySell")) { ! setGameParameter(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY_OR_BUY_SELL); ! } ! } ! skipFirstStockRound = ! srTag.getAttributeAsBoolean("skipFirst", ! skipFirstStockRound); ! } ! // OperatingRound class ! Tag orTag = gameParmTag.getChild("OperatingRound"); ! if (orTag != null) { ! String orClassName = ! orTag.getAttributeAsString("class", ! "rails.game.OperatingRound"); ! try { ! operatingRoundClass = ! Class.forName(orClassName).asSubclass( ! OperatingRound.class); ! } catch (ClassNotFoundException e) { ! throw new ConfigurationException("Cannot find class " ! + orClassName, e); ! } ! } ! /* Max. % of shares of one company that a player may hold */ ! Tag shareLimitTag = gameParmTag.getChild("PlayerShareLimit"); ! if (shareLimitTag != null) { ! setGameParameter (GameDef.Parm.PLAYER_SHARE_LIMIT, ! shareLimitTag.getAttributeAsInteger("percentage", ! GameDef.Parm.PLAYER_SHARE_LIMIT.defaultValueAsInt())); ! } ! /* Max. % of shares of one company that the bank pool may hold */ ! Tag poolLimitTag = gameParmTag.getChild("BankPoolShareLimit"); ! if (poolLimitTag != null) { ! setGameParameter (GameDef.Parm.POOL_SHARE_LIMIT, ! shareLimitTag.getAttributeAsInteger("percentage", ! GameDef.Parm.POOL_SHARE_LIMIT.defaultValueAsInt())); ! } ! ! /* Max. % of own shares that a company treasury may hold */ ! Tag treasuryLimitTag = gameParmTag.getChild("TreasuryShareLimit"); ! if (treasuryLimitTag != null) { ! setGameParameter (GameDef.Parm.TREASURY_SHARE_LIMIT, ! shareLimitTag.getAttributeAsInteger("percentage", ! GameDef.Parm.TREASURY_SHARE_LIMIT.defaultValueAsInt())); ! } } + /* End of rails.game criteria */ Tag endOfGameTag = tag.getChild("EndOfGame"); *************** *** 334,382 **** } ! // GameUIManager class ! Tag gameUIMgrTag = tag.getChild("GameUIManager"); ! if (gameUIMgrTag != null) { ! gameUIManagerClassName = ! gameUIMgrTag.getAttributeAsString("class", gameUIManagerClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (gameUIManagerClassName); ! } ! // ORUIManager class ! Tag orMgrTag = tag.getChild("ORUIManager"); ! if (orMgrTag != null) { ! orUIManagerClassName = ! orMgrTag.getAttributeAsString("class", orUIManagerClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (orUIManagerClassName); ! } ! // GameStatus class ! Tag gameStatusTag = tag.getChild("GameStatus"); ! if (gameStatusTag != null) { ! gameStatusClassName = ! gameStatusTag.getAttributeAsString("class", gameStatusClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (gameStatusClassName); ! } ! // StatusWindow class ! Tag statusWindowTag = tag.getChild("StatusWindow"); ! if (statusWindowTag != null) { ! statusWindowClassName = ! statusWindowTag.getAttributeAsString("class", ! statusWindowClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (statusWindowClassName); ! } ! // ORWindow class ! Tag orWindowTag = tag.getChild("ORWindow"); ! if (orWindowTag != null) { ! orWindowClassName = ! orWindowTag.getAttributeAsString("class", ! orWindowClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (orWindowClassName); } } --- 342,394 ---- } ! Tag guiClassesTag = tag.getChild("GuiClasses"); ! if (guiClassesTag != null) { ! // GameUIManager class ! Tag gameUIMgrTag = guiClassesTag.getChild("GameUIManager"); ! if (gameUIMgrTag != null) { ! gameUIManagerClassName = ! gameUIMgrTag.getAttributeAsString("class", gameUIManagerClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (gameUIManagerClassName); ! } ! // ORUIManager class ! Tag orMgrTag = guiClassesTag.getChild("ORUIManager"); ! if (orMgrTag != null) { ! orUIManagerClassName = ! orMgrTag.getAttributeAsString("class", orUIManagerClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (orUIManagerClassName); ! } ! // GameStatus class ! Tag gameStatusTag = guiClassesTag.getChild("GameStatus"); ! if (gameStatusTag != null) { ! gameStatusClassName = ! gameStatusTag.getAttributeAsString("class", gameStatusClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (gameStatusClassName); ! } ! // StatusWindow class ! Tag statusWindowTag = guiClassesTag.getChild("StatusWindow"); ! if (statusWindowTag != null) { ! statusWindowClassName = ! statusWindowTag.getAttributeAsString("class", ! statusWindowClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (statusWindowClassName); ! } ! ! // ORWindow class ! Tag orWindowTag = guiClassesTag.getChild("ORWindow"); ! if (orWindowTag != null) { ! orWindowClassName = ! orWindowTag.getAttributeAsString("class", ! orWindowClassName); ! // Check instantiatability (not sure if this belongs here) ! canClassBeInstantiated (orWindowClassName); ! } } } *************** *** 434,438 **** this.gameOptions = gameOptions; ! setGameParameters(); if (startPacket == null) --- 446,450 ---- this.gameOptions = gameOptions; ! setGuiParameters(); if (startPacket == null) *************** *** 451,455 **** } ! private void setGameParameters () { for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { --- 463,467 ---- } ! private void setGuiParameters () { for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { *************** *** 472,475 **** --- 484,494 ---- } + private void initGameParameters() { + + for (GameDef.Parm parm : GameDef.Parm.values()) { + gameParameters.put(parm, parm.defaultValue()); + } + } + /** * @return instance of GameManager *************** *** 1018,1025 **** } - public int getPlayerShareLimit() { - return playerShareLimit; - } - /* (non-Javadoc) * @see rails.game.GameManagerI#getAllPublicCompanies() --- 1037,1040 ---- *************** *** 1158,1175 **** /* (non-Javadoc) - * @see rails.game.GameManagerI#getStockRoundSequenceRule() - */ - public int getStockRoundSequenceRule() { - return (Integer) gameParameters.get(GameDef.Parm.STOCK_ROUND_SEQUENCE); - } - - /* (non-Javadoc) - * @see rails.game.GameManagerI#getTreasuryShareLimit() - */ - public int getTreasuryShareLimit() { - return treasuryShareLimit; - } - - /* (non-Javadoc) * @see rails.game.GameManagerI#getCommonParameter(rails.common.Defs.Parm) */ --- 1173,1176 ---- *************** *** 1280,1285 **** } ! public String getKey () { ! return key; } --- 1281,1286 ---- } ! public String getGMKey () { ! return gmKey; } Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Round.java 14 Jan 2010 21:00:30 -0000 1.34 --- Round.java 15 Jan 2010 19:55:59 -0000 1.35 *************** *** 401,404 **** --- 401,424 ---- } + protected Object getGameParameter (GameDef.Parm key) { + return gameManager.getGameParameter(key); + } + + public int getGameParameterAsInt (GameDef.Parm key) { + if (key.defaultValue() instanceof Integer) { + return (Integer) gameManager.getGameParameter(key); + } else { + return -1; + } + } + + public boolean getGameParameterAsBoolean (GameDef.Parm key) { + if (key.defaultValue() instanceof Boolean) { + return (Boolean) gameManager.getGameParameter(key); + } else { + return false; + } + } + public String getRoundName() { return this.getClass().getSimpleName(); Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Game.java 14 Jan 2010 21:03:47 -0000 1.44 --- Game.java 15 Jan 2010 19:55:59 -0000 1.45 *************** *** 73,77 **** try { - // Have the ComponentManager work through the other rails.game files componentManagerTag = Tag.findTopTagInFile(GAME_XML_FILE, directories, --- 73,76 ---- *************** *** 82,88 **** } ! ComponentManager.configureInstance(name, componentManagerTag, gameOptions); ! ! componentManager = ComponentManager.getInstance(); log.info("========== Start of rails.game " + name + " =========="); --- 81,87 ---- } ! componentManagerTag.setGameOptions(gameOptions); ! componentManager = ! ComponentManager.configureInstance(name, componentManagerTag, gameOptions); log.info("========== Start of rails.game " + name + " =========="); Index: GameOption.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameOption.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GameOption.java 23 Nov 2009 18:32:45 -0000 1.8 --- GameOption.java 15 Jan 2010 19:55:59 -0000 1.9 *************** *** 21,25 **** public static final String OPTION_VALUE_NO = "no"; ! public static final String NUMBER_OF_PLAYERS = "numberOfPlayers"; public GameOption(String name) { --- 21,26 ---- public static final String OPTION_VALUE_NO = "no"; ! // A default option that will always be set ! public static final String NUMBER_OF_PLAYERS = "NumberOfPlayers"; public GameOption(String name) { Index: ShareSellingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ShareSellingRound.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ShareSellingRound.java 14 Jan 2010 20:59:19 -0000 1.27 --- ShareSellingRound.java 15 Jan 2010 19:55:59 -0000 1.28 *************** *** 118,122 **** /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, bank.getPoolShareLimit() - pool.getShare(company)); if (maxShareToSell == 0) continue; --- 118,123 ---- /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, ! getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT) - pool.getShare(company)); if (maxShareToSell == 0) continue; *************** *** 238,242 **** // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() > bank.getPoolShareLimit()) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; --- 239,244 ---- // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() ! > getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT)) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** OperatingRound.java 14 Jan 2010 22:10:47 -0000 1.89 --- OperatingRound.java 15 Jan 2010 19:55:59 -0000 1.90 *************** *** 2198,2202 **** if (train.isObsolete()) continue; if (i != currentPlayerIndex ! && trainMgr.buyAtFaceValueBetweenDifferentPresidents() || operatingCompany.mustTradeTrainsAtFixedPrice() || company.mustTradeTrainsAtFixedPrice()) { --- 2198,2203 ---- if (train.isObsolete()) continue; if (i != currentPlayerIndex ! //&& trainMgr.buyAtFaceValueBetweenDifferentPresidents() ! && getGameParameterAsBoolean(GameDef.Parm.FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS) || operatingCompany.mustTradeTrainsAtFixedPrice() || company.mustTradeTrainsAtFixedPrice()) { Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** StockRound.java 14 Jan 2010 20:58:39 -0000 1.54 --- StockRound.java 15 Jan 2010 19:55:59 -0000 1.55 *************** *** 67,71 **** numberOfPlayers = gameManager.getPlayers().size(); ! sequenceRule = gameManager.getStockRoundSequenceRule(); guiHints.setVisibilityHint(GuiDef.Panel.MAP, true); --- 67,71 ---- numberOfPlayers = gameManager.getPlayers().size(); ! sequenceRule = getGameParameterAsInt(GameDef.Parm.STOCK_ROUND_SEQUENCE); guiHints.setVisibilityHint(GuiDef.Panel.MAP, true); *************** *** 299,303 **** /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, bank.getPoolShareLimit() - pool.getShare(company)); if (maxShareToSell == 0) continue; --- 299,304 ---- /* May not sell more than the Pool can accept */ maxShareToSell = ! Math.min(maxShareToSell, ! getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT) - pool.getShare(company)); if (maxShareToSell == 0) continue; *************** *** 872,876 **** // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() > bank.getPoolShareLimit()) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; --- 873,878 ---- // The pool may not get over its limit. ! if (pool.getShare(company) + numberToSell * company.getShareUnit() ! > getGameParameterAsInt(GameDef.Parm.POOL_SHARE_LIMIT)) { errMsg = LocalText.getText("PoolOverHoldLimit"); break; *************** *** 1074,1078 **** errMsg = LocalText.getText("WouldExceedHoldLimit", ! String.valueOf(gameManager.getPlayerShareLimit())); break; } --- 1076,1080 ---- errMsg = LocalText.getText("WouldExceedHoldLimit", ! String.valueOf(getGameParameterAsInt(GameDef.Parm.PLAYER_SHARE_LIMIT))); break; } *************** *** 1285,1289 **** if (player.getPortfolio().getShare(company) + number * company.getShareUnit() ! > gameManager.getPlayerShareLimit() && !company.getCurrentSpace().isNoHoldLimit()) return false; return true; --- 1287,1292 ---- if (player.getPortfolio().getShare(company) + number * company.getShareUnit() ! //> gameManager.getPlayerShareLimit() ! > getGameParameterAsInt(GameDef.Parm.PLAYER_SHARE_LIMIT) && !company.getCurrentSpace().isNoHoldLimit()) return false; return true; *************** *** 1307,1316 **** int limit; if (!company.hasStarted()) { ! limit = gameManager.getPlayerShareLimit(); } else { limit = company.getCurrentSpace().isNoHoldLimit() ? 100 ! : gameManager.getPlayerShareLimit(); } return (limit - player.getPortfolio().getShare(company)) / shareSize; --- 1310,1320 ---- int limit; + int playerShareLimit = getGameParameterAsInt (GameDef.Parm.PLAYER_SHARE_LIMIT); if (!company.hasStarted()) { ! limit = playerShareLimit; } else { limit = company.getCurrentSpace().isNoHoldLimit() ? 100 ! : playerShareLimit; } return (limit - player.getPortfolio().getShare(company)) / shareSize; Index: GameDef.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameDef.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameDef.java 14 Jan 2010 21:03:19 -0000 1.1 --- GameDef.java 15 Jan 2010 19:55:59 -0000 1.2 *************** *** 13,17 **** NO_SALE_IN_FIRST_SR (false), NO_SALE_IF_NOT_OPERATED (false), ! STOCK_ROUND_SEQUENCE(StockRound.SELL_BUY_SELL); private Object defaultValue; --- 13,22 ---- NO_SALE_IN_FIRST_SR (false), NO_SALE_IF_NOT_OPERATED (false), ! STOCK_ROUND_SEQUENCE(StockRound.SELL_BUY_SELL), ! PLAYER_SHARE_LIMIT (60), ! POOL_SHARE_LIMIT(50), ! TREASURY_SHARE_LIMIT(50), ! FIXED_PRICE_TRAINS_BETWEEN_PRESIDENTS(false), ! SKIP_FIRST_STOCK_ROUND(false); private Object defaultValue; *************** *** 20,23 **** --- 25,29 ---- Parm (int defaultValue) { this.defaultValue = defaultValue; } + public Object defaultValue() { return defaultValue; } public boolean defaultValueAsBoolean() { return (Boolean) defaultValue; } public int defaultValueAsInt() { return (Integer) defaultValue; } Index: ComponentManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ComponentManager.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ComponentManager.java 31 Oct 2009 17:08:27 -0000 1.15 --- ComponentManager.java 15 Jan 2010 19:55:59 -0000 1.16 *************** *** 17,21 **** public class ComponentManager { ! private static String gameName; /** The name of the XML tag used to configu... [truncated message content] |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:06
|
Update of /cvsroot/rails/18xx/data/1830 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/1830 Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1830/Game.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Game.xml 23 Nov 2009 18:32:47 -0000 1.25 --- Game.xml 15 Jan 2010 19:53:57 -0000 1.26 *************** *** 13,21 **** in a dropdown the first item is always the default). --> <GameOption name="WithOptional6Train" type="toggle" default="no"/> <GameOption name="UnlimitedTopTrains" parm="D" type="toggle" default="no"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> <EndOfGame> <Bankruptcy/> --- 13,32 ---- in a dropdown the first item is always the default). --> + <!-- The options in Game.xml are not currently used. + See GamesList.xml for the real ones. + --> <GameOption name="WithOptional6Train" type="toggle" default="no"/> <GameOption name="UnlimitedTopTrains" parm="D" type="toggle" default="no"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <GameParameters> ! <PlayerShareLimit percentage="60"> ! <!-- Option "NumberOfPlayers" is automatically set ! by the game engine --> ! <IfOption name="NumberOfPlayers" value="2"> ! <Attributes percentage="70"/> ! </IfOption> ! </PlayerShareLimit> ! <BankPoolLimit percentage="50"/> ! </GameParameters> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:06
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/1835 Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/Game.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Game.xml 3 Sep 2009 21:36:54 -0000 1.19 --- Game.xml 15 Jan 2010 19:53:57 -0000 1.20 *************** *** 4,11 **** <Game name="1835"/> <GameOption name="Variant" values="Standard,Clemens,Snake"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <StockRound class="rails.game.specific._1835.StockRound_1835" ! sequence="SellBuySell"/> <EndOfGame> <BankBreaks limit="0" finish="currentOR"/> --- 4,13 ---- <Game name="1835"/> <GameOption name="Variant" values="Standard,Clemens,Snake"/> ! <GameParameters> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <StockRound class="rails.game.specific._1835.StockRound_1835" ! sequence="SellBuySell"/> ! </GameParameters> <EndOfGame> <BankBreaks limit="0" finish="currentOR"/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:06
|
Update of /cvsroot/rails/18xx/data/1851 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/1851 Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1851/Game.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Game.xml 22 Dec 2009 11:23:36 -0000 1.5 --- Game.xml 15 Jan 2010 19:53:57 -0000 1.6 *************** *** 3,10 **** <Component name="GameManager" class="rails.game.GameManager"> <Game name="1851"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <TreasuryShareLimit percentage="50"/> ! <StockRound sequence="SellBuy"/> <EndOfGame> <Bankruptcy/> --- 3,12 ---- <Component name="GameManager" class="rails.game.GameManager"> <Game name="1851"/> ! <GameParameters> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <TreasuryShareLimit percentage="50"/> ! <StockRound sequence="SellBuy"/> ! </GameParameters> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:05
|
Update of /cvsroot/rails/18xx/data/1870 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/1870 Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1870/Game.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Game.xml 23 Nov 2009 18:32:47 -0000 1.20 --- Game.xml 15 Jan 2010 19:53:56 -0000 1.21 *************** *** 4,11 **** <Game name="1870"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <PlayerShareLimit percentage="60"> ! <PriceProtection/> ! </PlayerShareLimit> ! <BankPoolLimit percentage="50"/> <EndOfGame> <Bankruptcy/> --- 4,13 ---- <Game name="1870"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <GameParameters> ! <PlayerShareLimit percentage="60"> ! <PriceProtection/> ! </PlayerShareLimit> ! <BankPoolLimit percentage="50"/> ! </GameParameters> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:05
|
Update of /cvsroot/rails/18xx/data/18EU In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/18EU Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Game.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Game.xml 11 Jan 2010 23:06:17 -0000 1.10 --- Game.xml 15 Jan 2010 19:53:57 -0000 1.11 *************** *** 5,18 **** <GameOption name="Extra3Trains" values="0,1,2"/> <GameOption name="Extra4Trains" values="0,1"/> ! <StockRound class="rails.game.specific._18EU.StockRound_18EU" ! sequence="sellBuy" ! skipFirst="yes"/> ! <OperatingRound class="rails.game.specific._18EU.OperatingRound_18EU"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <TreasuryShareLimit percentage="80"/> ! <GameStatus class="rails.ui.swing.gamespecific._18EU.GameStatus_18EU"/> ! <StatusWindow class="rails.ui.swing.gamespecific._18EU.StatusWindow_18EU"/> ! <GameUIManager class="rails.ui.swing.gamespecific._18EU.GameUIManager_18EU"/> <EndOfGame> <Bankruptcy/> --- 5,22 ---- <GameOption name="Extra3Trains" values="0,1,2"/> <GameOption name="Extra4Trains" values="0,1"/> ! <GameParameters> ! <StockRound class="rails.game.specific._18EU.StockRound_18EU" ! sequence="sellBuy" ! skipFirst="yes"/> ! <OperatingRound class="rails.game.specific._18EU.OperatingRound_18EU"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! <TreasuryShareLimit percentage="80"/> ! </GameParameters> ! <GuiClasses> ! <GameStatus class="rails.ui.swing.gamespecific._18EU.GameStatus_18EU"/> ! <StatusWindow class="rails.ui.swing.gamespecific._18EU.StatusWindow_18EU"/> ! <GameUIManager class="rails.ui.swing.gamespecific._18EU.GameUIManager_18EU"/> ! </GuiClasses> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:05
|
Update of /cvsroot/rails/18xx/data/1856 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/1856 Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/Game.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Game.xml 28 Dec 2009 14:53:00 -0000 1.28 --- Game.xml 15 Jan 2010 19:53:57 -0000 1.29 *************** *** 5,14 **** <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> <GameOption name="UnlimitedBonusTokens" type="toggle" default="no"/> ! <StockRound class="rails.game.specific._1856.StockRound_1856" ! sequence="SellBuyOrBuySell"/> ! <OperatingRound class="rails.game.specific._1856.OperatingRound_1856"/> ! <StatusWindow class="rails.ui.swing.gamespecific._1856.StatusWindow_1856"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> <EndOfGame> <Bankruptcy/> --- 5,18 ---- <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> <GameOption name="UnlimitedBonusTokens" type="toggle" default="no"/> ! <GameParameters> ! <StockRound class="rails.game.specific._1856.StockRound_1856" ! sequence="SellBuyOrBuySell"/> ! <OperatingRound class="rails.game.specific._1856.OperatingRound_1856"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! </GameParameters> ! <GuiClasses> ! <StatusWindow class="rails.ui.swing.gamespecific._1856.StatusWindow_1856"/> ! </GuiClasses> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:04
|
Update of /cvsroot/rails/18xx/data/18AL In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/18AL Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18AL/Game.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Game.xml 23 Nov 2009 18:32:47 -0000 1.21 --- Game.xml 15 Jan 2010 19:53:55 -0000 1.22 *************** *** 6,13 **** <GameOption name="Obsolete4Trains" type="toggle" default="yes"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <OperatingRound class="rails.game.specific._18AL.OperatingRound_18AL"/> ! <ORUIManager class="rails.ui.swing.gamespecific._18AL.ORUIManager_18AL"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> <EndOfGame> <Bankruptcy/> --- 6,17 ---- <GameOption name="Obsolete4Trains" type="toggle" default="yes"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <GameParameters> ! <OperatingRound class="rails.game.specific._18AL.OperatingRound_18AL"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! </GameParameters> ! <GuiClasses> ! <ORUIManager class="rails.ui.swing.gamespecific._18AL.ORUIManager_18AL"/> ! </GuiClasses> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:54:03
|
Update of /cvsroot/rails/18xx/data/18Kaas In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6251/data/18Kaas Modified Files: Game.xml Log Message: Changes structure of GameManager XML Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18Kaas/Game.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Game.xml 23 Nov 2009 18:32:47 -0000 1.6 --- Game.xml 15 Jan 2010 19:53:56 -0000 1.7 *************** *** 4,9 **** <Game name="18Kaas"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> <EndOfGame> <Bankruptcy/> --- 4,11 ---- <Game name="18Kaas"/> <GameOption name="LeaveAuctionOnPass" type="toggle" default="no"/> ! <GameParameters> ! <PlayerShareLimit percentage="60"/> ! <BankPoolLimit percentage="50"/> ! </GameParameters> <EndOfGame> <Bankruptcy/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:53:16
|
Update of /cvsroot/rails/18xx/data In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6126/data Modified Files: GamesList.xml Log Message: Moved comments on game options from 1830/Game.xml to here Index: GamesList.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/GamesList.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GamesList.xml 28 Dec 2009 14:53:00 -0000 1.17 --- GamesList.xml 15 Jan 2010 19:53:05 -0000 1.18 *************** *** 11,14 **** --- 11,24 ---- - Privates cannot be traded between players. </Description> + <!-- GAME OPTIONS must have: + - a name, which must also exist as an entry in LocalText.properties, + - optionally 'type="toggle"', which has the effect that the + selection uses a checkbox instead of a dropdown list. + In this case, 'values' must be absent + (the allowed values are fixed to "yes,no"). + - optionally, 'values="a,b,c"' i,e, a list of allowed values. + - optionally, a default value (only affects a toggle; + in a dropdown the first item is always the default). + --> <Option name="WithOptional6Train" type="toggle" default="no"/> <Option name="UnlimitedTopTrains" parm="D" type="toggle" default="no"/> |
From: Erik V. <ev...@us...> - 2010-01-15 19:52:09
|
Update of /cvsroot/rails/18xx/rails/util In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5873/rails/util Modified Files: Tag.java Log Message: Added getGameOptions() Index: Tag.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/Tag.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Tag.java 28 Dec 2009 14:53:00 -0000 1.12 --- Tag.java 15 Jan 2010 19:52:01 -0000 1.13 *************** *** 51,54 **** --- 51,58 ---- } + public Map<String, String> getGameOptions () { + return gameOptions; + } + public Map<String, List<Tag>> getChildren() throws ConfigurationException { |
From: Erik V. <ev...@us...> - 2010-01-14 22:28:15
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22369/data/1835 Modified Files: TileSet.xml Log Message: Fixed missing upgrades Index: TileSet.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/TileSet.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TileSet.xml 30 Nov 2008 21:51:33 -0000 1.8 --- TileSet.xml 14 Jan 2010 22:28:07 -0000 1.9 *************** *** 49,56 **** <Tile id="4" quantity="3" /> <Tile id="5" quantity="3" > ! <Upgrade id="12,13,14,15,205,206" /> </Tile> <Tile id="6" quantity="3" > ! <Upgrade id="12,13,14,15,205" /> </Tile> <Tile id="7" quantity="8"> --- 49,56 ---- <Tile id="4" quantity="3" /> <Tile id="5" quantity="3" > ! <Upgrade id="12,14,15,205,206" /> </Tile> <Tile id="6" quantity="3" > ! <Upgrade id="12,13,14,15,205,206" /> </Tile> <Tile id="7" quantity="8"> |
From: Erik V. <ev...@us...> - 2010-01-14 22:28:15
|
Update of /cvsroot/rails/18xx/data/1830 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22369/data/1830 Modified Files: TileSet.xml Log Message: Fixed missing upgrades Index: TileSet.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1830/TileSet.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TileSet.xml 29 Nov 2008 20:01:33 -0000 1.7 --- TileSet.xml 14 Jan 2010 22:28:07 -0000 1.8 *************** *** 83,87 **** </Tile> <Tile id="25" quantity="1"> ! <Upgrade id="40" /> </Tile> <Tile id="26" quantity="1"> --- 83,87 ---- </Tile> <Tile id="25" quantity="1"> ! <Upgrade id="40,45,46" /> </Tile> <Tile id="26" quantity="1"> |
From: Erik V. <ev...@us...> - 2010-01-14 22:12:44
|
Update of /cvsroot/rails/18xx/data/1856 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19500/data/1856 Modified Files: StockMarket.xml Log Message: Fixed price typo Index: StockMarket.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/StockMarket.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StockMarket.xml 13 Dec 2009 16:39:49 -0000 1.4 --- StockMarket.xml 14 Jan 2010 22:12:36 -0000 1.5 *************** *** 127,131 **** <StockSpace name="M4" price="200" /> <StockSpace name="N1" price="300" /> ! <StockSpace name="N2" price="272" /> <StockSpace name="N3" price="250" /> <StockSpace name="O1" price="325" /> --- 127,131 ---- <StockSpace name="M4" price="200" /> <StockSpace name="N1" price="300" /> ! <StockSpace name="N2" price="275" /> <StockSpace name="N3" price="250" /> <StockSpace name="O1" price="325" /> |
From: Erik V. <ev...@us...> - 2010-01-14 22:10:59
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19100 Modified Files: LocalisedText.properties Log Message: Added orientation to a laid tile in the Game Report Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** LocalisedText.properties 14 Jan 2010 20:51:01 -0000 1.91 --- LocalisedText.properties 14 Jan 2010 22:10:51 -0000 1.92 *************** *** 218,223 **** LayTile=Lay Tile LayToken=Lay Token ! LaysTileAt={0} lays tile #{1} at hex {2} ! LaysTileAtFor={0} lays tile #{1} at hex {2} for {3} LeaveAuctionOnPass=Leave private auction on pass LoadFailed=Load failed, reason: {0} --- 218,223 ---- LayTile=Lay Tile LayToken=Lay Token ! LaysTileAt={0} lays tile #{1} at hex {2}/{3} ! LaysTileAtFor={0} lays tile #{1} at hex {2}/{3} for {4} LeaveAuctionOnPass=Leave private auction on pass LoadFailed=Load failed, reason: {0} |
From: Erik V. <ev...@us...> - 2010-01-14 22:10:59
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19100/rails/game Modified Files: OperatingRound.java Log Message: Added orientation to a laid tile in the Game Report Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** OperatingRound.java 14 Jan 2010 21:01:19 -0000 1.88 --- OperatingRound.java 14 Jan 2010 22:10:47 -0000 1.89 *************** *** 396,404 **** operatingCompany.layTile(hex, tile, orientation, cost); ! if (cost > 0) { ReportBuffer.add(LocalText.getText("LaysTileAt", companyName, tile.getExternalId(), ! hex.getName() )); } else { ReportBuffer.add(LocalText.getText("LaysTileAtFor", --- 396,405 ---- operatingCompany.layTile(hex, tile, orientation, cost); ! if (cost == 0) { ReportBuffer.add(LocalText.getText("LaysTileAt", companyName, tile.getExternalId(), ! hex.getName(), ! hex.getOrientationName(orientation))); } else { ReportBuffer.add(LocalText.getText("LaysTileAtFor", *************** *** 406,409 **** --- 407,411 ---- tile.getExternalId(), hex.getName(), + hex.getOrientationName(orientation), Bank.format(cost) )); } |
From: Erik V. <ev...@us...> - 2010-01-14 21:04:34
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7830/rails/game Modified Files: CompanyManager.java Log Message: Set game parameters in stead of some local variables Index: CompanyManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/CompanyManager.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CompanyManager.java 31 Oct 2009 17:08:27 -0000 1.18 --- CompanyManager.java 14 Jan 2010 21:04:26 -0000 1.19 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import org.apache.log4j.Logger; import rails.util.LocalText; import rails.util.Tag; public class CompanyManager implements CompanyManagerI, ConfigurableComponentI { /** A List with all private companies */ private List<PrivateCompanyI> lPrivateCompanies = new ArrayList<PrivateCompanyI>(); /** A List with all public companies */ private List<PublicCompanyI> lPublicCompanies = new ArrayList<PublicCompanyI>(); /** A map with all private companies by name */ private Map<String, PrivateCompanyI> mPrivateCompanies = new HashMap<String, PrivateCompanyI>(); /** A map with all public (i.e. non-private) companies by name */ private Map<String, PublicCompanyI> mPublicCompanies = new HashMap<String, PublicCompanyI>(); /** A map of all type names to maps of companies of that type by name */ // TODO Redundant, current usage can be replaced. private Map<String, HashMap<String, CompanyI>> mCompaniesByTypeAndName = new HashMap<String, HashMap<String, CompanyI>>(); /** A list of all start packets (usually one) */ private List<StartPacket> startPackets = new ArrayList<StartPacket>(); /** A map of all start packets, keyed by name. Default name is "Initial" */ private Map<String, StartPacket> startPacketMap = new HashMap<String, StartPacket>(); private int numberOfPublicCompanies = 0; protected static Logger log = Logger.getLogger(CompanyManager.class.getPackage().getName()); /* * NOTES: 1. we don't have a map over all companies, because some games have * duplicate names, e.g. B&O in 1830. 2. we have both a map and a list of * private/public companies to preserve configuration sequence while * allowing direct access. */ /** * No-args constructor. */ public CompanyManager() { // Nothing to do here, everything happens when configured. } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { /** A map with all company types, by type name */ // Localised here as it has no permanent use Map<String, CompanyTypeI> mCompanyTypes = new HashMap<String, CompanyTypeI>(); for (Tag compTypeTag : tag.getChildren(CompanyTypeI.ELEMENT_ID)) { // Extract the attributes of the Component String name = compTypeTag.getAttributeAsString(CompanyTypeI.NAME_TAG); if (name == null) { throw new ConfigurationException( LocalText.getText("UnnamedCompanyType")); } String className = compTypeTag.getAttributeAsString(CompanyTypeI.CLASS_TAG); if (className == null) { throw new ConfigurationException(LocalText.getText( "CompanyTypeHasNoClass", name)); } if (mCompanyTypes.get(name) != null) { throw new ConfigurationException(LocalText.getText( "CompanyTypeConfiguredTwice", name)); } CompanyTypeI companyType = new CompanyType(name, className); mCompanyTypes.put(name, companyType); // Further parsing is done within CompanyType companyType.configureFromXML(compTypeTag); } /* Read and configure the companies */ for (Tag companyTag : tag.getChildren(CompanyI.COMPANY_ELEMENT_ID)) { // Extract the attributes of the Component String name = companyTag.getAttributeAsString(CompanyI.COMPANY_NAME_TAG); if (name == null) { throw new ConfigurationException( LocalText.getText("UnnamedCompany")); } String type = companyTag.getAttributeAsString(CompanyI.COMPANY_TYPE_TAG); if (type == null) { throw new ConfigurationException(LocalText.getText( "CompanyHasNoType", name)); } CompanyTypeI cType = mCompanyTypes.get(type); if (cType == null) { throw new ConfigurationException(LocalText.getText( "CompanyHasUnknownType", name, type )); } try { CompanyI company = cType.createCompany(name, companyTag); /* Private or public */ if (company instanceof PrivateCompanyI) { mPrivateCompanies.put(name, (PrivateCompanyI) company); lPrivateCompanies.add((PrivateCompanyI) company); } else if (company instanceof PublicCompanyI) { ((PublicCompanyI)company).setIndex (numberOfPublicCompanies++); mPublicCompanies.put(name, (PublicCompanyI) company); lPublicCompanies.add((PublicCompanyI) company); } /* By type and name */ if (!mCompaniesByTypeAndName.containsKey(type)) mCompaniesByTypeAndName.put(type, new HashMap<String, CompanyI>()); ((Map<String, CompanyI>) mCompaniesByTypeAndName.get(type)).put( name, company); } catch (Exception e) { throw new ConfigurationException(LocalText.getText( "ClassCannotBeInstantiated", cType.getClassName()), e); } } /* Read and configure the start packets */ List<Tag> packetTags = tag.getChildren("StartPacket"); if (packetTags != null) { for (Tag packetTag : tag.getChildren("StartPacket")) { // Extract the attributes of the Component String name = packetTag.getAttributeAsString("name", StartPacket.DEFAULT_NAME); String roundClass = packetTag.getAttributeAsString("roundClass"); if (roundClass == null) { throw new ConfigurationException(LocalText.getText( "StartPacketHasNoClass", name)); } StartPacket sp = new StartPacket(name, roundClass); startPackets.add(sp); startPacketMap.put(name, sp); sp.configureFromXML(packetTag); } } /* Read and configure additional rules */ /* This part may move later to a GameRules or GameManager XML */ Tag rulesTag = tag.getChild("StockRoundRules"); if (rulesTag != null) { for (String ruleTagName : rulesTag.getChildren().keySet()) { if (ruleTagName.equals("NoSaleInFirstSR")) { StockRound.setNoSaleInFirstSR(); } else if (ruleTagName.equals("NoSaleIfNotOperated")) { StockRound.setNoSaleIfNotOperated(); } } } } // Post XML parsing initialisations public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (PublicCompanyI comp : lPublicCompanies) { comp.finishConfiguration(gameManager); } for (PrivateCompanyI comp : lPrivateCompanies) { comp.finishConfiguration(gameManager); } } /** * @see rails.game.CompanyManagerI#getCompany(java.lang.String) * */ public PrivateCompanyI getPrivateCompany(String name) { return mPrivateCompanies.get(name); } public PublicCompanyI getPublicCompany(String name) { return mPublicCompanies.get(name); } public List<PrivateCompanyI> getAllPrivateCompanies() { return lPrivateCompanies; } public List<PublicCompanyI> getAllPublicCompanies() { return lPublicCompanies; } public PublicCompanyI getCompanyByName(String name) { for (int i = 0; i < lPublicCompanies.size(); i++) { PublicCompany co = (PublicCompany) lPublicCompanies.get(i); if (name.equalsIgnoreCase(co.getName())) { return lPublicCompanies.get(i); } } return null; } public CompanyI getCompany(String type, String name) { if (mCompaniesByTypeAndName.containsKey(type)) { return (mCompaniesByTypeAndName.get(type)).get(name); } else { return null; } } public void closeAllPrivates() { if (lPrivateCompanies == null) return; for (PrivateCompanyI priv : lPrivateCompanies) { priv.setClosed(); } } public List<PrivateCompanyI> getPrivatesOwnedByPlayers() { List<PrivateCompanyI> privatesOwnedByPlayers = new ArrayList<PrivateCompanyI>(); for (PrivateCompanyI priv : getAllPrivateCompanies()) { if (priv.getPortfolio().getOwner() instanceof Player) { privatesOwnedByPlayers.add(priv); } } return privatesOwnedByPlayers; } public StartPacket getStartPacket (int index) { return startPackets.get(index); } public StartPacket getStartPacket (String name) { return startPacketMap.get(name); } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import org.apache.log4j.Logger; import rails.util.LocalText; import rails.util.Tag; public class CompanyManager implements CompanyManagerI, ConfigurableComponentI { /** A List with all private companies */ private List<PrivateCompanyI> lPrivateCompanies = new ArrayList<PrivateCompanyI>(); /** A List with all public companies */ private List<PublicCompanyI> lPublicCompanies = new ArrayList<PublicCompanyI>(); /** A map with all private companies by name */ private Map<String, PrivateCompanyI> mPrivateCompanies = new HashMap<String, PrivateCompanyI>(); /** A map with all public (i.e. non-private) companies by name */ private Map<String, PublicCompanyI> mPublicCompanies = new HashMap<String, PublicCompanyI>(); /** A map of all type names to maps of companies of that type by name */ // TODO Redundant, current usage can be replaced. private Map<String, HashMap<String, CompanyI>> mCompaniesByTypeAndName = new HashMap<String, HashMap<String, CompanyI>>(); /** A list of all start packets (usually one) */ private List<StartPacket> startPackets = new ArrayList<StartPacket>(); /** A map of all start packets, keyed by name. Default name is "Initial" */ private Map<String, StartPacket> startPacketMap = new HashMap<String, StartPacket>(); private int numberOfPublicCompanies = 0; protected static Logger log = Logger.getLogger(CompanyManager.class.getPackage().getName()); protected GameManagerI gameManager; /* * NOTES: 1. we don't have a map over all companies, because some games have * duplicate names, e.g. B&O in 1830. 2. we have both a map and a list of * private/public companies to preserve configuration sequence while * allowing direct access. */ /** * No-args constructor. */ public CompanyManager() { // Nothing to do here, everything happens when configured. } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { gameManager = GameManager.getInstance(); /** A map with all company types, by type name */ // Localised here as it has no permanent use Map<String, CompanyTypeI> mCompanyTypes = new HashMap<String, CompanyTypeI>(); for (Tag compTypeTag : tag.getChildren(CompanyTypeI.ELEMENT_ID)) { // Extract the attributes of the Component String name = compTypeTag.getAttributeAsString(CompanyTypeI.NAME_TAG); if (name == null) { throw new ConfigurationException( LocalText.getText("UnnamedCompanyType")); } String className = compTypeTag.getAttributeAsString(CompanyTypeI.CLASS_TAG); if (className == null) { throw new ConfigurationException(LocalText.getText( "CompanyTypeHasNoClass", name)); } if (mCompanyTypes.get(name) != null) { throw new ConfigurationException(LocalText.getText( "CompanyTypeConfiguredTwice", name)); } CompanyTypeI companyType = new CompanyType(name, className); mCompanyTypes.put(name, companyType); // Further parsing is done within CompanyType companyType.configureFromXML(compTypeTag); } /* Read and configure the companies */ for (Tag companyTag : tag.getChildren(CompanyI.COMPANY_ELEMENT_ID)) { // Extract the attributes of the Component String name = companyTag.getAttributeAsString(CompanyI.COMPANY_NAME_TAG); if (name == null) { throw new ConfigurationException( LocalText.getText("UnnamedCompany")); } String type = companyTag.getAttributeAsString(CompanyI.COMPANY_TYPE_TAG); if (type == null) { throw new ConfigurationException(LocalText.getText( "CompanyHasNoType", name)); } CompanyTypeI cType = mCompanyTypes.get(type); if (cType == null) { throw new ConfigurationException(LocalText.getText( "CompanyHasUnknownType", name, type )); } try { CompanyI company = cType.createCompany(name, companyTag); /* Private or public */ if (company instanceof PrivateCompanyI) { mPrivateCompanies.put(name, (PrivateCompanyI) company); lPrivateCompanies.add((PrivateCompanyI) company); } else if (company instanceof PublicCompanyI) { ((PublicCompanyI)company).setIndex (numberOfPublicCompanies++); mPublicCompanies.put(name, (PublicCompanyI) company); lPublicCompanies.add((PublicCompanyI) company); } /* By type and name */ if (!mCompaniesByTypeAndName.containsKey(type)) mCompaniesByTypeAndName.put(type, new HashMap<String, CompanyI>()); ((Map<String, CompanyI>) mCompaniesByTypeAndName.get(type)).put( name, company); } catch (Exception e) { throw new ConfigurationException(LocalText.getText( "ClassCannotBeInstantiated", cType.getClassName()), e); } } /* Read and configure the start packets */ List<Tag> packetTags = tag.getChildren("StartPacket"); if (packetTags != null) { for (Tag packetTag : tag.getChildren("StartPacket")) { // Extract the attributes of the Component String name = packetTag.getAttributeAsString("name", StartPacket.DEFAULT_NAME); String roundClass = packetTag.getAttributeAsString("roundClass"); if (roundClass == null) { throw new ConfigurationException(LocalText.getText( "StartPacketHasNoClass", name)); } StartPacket sp = new StartPacket(name, roundClass); startPackets.add(sp); startPacketMap.put(name, sp); sp.configureFromXML(packetTag); } } /* Read and configure additional rules */ /* This part may move later to a GameRules or GameManager XML */ Tag rulesTag = tag.getChild("StockRoundRules"); if (rulesTag != null) { for (String ruleTagName : rulesTag.getChildren().keySet()) { if (ruleTagName.equals("NoSaleInFirstSR")) { //StockRound.setNoSaleInFirstSR(); gameManager.setGameParameter(GameDef.Parm.NO_SALE_IN_FIRST_SR, true); } else if (ruleTagName.equals("NoSaleIfNotOperated")) { //StockRound.setNoSaleIfNotOperated(); gameManager.setGameParameter(GameDef.Parm.NO_SALE_IF_NOT_OPERATED, true); } } } } // Post XML parsing initialisations public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (PublicCompanyI comp : lPublicCompanies) { comp.finishConfiguration(gameManager); } for (PrivateCompanyI comp : lPrivateCompanies) { comp.finishConfiguration(gameManager); } } /** * @see rails.game.CompanyManagerI#getCompany(java.lang.String) * */ public PrivateCompanyI getPrivateCompany(String name) { return mPrivateCompanies.get(name); } public PublicCompanyI getPublicCompany(String name) { return mPublicCompanies.get(name); } public List<PrivateCompanyI> getAllPrivateCompanies() { return lPrivateCompanies; } public List<PublicCompanyI> getAllPublicCompanies() { return lPublicCompanies; } public PublicCompanyI getCompanyByName(String name) { for (int i = 0; i < lPublicCompanies.size(); i++) { PublicCompany co = (PublicCompany) lPublicCompanies.get(i); if (name.equalsIgnoreCase(co.getName())) { return lPublicCompanies.get(i); } } return null; } public CompanyI getCompany(String type, String name) { if (mCompaniesByTypeAndName.containsKey(type)) { return (mCompaniesByTypeAndName.get(type)).get(name); } else { return null; } } public void closeAllPrivates() { if (lPrivateCompanies == null) return; for (PrivateCompanyI priv : lPrivateCompanies) { priv.setClosed(); } } public List<PrivateCompanyI> getPrivatesOwnedByPlayers() { List<PrivateCompanyI> privatesOwnedByPlayers = new ArrayList<PrivateCompanyI>(); for (PrivateCompanyI priv : getAllPrivateCompanies()) { if (priv.getPortfolio().getOwner() instanceof Player) { privatesOwnedByPlayers.add(priv); } } return privatesOwnedByPlayers; } public StartPacket getStartPacket (int index) { return startPackets.get(index); } public StartPacket getStartPacket (String name) { return startPacketMap.get(name); } } \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-01-14 21:03:55
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7618/rails/game Modified Files: Game.java Log Message: Added '+' to version number to indicate experimental version Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Game.java 10 Jan 2010 18:21:54 -0000 1.43 --- Game.java 14 Jan 2010 21:03:47 -0000 1.44 *************** *** 12,16 **** public class Game { ! public static final String version = "1.1.2"; /** The component Manager */ --- 12,16 ---- public class Game { ! public static final String version = "1.1.2+"; /** The component Manager */ |
From: Erik V. <ev...@us...> - 2010-01-14 21:03:30
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7505/rails/game Added Files: GameDef.java Log Message: New class, for game-engine parameter definitions --- NEW FILE: GameDef.java --- package rails.game; /** * This class will hold parameter identifiers for use in the game engine only. * See rails.common.Defs for parameters used in the GUI/engine communication. * @author VosE * */ public class GameDef { public enum Parm { NO_SALE_IN_FIRST_SR (false), NO_SALE_IF_NOT_OPERATED (false), STOCK_ROUND_SEQUENCE(StockRound.SELL_BUY_SELL); private Object defaultValue; Parm (boolean defaultValue) { this.defaultValue = defaultValue; } Parm (int defaultValue) { this.defaultValue = defaultValue; } public boolean defaultValueAsBoolean() { return (Boolean) defaultValue; } public int defaultValueAsInt() { return (Integer) defaultValue; } } } |
From: Erik V. <ev...@us...> - 2010-01-14 21:02:50
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7321/rails/game Modified Files: GameManager.java Log Message: Use of GuiDef and GameDef Various minor changes Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** GameManager.java 1 Jan 2010 18:58:43 -0000 1.74 --- GameManager.java 14 Jan 2010 21:02:39 -0000 1.75 *************** *** 10,14 **** import org.apache.log4j.NDC; ! import rails.common.Defs; import rails.game.action.*; import rails.game.move.*; --- 10,15 ---- import org.apache.log4j.NDC; ! import rails.common.GuiDef; ! import rails.common.GuiHints; import rails.game.action.*; import rails.game.move.*; *************** *** 38,46 **** // Variable UI Class names ! protected String gameUIManagerClassName = Defs.getDefaultClassName(Defs.ClassName.GAME_UI_MANAGER); ! protected String orUIManagerClassName = Defs.getDefaultClassName(Defs.ClassName.OR_UI_MANAGER); ! protected String gameStatusClassName = Defs.getDefaultClassName(Defs.ClassName.GAME_STATUS); ! protected String statusWindowClassName = Defs.getDefaultClassName(Defs.ClassName.STATUS_WINDOW); ! protected String orWindowClassName = Defs.getDefaultClassName(Defs.ClassName.OR_WINDOW); protected PlayerManager playerManager; --- 39,47 ---- // Variable UI Class names ! protected String gameUIManagerClassName = GuiDef.getDefaultClassName(GuiDef.ClassName.GAME_UI_MANAGER); ! protected String orUIManagerClassName = GuiDef.getDefaultClassName(GuiDef.ClassName.OR_UI_MANAGER); ! protected String gameStatusClassName = GuiDef.getDefaultClassName(GuiDef.ClassName.GAME_STATUS); ! protected String statusWindowClassName = GuiDef.getDefaultClassName(GuiDef.ClassName.STATUS_WINDOW); ! protected String orWindowClassName = GuiDef.getDefaultClassName(GuiDef.ClassName.OR_WINDOW); protected PlayerManager playerManager; *************** *** 78,81 **** --- 79,85 ---- protected boolean gameEndsAfterSetOfORs = true; + protected EnumMap<GameDef.Parm, Object> gameParameters + = new EnumMap<GameDef.Parm, Object>(GameDef.Parm.class); + /** * Current round should not be set here but from within the Round classes. *************** *** 99,107 **** protected boolean endedByBankruptcy = false; /** Flags to be passed to the UI, aiding the layout definition */ ! protected EnumMap<Defs.Parm, Boolean> gameParameters = ! new EnumMap<Defs.Parm, Boolean>(Defs.Parm.class); ! protected int stockRoundSequenceRule = StockRound.SELL_BUY_SELL; /** --- 103,114 ---- protected boolean endedByBankruptcy = false; + /** UI display hints */ + protected GuiHints guiHints; + /** Flags to be passed to the UI, aiding the layout definition */ ! protected EnumMap<GuiDef.Parm, Boolean> guiParameters = ! new EnumMap<GuiDef.Parm, Boolean>(GuiDef.Parm.class); ! //protected int stockRoundSequenceRule = StockRound.SELL_BUY_SELL; /** *************** *** 192,195 **** --- 199,203 ---- displayBuffer = new DisplayBuffer(); reportBuffer = new ReportBuffer(); + guiHints = new GuiHints(); } *************** *** 232,236 **** // StockRound class and other properties ! Tag srTag = tag.getChild("StockRound"); if (srTag != null) { String srClassName = --- 240,248 ---- // StockRound class and other properties ! // Set default rule(s) ! gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! GameDef.Parm.STOCK_ROUND_SEQUENCE.defaultValueAsInt()); ! ! Tag srTag = tag.getChild("StockRound"); if (srTag != null) { String srClassName = *************** *** 247,255 **** if (Util.hasValue(stockRoundSequenceRuleString)) { if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuySell")) { ! stockRoundSequenceRule = StockRound.SELL_BUY_SELL; } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuy")) { ! stockRoundSequenceRule = StockRound.SELL_BUY; } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuyOrBuySell")) { ! stockRoundSequenceRule = StockRound.SELL_BUY_OR_BUY_SELL; } } --- 259,273 ---- if (Util.hasValue(stockRoundSequenceRuleString)) { if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuySell")) { ! //stockRoundSequenceRule = StockRound.SELL_BUY_SELL; ! gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY_SELL); } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuy")) { ! //stockRoundSequenceRule = StockRound.SELL_BUY; ! gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY); } else if (stockRoundSequenceRuleString.equalsIgnoreCase("SellBuyOrBuySell")) { ! //stockRoundSequenceRule = StockRound.SELL_BUY_OR_BUY_SELL; ! gameParameters.put(GameDef.Parm.STOCK_ROUND_SEQUENCE, ! StockRound.SELL_BUY_OR_BUY_SELL); } } *************** *** 436,443 **** for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { ! if (company.hasParPrice()) gameParameters.put(Defs.Parm.HAS_ANY_PAR_PRICE, true); ! if (company.canBuyPrivates()) gameParameters.put(Defs.Parm.CAN_ANY_COMPANY_BUY_PRIVATES, true); ! if (company.canHoldOwnShares()) gameParameters.put(Defs.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES, true); ! if (company.getMaxNumberOfLoans() != 0) gameParameters.put(Defs.Parm.HAS_ANY_COMPANY_LOANS, true); } --- 454,461 ---- for (PublicCompanyI company : companyManager.getAllPublicCompanies()) { ! if (company.hasParPrice()) guiParameters.put(GuiDef.Parm.HAS_ANY_PAR_PRICE, true); ! if (company.canBuyPrivates()) guiParameters.put(GuiDef.Parm.CAN_ANY_COMPANY_BUY_PRIVATES, true); ! if (company.canHoldOwnShares()) guiParameters.put(GuiDef.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES, true); ! if (company.getMaxNumberOfLoans() != 0) guiParameters.put(GuiDef.Parm.HAS_ANY_COMPANY_LOANS, true); } *************** *** 446,450 **** if (sp instanceof SpecialTokenLay && ((SpecialTokenLay)sp).getToken() instanceof BonusToken) { ! gameParameters.put(Defs.Parm.DO_BONUS_TOKENS_EXIST, true); break loop; } --- 464,468 ---- if (sp instanceof SpecialTokenLay && ((SpecialTokenLay)sp).getToken() instanceof BonusToken) { ! guiParameters.put(GuiDef.Parm.DO_BONUS_TOKENS_EXIST, true); break loop; } *************** *** 651,654 **** --- 669,673 ---- DisplayBuffer.clear(); + guiHints.clearVisibilityHints(); // The action is null only immediately after Load. *************** *** 783,787 **** if (moveStack.isOpen()) moveStack.finish(); } ! DisplayBuffer.clear(); return true; --- 802,806 ---- if (moveStack.isOpen()) moveStack.finish(); } ! DisplayBuffer.clear(); return true; *************** *** 820,823 **** --- 839,845 ---- public void finishShareSellingRound() { setRound(interruptedRound); + guiHints.setCurrentRoundType(interruptedRound.getClass()); + guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET, false); + guiHints.setActivePanel(GuiDef.Panel.MAP); getCurrentRound().resume(); } *************** *** 828,831 **** --- 850,856 ---- public void finishTreasuryShareRound() { setRound(interruptedRound); + guiHints.setCurrentRoundType(interruptedRound.getClass()); + guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET, false); + guiHints.setActivePanel(GuiDef.Panel.MAP); ((OperatingRound) getCurrentRound()).nextStep(); } *************** *** 1105,1109 **** */ public boolean canAnyCompanyHoldShares() { ! return (Boolean) getGameParameter(Defs.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES); } --- 1130,1134 ---- */ public boolean canAnyCompanyHoldShares() { ! return (Boolean) getGuiParameter(GuiDef.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES); } *************** *** 1111,1115 **** * @see rails.game.GameManagerI#getClassName(rails.common.Defs.ClassName) */ ! public String getClassName (Defs.ClassName key) { switch (key) { --- 1136,1140 ---- * @see rails.game.GameManagerI#getClassName(rails.common.Defs.ClassName) */ ! public String getClassName (GuiDef.ClassName key) { switch (key) { *************** *** 1136,1140 **** */ public int getStockRoundSequenceRule() { ! return stockRoundSequenceRule; } --- 1161,1165 ---- */ public int getStockRoundSequenceRule() { ! return (Integer) gameParameters.get(GameDef.Parm.STOCK_ROUND_SEQUENCE); } *************** *** 1149,1153 **** * @see rails.game.GameManagerI#getCommonParameter(rails.common.Defs.Parm) */ ! public Object getGameParameter (Defs.Parm key) { if (gameParameters.containsKey(key)) { return gameParameters.get(key); --- 1174,1190 ---- * @see rails.game.GameManagerI#getCommonParameter(rails.common.Defs.Parm) */ ! public Object getGuiParameter (GuiDef.Parm key) { ! if (guiParameters.containsKey(key)) { ! return guiParameters.get(key); ! } else { ! return false; ! } ! } ! ! public void setGameParameter (GameDef.Parm key, Object value) { ! gameParameters.put(key, value); ! } ! ! public Object getGameParameter (GameDef.Parm key) { if (gameParameters.containsKey(key)) { return gameParameters.get(key); *************** *** 1258,1260 **** --- 1295,1301 ---- return reportBuffer; } + + public GuiHints getUIHints() { + return guiHints; + } } |
From: Erik V. <ev...@us...> - 2010-01-14 21:01:59
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7131/rails/game Modified Files: GameManagerI.java Log Message: Added some generic getters. Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GameManagerI.java 8 Jan 2010 21:30:46 -0000 1.24 --- GameManagerI.java 14 Jan 2010 21:01:51 -0000 1.25 *************** *** 4,8 **** import java.util.Map; ! import rails.common.Defs; import rails.game.action.PossibleAction; import rails.game.model.ModelObject; --- 4,9 ---- import java.util.Map; ! import rails.common.GuiDef; ! import rails.common.GuiHints; import rails.game.action.PossibleAction; import rails.game.model.ModelObject; *************** *** 172,176 **** public abstract boolean canAnyCompanyHoldShares(); ! public abstract String getClassName(Defs.ClassName key); public abstract int getStockRoundSequenceRule(); --- 173,177 ---- public abstract boolean canAnyCompanyHoldShares(); ! public abstract String getClassName(GuiDef.ClassName key); public abstract int getStockRoundSequenceRule(); *************** *** 178,182 **** public abstract int getTreasuryShareLimit(); ! public abstract Object getGameParameter(Defs.Parm key); public RoundI getInterruptedRound(); --- 179,185 ---- public abstract int getTreasuryShareLimit(); ! public abstract Object getGuiParameter(GuiDef.Parm key); ! public Object getGameParameter (GameDef.Parm key); ! public void setGameParameter (GameDef.Parm key, Object value); public RoundI getInterruptedRound(); *************** *** 190,193 **** --- 193,197 ---- public DisplayBuffer getDisplayBuffer(); public ReportBuffer getReportBuffer(); + public GuiHints getUIHints(); } \ No newline at end of file |