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...> - 2009-09-03 21:37:08
|
Update of /cvsroot/rails/18xx/data/1835 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/1835 Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/Game.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Game.xml 31 Oct 2008 20:38:34 -0000 1.18 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.19 *************** *** 13,18 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="3" cash="600" certLimit="19"/> <Players number="4" cash="475" certLimit="15"/> --- 13,17 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="3" cash="600" certLimit="19"/> <Players number="4" cash="475" certLimit="15"/> *************** *** 20,23 **** --- 19,25 ---- <Players number="6" cash="340" certLimit="11"/> <Players number="7" cash="310" certLimit="9"/> + </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> <Money format="@M"/> </Component> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:07
|
Update of /cvsroot/rails/18xx/data/1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/1856 Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/Game.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Game.xml 3 Sep 2009 18:33:28 -0000 1.24 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.25 *************** *** 16,21 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="3" cash="500" certLimit="20"/> <Players number="4" cash="375" certLimit="16"/> --- 16,20 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="3" cash="500" certLimit="20"/> <Players number="4" cash="375" certLimit="16"/> *************** *** 23,26 **** --- 22,28 ---- <Players number="6" cash="250" certLimit="11"/> </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> + </Component> <Component name="TileManager" class="rails.game.TileManager" file="TileSet.xml"/> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:07
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/rails/game/specific/_18EU Modified Files: StockRound_18EU.java Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: StockRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StockRound_18EU.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** StockRound_18EU.java 15 Jan 2009 20:53:28 -0000 1.20 --- StockRound_18EU.java 3 Sep 2009 21:36:54 -0000 1.21 *************** *** 196,205 **** cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!currentPlayer.mayBuyCompanyShare(company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !currentPlayer.mayBuyCertificate(company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, --- 196,205 ---- cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!playerMayBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, *************** *** 318,322 **** numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!currentPlayer.mayBuyCertificate(company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; --- 318,322 ---- numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!playerMayBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:07
|
Update of /cvsroot/rails/18xx/data/18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/18EU Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Game.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Game.xml 11 Mar 2008 19:57:20 -0000 1.8 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.9 *************** *** 21,26 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="2" cash="750" certLimit="28"/> <Players number="3" cash="450" certLimit="20"/> --- 21,25 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="2" cash="750" certLimit="28"/> <Players number="3" cash="450" certLimit="20"/> *************** *** 28,31 **** --- 27,33 ---- <Players number="5" cash="300" certLimit="13"/> <Players number="6" cash="250" certLimit="11"/> + </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> </Component> <Component name="TileManager" class="rails.game.TileManager" |
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/rails/game Modified Files: StockRound.java Bank.java GameManagerI.java Game.java PlayerManager.java Round.java Player.java GameManager.java Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** GameManager.java 4 May 2009 20:29:14 -0000 1.45 --- GameManager.java 3 Sep 2009 21:36:53 -0000 1.46 *************** *** 904,907 **** --- 904,911 ---- } + public PlayerManager getPlayerManager() { + return playerManager; + } + public TrainManagerI getTrainManager () { return trainManager; Index: PlayerManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PlayerManager.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PlayerManager.java 4 Jun 2008 19:00:32 -0000 1.7 --- PlayerManager.java 3 Sep 2009 21:36:53 -0000 1.8 *************** *** 4,15 **** import java.util.*; ! public class PlayerManager { ! int numberOfPlayers; private List<Player> players; private List<String> playerNames; private Map<String, Player> playerMap; ! public PlayerManager(List<String> playerNames) { Player player; --- 4,52 ---- import java.util.*; ! import rails.util.LocalText; ! import rails.util.Tag; ! public class PlayerManager implements ConfigurableComponentI { ! ! private int numberOfPlayers; private List<Player> players; private List<String> playerNames; private Map<String, Player> playerMap; ! public int maxPlayers; ! ! public int minPlayers; ! ! private int[] playerStartCash = new int[Player.MAX_PLAYERS]; ! ! private int[] playerCertificateLimits = new int[Player.MAX_PLAYERS]; ! ! private int playerCertificateLimit = 0; ! ! public PlayerManager() { ! ! } ! ! public void configureFromXML(Tag tag) throws ConfigurationException { ! ! int number, startCash, certLimit; ! ! List<Tag> playerTags = tag.getChildren("Players"); ! minPlayers = 99; ! maxPlayers = 0; ! for (Tag playerTag : playerTags) { ! number = playerTag.getAttributeAsInteger("number"); ! startCash = playerTag.getAttributeAsInteger("cash"); ! playerStartCash[number] = startCash; ! certLimit = playerTag.getAttributeAsInteger("certLimit"); ! playerCertificateLimits[number] = certLimit; ! ! minPlayers = Math.min(minPlayers, number); ! maxPlayers = Math.max(maxPlayers, number); ! } ! } ! ! public void setPlayers (List<String> playerNames, int startCash) { ! Player player; *************** *** 20,29 **** playerMap = new HashMap<String, Player>(numberOfPlayers); for (String playerName : playerNames) { ! player = new Player(playerName); players.add(player); playerMap.put(playerName, player); } } --- 57,75 ---- playerMap = new HashMap<String, Player>(numberOfPlayers); + int playerIndex = 0; for (String playerName : playerNames) { ! player = new Player(playerName, playerIndex++); players.add(player); playerMap.put(playerName, player); + Bank.transferCash(null, player, getStartCash()); + ReportBuffer.add(LocalText.getText("PlayerIs", + playerIndex, + player.getName() )); } + ReportBuffer.add(LocalText.getText("PlayerCash", Bank.format(startCash))); + ReportBuffer.add(LocalText.getText("BankHas", + Bank.format(Bank.getInstance().getCash()))); + playerCertificateLimit = playerCertificateLimits[numberOfPlayers]; } *************** *** 46,49 **** --- 92,107 ---- return players.get(index); } + + public int getStartCash () { + return playerStartCash[numberOfPlayers]; + } + + public int getPlayerCertificateLimit() { + return playerCertificateLimit; + } + + public void setPlayerCertificateLimit(int playerCertificateLimit) { + this.playerCertificateLimit = playerCertificateLimit; + } } Index: Bank.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Bank.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Bank.java 28 Aug 2009 20:24:39 -0000 1.10 --- Bank.java 3 Sep 2009 21:36:53 -0000 1.11 *************** *** 94,98 **** */ public void configureFromXML(Tag tag) throws ConfigurationException { - int number, startCash, certLimit; // Parse the Bank element --- 94,97 ---- *************** *** 120,138 **** format(money.getCash()))); - List<Tag> playerTags = tag.getChildren("Players"); - int minPlayers = 99; - int maxPlayers = 0; - for (Tag playerTag : playerTags) { - number = playerTag.getAttributeAsInteger("number"); - startCash = playerTag.getAttributeAsInteger("cash"); - certLimit = playerTag.getAttributeAsInteger("certLimit"); - - Player.setLimits(number, startCash, certLimit); - - minPlayers = Math.min(minPlayers, number); - maxPlayers = Math.max(maxPlayers, number); - } - Player.MIN_PLAYERS = minPlayers; - Player.MAX_PLAYERS = maxPlayers; } --- 119,122 ---- Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Round.java 19 Jul 2009 19:24:21 -0000 1.19 --- Round.java 3 Sep 2009 21:36:53 -0000 1.20 *************** *** 32,35 **** --- 32,36 ---- protected GameManagerI gameManager = null; protected CompanyManagerI companyManager = null; + protected PlayerManager playerManager = null; protected Class<? extends RoundI> roundTypeForUI = null; *************** *** 53,56 **** --- 54,58 ---- } else { companyManager = aGameManager.getCompanyManager(); + playerManager = aGameManager.getPlayerManager(); } Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Game.java 28 Aug 2009 20:25:28 -0000 1.23 --- Game.java 3 Sep 2009 21:36:53 -0000 1.24 *************** *** 35,38 **** --- 35,40 ---- protected List<String> directories = new ArrayList<String>(); protected Map<String, String> gameOptions; + + protected List<String> players; protected static Logger log = *************** *** 60,64 **** directories.add("data/" + name); ! playerManager = new PlayerManager(players); } --- 62,67 ---- directories.add("data/" + name); ! //playerManager = new PlayerManager(players); ! this.players = players; } *************** *** 94,97 **** --- 97,106 ---- componentManager.finishPreparation(); + playerManager = (PlayerManager) componentManager.findComponent("PlayerManager"); + if (playerManager == null) { + throw new ConfigurationException( + "No PlayerManager XML element found in file " + GAME_XML_FILE); + } + bank = (Bank) componentManager.findComponent("Bank"); if (bank == null) { *************** *** 99,102 **** --- 108,112 ---- "No Bank XML element found in file " + GAME_XML_FILE); } + companyManager = (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); *************** *** 141,144 **** --- 151,156 ---- * only be done after all XML has been processed. */ + playerManager.setPlayers(players, playerManager.getStartCash()); + companyManager.initCompanies(gameManager); bank.initCertificates(); *************** *** 157,162 **** MapManager.assignHomesAndDestinations(); - Player.initPlayers(playerManager.getPlayers()); - return true; } --- 169,172 ---- Index: Player.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Player.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Player.java 3 Sep 2009 18:33:28 -0000 1.18 --- Player.java 3 Sep 2009 21:36:53 -0000 1.19 *************** *** 2,9 **** package rails.game; - import java.util.List; - import rails.game.model.*; - import rails.util.LocalText; /** --- 2,6 ---- *************** *** 19,29 **** public static int MIN_PLAYERS = 2; ! ! private static int[] playerStartCash = new int[MAX_PLAYERS]; ! ! private static int[] playerCertificateLimits = new int[MAX_PLAYERS]; ! ! private static int playerCertificateLimit = 0; ! private static int playerShareLimit = DEFAULT_PLAYER_SHARE_LIMIT; // May need to become an array --- 16,20 ---- public static int MIN_PLAYERS = 2; ! private static int playerShareLimit = DEFAULT_PLAYER_SHARE_LIMIT; // May need to become an array *************** *** 45,103 **** private Portfolio portfolio = null; ! public static void setLimits(int number, int cash, int certLimit) { ! if (number > 1 && number <= MAX_PLAYERS) { ! playerStartCash[number] = cash; ! playerCertificateLimits[number] = certLimit; ! } ! } ! ! /** ! * Initialises each Player's parameters which depend on the number of ! * players. To be called when all Players have been added. ! * ! */ ! public static void initPlayers(List<Player> players) { ! int numberOfPlayers = players.size(); ! int startCash = playerStartCash[numberOfPlayers]; ! ! // Give each player the initial cash amount ! int index = 0; ! for (Player player : players) { ! player.index = index++; ! Bank.transferCash(null, player, startCash); ! ReportBuffer.add(LocalText.getText("PlayerIs", ! index, ! player.getName() )); ! } ! ReportBuffer.add(LocalText.getText("PlayerCash", Bank.format(startCash))); ! ReportBuffer.add(LocalText.getText("BankHas", ! Bank.format(Bank.getInstance().getCash()))); ! ! // Set the sertificate limit ! playerCertificateLimit = playerCertificateLimits[numberOfPlayers]; ! } ! ! /** ! * @return Certificate Limit for Players ! */ ! public static int getCertLimit() { ! return playerCertificateLimit; ! } ! ! /** In some games, the cert limit can change during the game (e.g. 1856) */ ! public static void setPlayerCertificateLimit(int playerCertificateLimit) { ! Player.playerCertificateLimit = playerCertificateLimit; ! } ! ! public static void setShareLimit(int percentage) { ! playerShareLimit = percentage; ! } ! ! public static int getShareLimit() { ! return playerShareLimit; ! } ! ! public Player(String name) { this.name = name; portfolio = new Portfolio(name, this); freeCash = new CalculatedMoneyModel(this, "getFreeCash"); --- 36,42 ---- private Portfolio portfolio = null; ! public Player(String name, int index) { this.name = name; + this.index = index; portfolio = new Portfolio(name, this); freeCash = new CalculatedMoneyModel(this, "getFreeCash"); *************** *** 109,159 **** } ! public boolean isOverLimits() { ! ! // Over the total certificate hold Limit? ! if (portfolio.getCertificateCount() > playerCertificateLimit) ! return true; ! ! // Over the hold limit of any company? ! for (PublicCompanyI company : Game.getCompanyManager().getAllPublicCompanies()) { ! if (company.hasStarted() && company.hasStockPrice() ! && !mayBuyCompanyShare(company, 0)) return true; ! } ! ! return false; ! } ! ! /** ! * Check if a player may buy the given number of certificates. ! * ! * @param number Number of certificates to buy (usually 1 but not always ! * so). ! * @return True if it is allowed. ! */ ! public boolean mayBuyCertificate(PublicCompanyI comp, int number) { ! if (comp.hasFloated() && comp.getCurrentSpace().isNoCertLimit()) ! return true; ! if (portfolio.getCertificateCount() + number > playerCertificateLimit) ! return false; ! return true; ! } ! ! /** ! * Check if a player may buy the given number of shares from a given ! * company, given the "hold limit" per company, that is the percentage of ! * shares of one company that a player may hold (typically 60%). ! * ! * @param company The company from which to buy ! * @param number The number of shares (usually 1 but not always so). ! * @return True if it is allowed. ! */ ! public boolean mayBuyCompanyShare(PublicCompanyI company, int number) { ! // Check for per-company share limit ! if (portfolio.getShare(company) + number * company.getShareUnit() > playerShareLimit ! && !company.getCurrentSpace().isNoHoldLimit()) return false; ! return true; ! } ! ! /** * Return the number of <i>additional</i> shares of a certain company and * of a certain size that a player may buy, given the share "hold limit" per --- 48,52 ---- } ! /** * Return the number of <i>additional</i> shares of a certain company and * of a certain size that a player may buy, given the share "hold limit" per *************** *** 309,312 **** --- 202,212 ---- } + public static void setShareLimit(int percentage) { + playerShareLimit = percentage; + } + + public static int getShareLimit() { + return playerShareLimit; + } /** * Compare Players by their total worth, in descending order. This method Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** StockRound.java 2 Sep 2009 21:47:47 -0000 1.38 --- StockRound.java 3 Sep 2009 21:36:53 -0000 1.39 *************** *** 224,232 **** number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!currentPlayer.mayBuyCompanyShare(comp, number)) continue; /* Would the player exceed the total certificate limit? */ if (!stockSpace.isNoCertLimit() ! && !currentPlayer.mayBuyCertificate(comp, number)) continue; } --- 224,232 ---- number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!playerMayBuyCompanyShare(currentPlayer, comp, number)) continue; /* Would the player exceed the total certificate limit? */ if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, comp, number)) continue; } *************** *** 252,261 **** cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!currentPlayer.mayBuyCompanyShare(company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !currentPlayer.mayBuyCertificate(company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, --- 252,261 ---- cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!playerMayBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, *************** *** 492,496 **** numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!currentPlayer.mayBuyCertificate(company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; --- 492,496 ---- numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!playerMayBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; *************** *** 665,673 **** // (shortcut: assume 1 cert == 1 certificate) if (!currentSpace.isNoCertLimit() ! && !currentPlayer.mayBuyCertificate(company, shares)) { errMsg = currentPlayer.getName() + LocalText.getText("WouldExceedCertLimit", ! String.valueOf(Player.getCertLimit())); break; } --- 665,673 ---- // (shortcut: assume 1 cert == 1 certificate) if (!currentSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() + LocalText.getText("WouldExceedCertLimit", ! String.valueOf(playerManager.getPlayerCertificateLimit())); break; } *************** *** 675,679 **** // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !currentPlayer.mayBuyCompanyShare(company, shares)) { errMsg = currentPlayer.getName() --- 675,679 ---- // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !playerMayBuyCompanyShare(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() *************** *** 1034,1038 **** if (sp instanceof ExchangeForShare) { ! boolean result = ((ExchangeForShare) sp).execute(); if (result) hasActed.set(true); return result; --- 1034,1038 ---- if (sp instanceof ExchangeForShare) { ! boolean result = ((ExchangeForShare) sp).execute(this); if (result) hasActed.set(true); return result; *************** *** 1169,1176 **** */ public boolean mayCurrentPlayerBuyAnything() { ! return !currentPlayer.isOverLimits() && companyBoughtThisTurnWrapper.getObject() == null; } public static void setNoSaleInFirstSR() { noSaleInFirstSR = true; --- 1169,1223 ---- */ public boolean mayCurrentPlayerBuyAnything() { ! return !playerIsOverLimits(currentPlayer) && companyBoughtThisTurnWrapper.getObject() == null; } + protected boolean playerIsOverLimits(Player player) { + + // Over the total certificate hold Limit? + if (player.getPortfolio().getCertificateCount() > playerManager.getPlayerCertificateLimit()) + return true; + + // Over the hold limit of any company? + for (PublicCompanyI company : Game.getCompanyManager().getAllPublicCompanies()) { + if (company.hasStarted() && company.hasStockPrice() + && !playerMayBuyCompanyShare(player, company, 0)) return true; + } + + return false; + } + + /** + * Check if a player may buy the given number of certificates. + * + * @param number Number of certificates to buy (usually 1 but not always + * so). + * @return True if it is allowed. + */ + public boolean playerMayBuyCertificate(Player player, PublicCompanyI comp, int number) { + if (comp.hasFloated() && comp.getCurrentSpace().isNoCertLimit()) + return true; + if (player.getPortfolio().getCertificateCount() + number > playerManager.getPlayerCertificateLimit()) + return false; + return true; + } + + /** + * Check if a player may buy the given number of shares from a given + * company, given the "hold limit" per company, that is the percentage of + * shares of one company that a player may hold (typically 60%). + * + * @param company The company from which to buy + * @param number The number of shares (usually 1 but not always so). + * @return True if it is allowed. + */ + public boolean playerMayBuyCompanyShare(Player player, PublicCompanyI company, int number) { + // Check for per-company share limit + if (player.getPortfolio().getShare(company) + number * company.getShareUnit() > Player.getShareLimit() + && !company.getCurrentSpace().isNoHoldLimit()) return false; + return true; + } + + public static void setNoSaleInFirstSR() { noSaleInFirstSR = true; Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GameManagerI.java 4 May 2009 20:29:14 -0000 1.3 --- GameManagerI.java 3 Sep 2009 21:36:53 -0000 1.4 *************** *** 144,147 **** --- 144,148 ---- public abstract TrainManagerI getTrainManager (); + public PlayerManager getPlayerManager(); |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:06
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/rails/ui/swing Modified Files: GameStatus.java Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GameStatus.java 28 Aug 2009 20:27:38 -0000 1.24 --- GameStatus.java 3 Sep 2009 21:36:54 -0000 1.25 *************** *** 466,470 **** addField(new Caption(LocalText.getText("LIMIT")), certLimitXOffset - 1, certLimitYOffset, 1, 1, WIDE_TOP + WIDE_LEFT); ! addField(new Field("" + Player.getCertLimit()), certLimitXOffset, certLimitYOffset, 1, 1, WIDE_TOP); --- 466,471 ---- addField(new Caption(LocalText.getText("LIMIT")), certLimitXOffset - 1, certLimitYOffset, 1, 1, WIDE_TOP + WIDE_LEFT); ! addField(new Field("" + gameUIManager.getGameManager().getPlayerManager().getPlayerCertificateLimit()), ! certLimitXOffset, certLimitYOffset, 1, 1, WIDE_TOP); |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:06
|
Update of /cvsroot/rails/18xx/data/1851 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/1851 Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1851/Game.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Game.xml 10 Oct 2008 19:35:49 -0000 1.3 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.4 *************** *** 13,21 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="8040"/> <Players number="3" cash="500" certLimit="10"/> <Players number="4" cash="430" certLimit="12"/> <Players number="5" cash="400" certLimit="15"/> <Money format="$@"/> </Component> --- 13,23 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="3" cash="500" certLimit="10"/> <Players number="4" cash="430" certLimit="12"/> <Players number="5" cash="400" certLimit="15"/> + </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="8040"/> <Money format="$@"/> </Component> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:06
|
Update of /cvsroot/rails/18xx/data/1830 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/1830 Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1830/Game.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Game.xml 11 Dec 2007 20:58:34 -0000 1.23 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.24 *************** *** 23,28 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="2" cash="1200" certLimit="28"/> <Players number="3" cash="800" certLimit="20"/> --- 23,27 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="2" cash="1200" certLimit="28"/> <Players number="3" cash="800" certLimit="20"/> *************** *** 30,33 **** --- 29,35 ---- <Players number="5" cash="480" certLimit="13"/> <Players number="6" cash="400" certLimit="11"/> + </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> <Money format="$@"/> </Component> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:03
|
Update of /cvsroot/rails/18xx/rails/game/special In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/rails/game/special Modified Files: ExchangeForShare.java Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: ExchangeForShare.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/special/ExchangeForShare.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ExchangeForShare.java 15 Jan 2009 20:53:28 -0000 1.9 --- ExchangeForShare.java 3 Sep 2009 21:36:53 -0000 1.10 *************** *** 34,38 **** } ! public boolean execute() { publicCompany = --- 34,38 ---- } ! public boolean execute(StockRound round) { publicCompany = *************** *** 65,69 **** } /* Check if the player has room for a share of this company */ ! if (!player.mayBuyCompanyShare(publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = --- 65,69 ---- } /* Check if the player has room for a share of this company */ ! if (!round.playerMayBuyCompanyShare(player, publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:03
|
Update of /cvsroot/rails/18xx/data/18Kaas In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/18Kaas Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18Kaas/Game.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Game.xml 11 Dec 2007 20:58:34 -0000 1.4 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.5 *************** *** 11,16 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="2" cash="1200" certLimit="28"/> <Players number="3" cash="800" certLimit="20"/> --- 11,15 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="2" cash="1200" certLimit="28"/> <Players number="3" cash="800" certLimit="20"/> *************** *** 19,22 **** --- 18,24 ---- <Players number="6" cash="400" certLimit="11"/> </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> + </Component> <Component name="TileManager" class="rails.game.TileManager" file="TileSet.xml"/> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:03
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/rails/game/specific/_1856 Modified Files: CGRFormationRound.java Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CGRFormationRound.java 3 Sep 2009 18:33:26 -0000 1.12 --- CGRFormationRound.java 3 Sep 2009 21:36:53 -0000 1.13 *************** *** 595,599 **** // Need some checks here... int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; ! Player.setPlayerCertificateLimit(newCertLimit); message = LocalText.getText("CertificateLimit", newCertLimit, --- 595,599 ---- // Need some checks here... int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; ! playerManager.setPlayerCertificateLimit(newCertLimit); message = LocalText.getText("CertificateLimit", newCertLimit, |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:03
|
Update of /cvsroot/rails/18xx/data/1870 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/1870 Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1870/Game.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Game.xml 14 Feb 2008 21:49:45 -0000 1.18 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.19 *************** *** 13,18 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="12000"/> <Players number="2" cash="1050" certLimit="28"/> <Players number="3" cash="700" certLimit="20"/> --- 13,17 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="2" cash="1050" certLimit="28"/> <Players number="3" cash="700" certLimit="20"/> *************** *** 21,24 **** --- 20,26 ---- <Players number="6" cash="350" certLimit="11"/> </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="12000"/> + </Component> <Component name="TileManager" class="rails.game.TileManager" file="TileSet.xml"/> |
From: Erik V. <ev...@us...> - 2009-09-03 21:37:02
|
Update of /cvsroot/rails/18xx/data/18AL In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21151/data/18AL Modified Files: Game.xml Log Message: Implemented the certificate limit change after CGR formation. Have moved the initial limits out of Player into PlayerManager. PlayerManager is now a configurable component; this has affected all Game.xml files. The above has has effects on other classes, in particular StockRound. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18AL/Game.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Game.xml 21 Dec 2007 21:18:12 -0000 1.19 --- Game.xml 3 Sep 2009 21:36:54 -0000 1.20 *************** *** 16,25 **** </EndOfGame> </Component> ! <Component name="Bank" class="rails.game.Bank"> ! <Bank amount="8000"/> <Players number="3" cash="600" certLimit="15"/> <Players number="4" cash="500" certLimit="12"/> <Players number="5" cash="400" certLimit="10"/> </Component> <Component name="TileManager" class="rails.game.TileManager" file="TileSet.xml"/> --- 16,27 ---- </EndOfGame> </Component> ! <Component name="PlayerManager" class="rails.game.PlayerManager"> <Players number="3" cash="600" certLimit="15"/> <Players number="4" cash="500" certLimit="12"/> <Players number="5" cash="400" certLimit="10"/> </Component> + <Component name="Bank" class="rails.game.Bank"> + <Bank amount="8000"/> + </Component> <Component name="TileManager" class="rails.game.TileManager" file="TileSet.xml"/> |
From: Erik V. <ev...@us...> - 2009-09-03 18:34:06
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3885/rails/game/specific/_1856 Modified Files: CGRFormationRound.java OperatingRound_1856.java Log Message: Certificate limits after CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CGRFormationRound.java 2 Sep 2009 21:47:47 -0000 1.11 --- CGRFormationRound.java 3 Sep 2009 18:33:26 -0000 1.12 *************** *** 33,36 **** --- 33,43 ---- public static final int STEP_EXCHANGE_TOKENS = 3; + private static int[][] certLimitsTable = { + {10, 13, 15, 18, 20, 22, 25, 28}, + {8, 10, 12, 14, 16, 18, 20, 22}, + {7, 8, 10, 11, 13, 15, 16, 18}, + {6, 7, 8, 10, 11, 12, 14, 15} + }; + public CGRFormationRound (GameManagerI gameManager) { super (gameManager); *************** *** 395,399 **** // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! ((PublicCompany_State)cgr).setShareUnit (10); // All superfluous shares have been removed } --- 402,406 ---- // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! (cgr).setShareUnit (10); // All superfluous shares have been removed } *************** *** 580,583 **** --- 587,606 ---- break; } + + // Determine the new certificate limit. + // The number of available companies is 11, + // or 12 minus the number of closed companies, whichever is lower. + int numCompanies = Math.min(11, 12-mergingCompanies.size()); + int numPlayers = gameManager.getNumberOfPlayers(); + // Need some checks here... + int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; + Player.setPlayerCertificateLimit(newCertLimit); + message = LocalText.getText("CertificateLimit", + newCertLimit, + numPlayers, + numCompanies); + DisplayBuffer.add(message); + ReportBuffer.add(message); + } Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** OperatingRound_1856.java 2 Sep 2009 21:47:47 -0000 1.17 --- OperatingRound_1856.java 3 Sep 2009 18:33:26 -0000 1.18 *************** *** 464,476 **** PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); ! //for (Iterator<PublicCompanyI> it = companies.iterator(); ! // it.hasNext(); ) { ! // company = it.next(); ! // if (company.isClosed()) { ! // if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! // //it.remove(); ! // } ! //} ! for (PublicCompanyI company : mergingCompanies) {; if (companiesOperatedThisRound.contains(company)) cgrCanOperate = false; } --- 464,469 ---- PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); ! ! for (PublicCompanyI company : mergingCompanies) { if (companiesOperatedThisRound.contains(company)) cgrCanOperate = false; } *************** *** 481,484 **** --- 474,486 ---- && getOperatingCompany().isClosed()); + // Remove closed companies from the operating company list + // (leave this code in case we need it; it works) + //for (Iterator<PublicCompanyI> it = companies.iterator(); + // it.hasNext(); ) { + // if ((it.next()).isClosed()) { + // it.remove(); + // } + //} + if (operatingCompany != null) { operatingCompanyIndex = companies.indexOf(operatingCompany); *************** *** 495,498 **** --- 497,501 ---- companies.add(operatingCompanyIndex, cgr); operatingCompany = cgr; + operatingCompanyIndex = companies.indexOf(operatingCompany); message = LocalText.getText("CanOperate", cgr.getName()); } else { *************** *** 512,536 **** @Override ! protected void finishTurn() { ! ! operatingCompany.setOperated(true); ! ! // Check if any privates must be closed ! // (now only applies to 1856 W&SR) ! for (PrivateCompanyI priv : operatingCompany.getPortfolio().getPrivateCompanies()) { ! priv.checkClosingIfExercised(true); ! } if (finalLoanRepaymentPending.booleanValue()) { ((GameManager_1856)gameManager).startCGRFormationRound(this, playerToStartLoanRepayment); ! return; } ! if (setNextOperatingCompany(false)) { ! setStep(STEP_INITIAL); ! } else { ! finishOR(); ! } } } --- 515,527 ---- @Override ! protected boolean finishTurnSpecials() { if (finalLoanRepaymentPending.booleanValue()) { ((GameManager_1856)gameManager).startCGRFormationRound(this, playerToStartLoanRepayment); ! return false; } ! return true; } } |
From: Erik V. <ev...@us...> - 2009-09-03 18:33:41
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3885 Modified Files: LocalisedText.properties Log Message: Certificate limits after CGR formation Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** LocalisedText.properties 2 Sep 2009 21:48:48 -0000 1.75 --- LocalisedText.properties 3 Sep 2009 18:33:27 -0000 1.76 *************** *** 76,79 **** --- 76,80 ---- CantSell={0} cannot sell {1} share(s) of {2}: {3} CantStart={0} cannot start company {1} for {2}: {3} + CertificateLimit=The certificate limit is now {0} ({1} players, {2} companies) CityHasNoEmptySlots=City has not empty slots ClassCannotBeInstantiated=Class {0} cannot be instantiated |
From: Erik V. <ev...@us...> - 2009-09-03 18:33:37
|
Update of /cvsroot/rails/18xx/data/1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3885/data/1856 Modified Files: Game.xml Log Message: Certificate limits after CGR formation Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/Game.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Game.xml 28 Aug 2009 20:49:20 -0000 1.23 --- Game.xml 3 Sep 2009 18:33:28 -0000 1.24 *************** *** 18,25 **** <Component name="Bank" class="rails.game.Bank"> <Bank amount="12000"/> ! <Players number="3" cash="500" certLimit="28"/> ! <Players number="4" cash="375" certLimit="22"/> ! <Players number="5" cash="300" certLimit="18"/> ! <Players number="6" cash="250" certLimit="15"/> </Component> <Component name="TileManager" class="rails.game.TileManager" --- 18,25 ---- <Component name="Bank" class="rails.game.Bank"> <Bank amount="12000"/> ! <Players number="3" cash="500" certLimit="20"/> ! <Players number="4" cash="375" certLimit="16"/> ! <Players number="5" cash="300" certLimit="13"/> ! <Players number="6" cash="250" certLimit="11"/> </Component> <Component name="TileManager" class="rails.game.TileManager" |
From: Erik V. <ev...@us...> - 2009-09-03 18:33:36
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3885/rails/game Modified Files: OperatingRound.java Player.java Log Message: Certificate limits after CGR formation Index: Player.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Player.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Player.java 30 Aug 2009 18:15:18 -0000 1.17 --- Player.java 3 Sep 2009 18:33:28 -0000 1.18 *************** *** 85,89 **** } ! public static void setShareLimit(int percentage) { playerShareLimit = percentage; } --- 85,94 ---- } ! /** In some games, the cert limit can change during the game (e.g. 1856) */ ! public static void setPlayerCertificateLimit(int playerCertificateLimit) { ! Player.playerCertificateLimit = playerCertificateLimit; ! } ! ! public static void setShareLimit(int percentage) { playerShareLimit = percentage; } Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** OperatingRound.java 2 Sep 2009 21:47:47 -0000 1.64 --- OperatingRound.java 3 Sep 2009 18:33:28 -0000 1.65 *************** *** 1162,1167 **** } ! if (setNextOperatingCompany(false)) { setStep(STEP_INITIAL); } else { --- 1162,1168 ---- } ! if (!finishTurnSpecials()) return; + if (setNextOperatingCompany(false)) { setStep(STEP_INITIAL); } else { *************** *** 1170,1173 **** --- 1171,1183 ---- } + /** Stub, may be overridden in subclasses + * Return value: + * TRUE = normal turn end; + * FALSE = return immediately from finishTurn(). + */ + protected boolean finishTurnSpecials () { + return true; + } + protected boolean setNextOperatingCompany(boolean initial) { |
From: Erik V. <ev...@us...> - 2009-09-02 21:49:01
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24513 Modified Files: LocalisedText.properties Log Message: Clarified running with borrowed train (CGR): must withhold Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** LocalisedText.properties 1 Sep 2009 21:14:39 -0000 1.74 --- LocalisedText.properties 2 Sep 2009 21:48:48 -0000 1.75 *************** *** 307,311 **** RevenueWithNoTrains={0} owns no trains, so revenue is {1}. RotateTile=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press the No Tile button. ! RunsWithBorrowedTrain={0} runs with a borrowed {1}-train SAVE=Save SaveFailed=Save failed, reason: {0} --- 307,311 ---- RevenueWithNoTrains={0} owns no trains, so revenue is {1}. RotateTile=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press the No Tile button. ! RunsWithBorrowedTrain={0} runs with a borrowed {1}-train and must withhold revenue SAVE=Save SaveFailed=Save failed, reason: {0} |
From: Erik V. <ev...@us...> - 2009-09-02 21:48:03
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24424/rails/game Modified Files: PublicCompanyI.java PublicCompany.java StockRound.java OperatingRound.java Log Message: Various fixes to CGR formation and operation Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** OperatingRound.java 1 Sep 2009 21:14:39 -0000 1.63 --- OperatingRound.java 2 Sep 2009 21:47:47 -0000 1.64 *************** *** 25,28 **** --- 25,30 ---- protected TreeMap<Integer, PublicCompanyI> operatingCompanies; + protected List<PublicCompanyI> companiesOperatedThisRound + = new ArrayList<PublicCompanyI> (); protected PublicCompanyI[] operatingCompanyArray; *************** *** 1152,1155 **** --- 1154,1158 ---- operatingCompany.setOperated(true); + companiesOperatedThisRound.add(operatingCompany); // Check if any privates must be closed Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** PublicCompany.java 1 Sep 2009 21:14:38 -0000 1.54 --- PublicCompany.java 2 Sep 2009 21:47:47 -0000 1.55 *************** *** 230,233 **** --- 230,235 ---- protected int maxLoansPerRound = 0; protected MoneyModel currentLoanValue = null; + + protected BooleanState canSharePriceVary = null; protected GameManagerI gameManager; *************** *** 588,591 **** --- 590,594 ---- parPrice = new PriceModel(this, name + "_ParPrice"); currentPrice = new PriceModel(this, name + "_CurrentPrice"); + canSharePriceVary = new BooleanState (name+"_CanSharePriceVary", true); } *************** *** 769,773 **** return mustHaveOperatedToTradeShares; } ! public void start(StockSpaceI startSpace) { --- 772,776 ---- return mustHaveOperatedToTradeShares; } ! public void start(StockSpaceI startSpace) { *************** *** 1279,1282 **** --- 1282,1289 ---- } + public boolean canSharePriceVary() { + return canSharePriceVary.booleanValue(); + } + public int getFixedPrice() { return fixedPrice; Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** PublicCompanyI.java 1 Sep 2009 21:14:38 -0000 1.31 --- PublicCompanyI.java 2 Sep 2009 21:47:47 -0000 1.32 *************** *** 246,250 **** public boolean hasParPrice(); ! public boolean isSplitAllowed(); --- 246,252 ---- public boolean hasParPrice(); ! ! public boolean canSharePriceVary(); ! public boolean isSplitAllowed(); Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** StockRound.java 14 Jul 2009 20:49:34 -0000 1.37 --- StockRound.java 2 Sep 2009 21:47:47 -0000 1.38 *************** *** 997,1001 **** } } ! stockMarket.sell(company, numberToSell); // Check if we still have the presidency --- 997,1001 ---- } } ! if (company.canSharePriceVary()) stockMarket.sell(company, numberToSell); // Check if we still have the presidency |
From: Erik V. <ev...@us...> - 2009-09-02 21:48:03
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24424/rails/ui/swing Modified Files: ORWindow.java ORPanel.java Log Message: Various fixes to CGR formation and operation Index: ORWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORWindow.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ORWindow.java 19 Jul 2009 19:24:21 -0000 1.24 --- ORWindow.java 2 Sep 2009 21:47:47 -0000 1.25 *************** *** 158,162 **** String numORs = gameManager.getNumOfORs (); ! if (!or.wasInterrupted()) orPanel.recreate(or); setTitle(LocalText.getText("MapWindowORTitle", compositeORNumber, --- 158,162 ---- String numORs = gameManager.getNumOfORs (); ! /*if (!or.wasInterrupted())*/ orPanel.recreate(or); setTitle(LocalText.getText("MapWindowORTitle", compositeORNumber, Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ORPanel.java 1 Sep 2009 19:30:15 -0000 1.31 --- ORPanel.java 2 Sep 2009 21:47:47 -0000 1.32 *************** *** 392,396 **** f = president[i] = ! new Field(c.hasStarted() ? c.getPresident().getNameAndPriority() : ""); addField(f, presidentXOffset, presidentYOffset + i, 1, 1, 0); --- 392,396 ---- f = president[i] = ! new Field(c.hasStarted() && !c.isClosed() ? c.getPresident().getNameAndPriority() : ""); addField(f, presidentXOffset, presidentYOffset + i, 1, 1, 0); |
From: Erik V. <ev...@us...> - 2009-09-02 21:48:01
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24424/rails/game/specific/_1856 Modified Files: PublicCompany_State.java CGRFormationRound.java GameManager_1856.java OperatingRound_1856.java Log Message: Various fixes to CGR formation and operation Index: PublicCompany_State.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_State.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PublicCompany_State.java 1 Sep 2009 21:14:38 -0000 1.4 --- PublicCompany_State.java 2 Sep 2009 21:47:46 -0000 1.5 *************** *** 5,15 **** import rails.game.*; import rails.game.move.MoveableHolderI; import rails.game.move.RemoveFromList; public class PublicCompany_State extends PublicCompany { /** Used for CGR */ ! private boolean hadPermanentTrain = false; public PublicCompany_State() { --- 5,17 ---- import rails.game.*; + import rails.game.move.CashMove; import rails.game.move.MoveableHolderI; import rails.game.move.RemoveFromList; + import rails.game.state.BooleanState; public class PublicCompany_State extends PublicCompany { /** Used for CGR */ ! private BooleanState hadPermanentTrain; public PublicCompany_State() { *************** *** 17,26 **** mustTradeTrainsAtFixedPrice = true; } public boolean hadPermanentTrain() { ! return hadPermanentTrain; } public boolean canRunTrains() { ! if (!hadPermanentTrain) { return true; } --- 19,44 ---- mustTradeTrainsAtFixedPrice = true; } + + /** Initialisation, to be called directly after instantiation (cloning) */ + @Override + public void init(String name, CompanyTypeI type) { + super.init(name, type); + hadPermanentTrain = new BooleanState (name+"_HadPermanentTrain", false); + + // Share price is initially fixed + canSharePriceVary.set(false); + } + public boolean hadPermanentTrain() { ! return hadPermanentTrain.booleanValue(); ! } ! ! public void setHadPermanentTrain(boolean hadPermanentTrain) { ! this.hadPermanentTrain.set(hadPermanentTrain); ! canSharePriceVary.set(true); } public boolean canRunTrains() { ! if (!hadPermanentTrain()) { return true; } *************** *** 29,33 **** public boolean runsWithBorrowedTrain () { ! return !hadPermanentTrain && getNumberOfTrains() == 0; } --- 47,63 ---- public boolean runsWithBorrowedTrain () { ! return !hadPermanentTrain() && getNumberOfTrains() == 0; ! } ! ! /** ! * CGR share price does not move until a permanent train is bought. ! * ! * @param The revenue amount. ! */ ! public void withhold(int amount) { ! if (amount > 0) new CashMove(null, this, amount); ! if (hasStockPrice && !runsWithBorrowedTrain()) { ! Game.getStockMarket().withhold(this); ! } } *************** *** 35,39 **** public void buyTrain(TrainI train, int price) { super.buyTrain (train, price); ! if (train.getType().isPermanent()) hadPermanentTrain = true; } --- 65,69 ---- public void buyTrain(TrainI train, int price) { super.buyTrain (train, price); ! if (train.getType().isPermanent()) setHadPermanentTrain(true); } *************** *** 74,78 **** @Override public boolean mustOwnATrain() { ! if (!hadPermanentTrain) { return false; } else { --- 104,108 ---- @Override public boolean mustOwnATrain() { ! if (!hadPermanentTrain()) { return false; } else { Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CGRFormationRound.java 28 Aug 2009 20:27:38 -0000 1.10 --- CGRFormationRound.java 2 Sep 2009 21:47:47 -0000 1.11 *************** *** 20,24 **** private int maxLoansToRepayByPresident = 0; private List<PublicCompanyI> mergingCompanies = new ArrayList<PublicCompanyI>(); ! private PublicCompanyI cgr = gameManager.getCompanyManager().getCompanyByName(CGRNAME); private String cgrName = CGRNAME; private List<TrainI> trainsToDiscardFrom = null; --- 20,24 ---- private int maxLoansToRepayByPresident = 0; private List<PublicCompanyI> mergingCompanies = new ArrayList<PublicCompanyI>(); ! private PublicCompany_State cgr = (PublicCompany_State)gameManager.getCompanyManager().getCompanyByName(CGRNAME); private String cgrName = CGRNAME; private List<TrainI> trainsToDiscardFrom = null; *************** *** 422,426 **** DisplayBuffer.add(message); ! // Collect the old token spots, and move cash and trains List<BaseToken> homeTokens = new ArrayList<BaseToken>(); nonHomeTokens = new ArrayList<BaseToken>(); --- 422,473 ---- DisplayBuffer.add(message); ! // Determine the CGR starting price, ! // and close the absorbed companies. ! int lowestPrice = 999; ! int totalPrice = 0; ! int price; ! int numberMerged = mergingCompanies.size(); ! for (PublicCompanyI comp : mergingCompanies) { ! price = comp.getMarketPrice(); ! totalPrice += price; ! if (price < lowestPrice) lowestPrice = price; ! //comp.setClosed(); ! } ! if (numberMerged >= 3) { ! totalPrice -= lowestPrice; ! numberMerged--; ! } ! int cgrPrice = Math.max(100, (((totalPrice/numberMerged)/5))*5); ! ! // Find the correct start space and start the CGR ! if (cgrPrice == 100) { ! cgr.start(100); ! } else { ! StockMarketI sm = StockMarket.getInstance(); ! int prevColPrice = 100; ! int colPrice; ! StockSpaceI startSpace; ! for (int col=6; col <= sm.getNumberOfColumns(); col++) { ! colPrice = sm.getStockSpace(1, col).getPrice(); ! if (cgrPrice > colPrice) continue; ! if (cgrPrice - prevColPrice < colPrice - cgrPrice) { ! startSpace = sm.getStockSpace(1, col-1); ! } else { ! startSpace = sm.getStockSpace(1, col); ! } ! cgr.start(startSpace); ! message = LocalText.getText("START_MERGED_COMPANY", ! "CGR", ! Bank.format(startSpace.getPrice()), ! startSpace.getName()); ! DisplayBuffer.add(message); ! ReportBuffer.add(message); ! break; ! } ! } ! cgr.setFloated(); ! ReportBuffer.add (LocalText.getText("Floats", "CGR")); ! ! // Collect the old token spots, and move cash and trains List<BaseToken> homeTokens = new ArrayList<BaseToken>(); nonHomeTokens = new ArrayList<BaseToken>(); *************** *** 449,452 **** --- 496,500 ---- for (TrainI train : trains) { train.moveTo(cgr.getPortfolio()); + if (train.getType().isPermanent()) cgr.setHadPermanentTrain(true); } } *************** *** 513,562 **** } ! // Determine the CGR starting price, ! // and close the absorbed companies. ! int lowestPrice = 999; ! int totalPrice = 0; ! int price; ! int numberMerged = mergingCompanies.size(); for (PublicCompanyI comp : mergingCompanies) { - price = comp.getMarketPrice(); - totalPrice += price; - if (price < lowestPrice) lowestPrice = price; comp.setClosed(); } - if (numberMerged >= 3) { - totalPrice -= lowestPrice; - numberMerged--; - } - int cgrPrice = Math.max(100, (((totalPrice/numberMerged)/5))*5); - - // Find the correct start space and start the CGR - if (cgrPrice == 100) { - cgr.start(100); - } else { - StockMarketI sm = StockMarket.getInstance(); - int prevColPrice = 100; - int colPrice; - StockSpaceI startSpace; - for (int col=6; col <= sm.getNumberOfColumns(); col++) { - colPrice = sm.getStockSpace(1, col).getPrice(); - if (cgrPrice > colPrice) continue; - if (cgrPrice - prevColPrice < colPrice - cgrPrice) { - startSpace = sm.getStockSpace(1, col-1); - } else { - startSpace = sm.getStockSpace(1, col); - } - cgr.start(startSpace); - message = LocalText.getText("START_MERGED_COMPANY", - "CGR", - Bank.format(startSpace.getPrice()), - startSpace.getName()); - DisplayBuffer.add(message); - ReportBuffer.add(message); - break; - } - } - cgr.setFloated(); - ReportBuffer.add (LocalText.getText("Floats", "CGR")); // Check the trains, autodiscard any excess non-permanent trains --- 561,568 ---- } ! // Close the merged companies for (PublicCompanyI comp : mergingCompanies) { comp.setClosed(); } // Check the trains, autodiscard any excess non-permanent trains *************** *** 742,746 **** } ! @Override public String toString() { return "1856 CGRFormationRound"; --- 748,756 ---- } ! public List<PublicCompanyI> getMergingCompanies() { ! return mergingCompanies; ! } ! ! @Override public String toString() { return "1856 CGRFormationRound"; Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** OperatingRound_1856.java 1 Sep 2009 21:14:38 -0000 1.16 --- OperatingRound_1856.java 2 Sep 2009 21:47:47 -0000 1.17 *************** *** 105,134 **** int requiredCash = 0; - // Check if any loan interest can be paid - if (operatingCompany.canLoan()) { - int loanValue = operatingCompany.getLoanValueModel().intValue(); - if (loanValue > 0) { - int interest = loanValue * operatingCompany.getLoanInterestPct() / 100; - int compCash = (operatingCompany.getCash() / 10) * 10; - requiredCash = Math.max(interest - compCash, 0); - } - } - // There is only revenue if there are any trains if (operatingCompany.canRunTrains()) { - int[] allowedRevenueActions = - operatingCompany.isSplitAlways() - ? new int[] { SetDividend.SPLIT } - : operatingCompany.isSplitAllowed() - ? new int[] { SetDividend.PAYOUT, - SetDividend.SPLIT, - SetDividend.WITHHOLD } - : new int[] { SetDividend.PAYOUT, - SetDividend.WITHHOLD }; ! possibleActions.add(new SetDividend( ! operatingCompany.getLastRevenue(), true, ! allowedRevenueActions, ! requiredCash)); // UI directions: // Any nonzero required cash should be reported to the user. --- 105,146 ---- int requiredCash = 0; // There is only revenue if there are any trains if (operatingCompany.canRunTrains()) { ! if (operatingCompany instanceof PublicCompany_State ! && ((PublicCompany_State)operatingCompany).runsWithBorrowedTrain()) { ! DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", ! "CGR", "D")); ! possibleActions.add(new SetDividend( ! operatingCompany.getLastRevenue(), true, ! new int[] {SetDividend.WITHHOLD })); ! } else { ! ! int[] allowedRevenueActions = ! operatingCompany.isSplitAlways() ! ? new int[] { SetDividend.SPLIT } ! : operatingCompany.isSplitAllowed() ! ? new int[] { SetDividend.PAYOUT, ! SetDividend.SPLIT, ! SetDividend.WITHHOLD } ! : new int[] { SetDividend.PAYOUT, ! SetDividend.WITHHOLD }; ! ! // Check if any loan interest can be paid ! if (operatingCompany.canLoan()) { ! int loanValue = operatingCompany.getLoanValueModel().intValue(); ! if (loanValue > 0) { ! int interest = loanValue * operatingCompany.getLoanInterestPct() / 100; ! int compCash = (operatingCompany.getCash() / 10) * 10; ! requiredCash = Math.max(interest - compCash, 0); ! } ! } ! ! possibleActions.add(new SetDividend( ! operatingCompany.getLastRevenue(), true, ! allowedRevenueActions, ! requiredCash)); ! } ! // UI directions: // Any nonzero required cash should be reported to the user. *************** *** 137,145 **** // In that case, the follow-up is done from this class. - if (operatingCompany instanceof PublicCompany_State - && !((PublicCompany_State)operatingCompany).runsWithBorrowedTrain()) { - DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", - "CGR", "D")); - } } } --- 149,152 ---- *************** *** 438,482 **** } ! @Override ! public void resume() { ! if (savedAction == null) { ! // End of CGRFormationRound ! finalLoanRepaymentPending.set(false); ! resetOperatingCompanies(); ! if (operatingCompany != null) { ! setStep(STEP_INITIAL); ! } else { ! finishOR(); ! } ! wasInterrupted.set(true); } else { ! super.resume(); } } ! private void resetOperatingCompanies() { ! ! int lastOperatingCompanyIndex = operatingCompanyIndex; ! // Find the first company that has not yet operated ! // and is not closed. ! while (setNextOperatingCompany(false) ! && getOperatingCompany().isClosed()); List<PublicCompanyI> companies = new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray)); - PublicCompanyI company; PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); - int index = 0; boolean cgrCanOperate = cgr.hasStarted(); ! for (Iterator<PublicCompanyI> it = companies.iterator(); ! it.hasNext(); ) { ! company = it.next(); ! if (company.isClosed()) { ! if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! //it.remove(); ! } } if (operatingCompany != null) { operatingCompanyIndex = companies.indexOf(operatingCompany); --- 445,484 ---- } ! public void resume (List<PublicCompanyI> mergingCompanies) { ! // End of CGRFormationRound ! finalLoanRepaymentPending.set(false); ! resetOperatingCompanies(mergingCompanies); ! if (operatingCompany != null) { ! setStep(STEP_INITIAL); } else { ! finishOR(); } + wasInterrupted.set(true); } ! private void resetOperatingCompanies(List<PublicCompanyI> mergingCompanies) { List<PublicCompanyI> companies = new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray)); PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); ! //for (Iterator<PublicCompanyI> it = companies.iterator(); ! // it.hasNext(); ) { ! // company = it.next(); ! // if (company.isClosed()) { ! // if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! // //it.remove(); ! // } ! //} ! for (PublicCompanyI company : mergingCompanies) {; ! if (companiesOperatedThisRound.contains(company)) cgrCanOperate = false; } + // Find the first company that has not yet operated + // and is not closed. + while (setNextOperatingCompany(false) + && getOperatingCompany().isClosed()); + if (operatingCompany != null) { operatingCompanyIndex = companies.indexOf(operatingCompany); Index: GameManager_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/GameManager_1856.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameManager_1856.java 4 Feb 2009 20:36:39 -0000 1.1 --- GameManager_1856.java 2 Sep 2009 21:47:47 -0000 1.2 *************** *** 24,28 **** if (round instanceof CGRFormationRound) { setRound(interruptedRound); ! ((OperatingRound_1856)interruptedRound).resume(); } else { super.nextRound(round); --- 24,28 ---- if (round instanceof CGRFormationRound) { setRound(interruptedRound); ! ((OperatingRound_1856)interruptedRound).resume(((CGRFormationRound)round).getMergingCompanies()); } else { super.nextRound(round); |
From: Erik V. <ev...@us...> - 2009-09-02 21:44:57
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24005/rails/game Modified Files: StockSpace.java Log Message: Clarification added: 'price token' in stead of 'token' Index: StockSpace.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockSpace.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StockSpace.java 4 Jun 2008 19:00:30 -0000 1.6 --- StockSpace.java 2 Sep 2009 21:44:34 -0000 1.7 *************** *** 58,62 **** */ public boolean addToken(PublicCompanyI company) { ! log.debug(company.getName() + " token added to " + name); tokens.add(company); update(); --- 58,62 ---- */ public boolean addToken(PublicCompanyI company) { ! log.debug(company.getName() + " price token added to " + name); tokens.add(company); update(); *************** *** 71,75 **** */ public boolean removeToken(PublicCompanyI company) { ! log.debug(company.getName() + " token removed from " + name); int index = tokens.indexOf(company); if (index >= 0) { --- 71,75 ---- */ public boolean removeToken(PublicCompanyI company) { ! log.debug(company.getName() + " price token removed from " + name); int index = tokens.indexOf(company); if (index >= 0) { |
From: Erik V. <ev...@us...> - 2009-09-01 21:14:54
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31489/rails/game Modified Files: PublicCompanyI.java PublicCompany.java OperatingRound.java Log Message: Added running with borrowed train (CGR) Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** OperatingRound.java 31 Aug 2009 22:35:51 -0000 1.62 --- OperatingRound.java 1 Sep 2009 21:14:39 -0000 1.63 *************** *** 903,907 **** if (step == STEP_CALC_REVENUE) { ! if (operatingCompany.getPortfolio().getNumberOfTrains() == 0) { // No trains, then the revenue is zero. /* --- 903,908 ---- if (step == STEP_CALC_REVENUE) { ! //if (operatingCompany.getPortfolio().getNumberOfTrains() == 0) { ! if (!operatingCompany.canRunTrains()) { // No trains, then the revenue is zero. /* *************** *** 1937,1941 **** // There is only revenue if there are any trains ! if (operatingCompany.getPortfolio().getNumberOfTrains() > 0) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() --- 1938,1942 ---- // There is only revenue if there are any trains ! if (operatingCompany.canRunTrains()) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** PublicCompany.java 31 Aug 2009 22:34:01 -0000 1.53 --- PublicCompany.java 1 Sep 2009 21:14:38 -0000 1.54 *************** *** 1405,1408 **** --- 1405,1412 ---- } + public boolean canRunTrains() { + return portfolio.getNumberOfTrains() > 0; + } + /** * Must be called in stead of Portfolio.buyTrain if side-effects can occur. *************** *** 1666,1670 **** public boolean canLoan() { ! return maxNumberOfLoans > 0; } --- 1670,1674 ---- public boolean canLoan() { ! return maxNumberOfLoans > 0; //TODO Does not work?? (see ORPanel) } Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** PublicCompanyI.java 31 Aug 2009 22:34:01 -0000 1.30 --- PublicCompanyI.java 1 Sep 2009 21:14:38 -0000 1.31 *************** *** 264,268 **** public int getNumberOfTrains(); ! public void initTurn(); --- 264,269 ---- public int getNumberOfTrains(); ! public boolean canRunTrains(); ! public void initTurn(); |
From: Erik V. <ev...@us...> - 2009-09-01 21:14:52
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31489 Modified Files: LocalisedText.properties Log Message: Added running with borrowed train (CGR) Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** LocalisedText.properties 3 Aug 2009 21:27:19 -0000 1.73 --- LocalisedText.properties 1 Sep 2009 21:14:39 -0000 1.74 *************** *** 307,310 **** --- 307,311 ---- RevenueWithNoTrains={0} owns no trains, so revenue is {1}. RotateTile=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press the No Tile button. + RunsWithBorrowedTrain={0} runs with a borrowed {1}-train SAVE=Save SaveFailed=Save failed, reason: {0} |
From: Erik V. <ev...@us...> - 2009-09-01 21:14:48
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv31489/rails/game/specific/_1856 Modified Files: PublicCompany_State.java OperatingRound_1856.java Log Message: Added running with borrowed train (CGR) Index: PublicCompany_State.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_State.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PublicCompany_State.java 31 Aug 2009 22:35:51 -0000 1.3 --- PublicCompany_State.java 1 Sep 2009 21:14:38 -0000 1.4 *************** *** 21,24 **** --- 21,35 ---- } + public boolean canRunTrains() { + if (!hadPermanentTrain) { + return true; + } + return getNumberOfTrains() > 0; + } + + public boolean runsWithBorrowedTrain () { + return !hadPermanentTrain && getNumberOfTrains() == 0; + } + @Override public void buyTrain(TrainI train, int price) { Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** OperatingRound_1856.java 31 Aug 2009 22:35:21 -0000 1.15 --- OperatingRound_1856.java 1 Sep 2009 21:14:38 -0000 1.16 *************** *** 17,20 **** --- 17,21 ---- public static final int STEP_REPAY_LOANS = 6; + private final String CGRNAME = "CGR"; static { *************** *** 63,67 **** operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! // 1856 special: check if the company may operate if (!operatingCompany.hasOperated()) { int soldPercentage --- 64,70 ---- operatingCompany = operatingCompanyArray[operatingCompanyIndex]; ! // 1856 special: check if the company has sold enough shares to operate ! // This check does not apply to the CGR ! if (operatingCompany.getName().equals(CGRNAME)) return true; if (!operatingCompany.hasOperated()) { int soldPercentage *************** *** 113,117 **** // There is only revenue if there are any trains ! if (operatingCompany.getPortfolio().getNumberOfTrains() > 0) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() --- 116,120 ---- // There is only revenue if there are any trains ! if (operatingCompany.canRunTrains()) { int[] allowedRevenueActions = operatingCompany.isSplitAlways() *************** *** 133,136 **** --- 136,145 ---- // question should be suppressed. // In that case, the follow-up is done from this class. + + if (operatingCompany instanceof PublicCompany_State + && !((PublicCompany_State)operatingCompany).runsWithBorrowedTrain()) { + DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", + "CGR", "D")); + } } } *************** *** 342,346 **** PhaseI postPhase = currentPhase; ! if (postPhase != prePhase && postPhase.getName().equals("5")) { finalLoanRepaymentPending.set(true); --- 351,355 ---- PhaseI postPhase = currentPhase; ! log.debug("+++Phase was "+prePhase.getName()+" now "+postPhase.getName()); if (postPhase != prePhase && postPhase.getName().equals("5")) { finalLoanRepaymentPending.set(true); |