From: Erik V. <ev...@us...> - 2010-02-16 20:16:14
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28591/rails/game Modified Files: StockRound.java PublicCompanyI.java OperatingRound.java PublicCompany.java MapHex.java Log Message: Various 1835 fixes Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** OperatingRound.java 14 Feb 2010 20:47:45 -0000 1.99 --- OperatingRound.java 16 Feb 2010 20:15:42 -0000 1.100 *************** *** 2568,2570 **** } ! } --- 2568,2570 ---- } ! } \ No newline at end of file Index: MapHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapHex.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** MapHex.java 14 Feb 2010 20:47:45 -0000 1.37 --- MapHex.java 16 Feb 2010 20:16:07 -0000 1.38 *************** *** 1014,1016 **** } ! } --- 1014,1016 ---- } ! } \ No newline at end of file Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** PublicCompany.java 14 Feb 2010 20:48:02 -0000 1.85 --- PublicCompany.java 16 Feb 2010 20:15:57 -0000 1.86 *************** *** 112,115 **** --- 112,118 ---- protected BooleanState hasOperated = null; + /** Are company shares buyable (i.e. before started)? */ + protected BooleanState buyable = null; + /** * A map per tile colour. Each entry contains a map per phase, of which each *************** *** 586,589 **** --- 589,593 ---- hasFloated = new BooleanState(name + "_hasFloated", false); hasOperated = new BooleanState(name + "_hasOperated", false); + buyable = new BooleanState(name + "_isBuyable", false); allBaseTokens = new ArrayList<TokenI>(); *************** *** 829,832 **** --- 833,837 ---- hasStarted.set(true); + buyable.set(true); setParSpace(startSpace); // The current price is set via the Stock Market *************** *** 855,858 **** --- 860,864 ---- } else { hasStarted.set(true); + buyable.set(true); if (homeBaseTokensLayTime == WHEN_STARTED) { layHomeBaseTokens(); *************** *** 876,880 **** } ! /** * Float the company, put its initial cash in the treasury. */ --- 882,897 ---- } ! /** Make company shares buyable. Only useful where shares become ! * buyable before the company has started (e.g. 1835 Prussian). ! * */ ! public void setBuyable(boolean buyable) { ! this.buyable.set(buyable); ! } ! ! public boolean isBuyable() { ! return buyable.booleanValue(); ! } ! ! /** * Float the company, put its initial cash in the treasury. */ *************** *** 1607,1612 **** } } ! ! @Override public void layTileInNoMapMode(int cost) { if (cost > 0) tilesCostThisTurn.add(cost); --- 1624,1628 ---- } } ! public void layTileInNoMapMode(int cost) { if (cost > 0) tilesCostThisTurn.add(cost); *************** *** 1628,1633 **** if (cost > 0) tokensCostThisTurn.add(cost); } ! ! @Override public void layBaseTokenInNoMapMode(int cost) { if (cost > 0) tokensCostThisTurn.add(cost); --- 1644,1648 ---- if (cost > 0) tokensCostThisTurn.add(cost); } ! public void layBaseTokenInNoMapMode(int cost) { if (cost > 0) tokensCostThisTurn.add(cost); Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** PublicCompanyI.java 14 Feb 2010 20:48:02 -0000 1.46 --- PublicCompanyI.java 16 Feb 2010 20:15:42 -0000 1.47 *************** *** 82,85 **** --- 82,87 ---- */ public boolean hasStarted(); + public void setBuyable(boolean buyable); + public boolean isBuyable(); /** *************** *** 287,291 **** public void layTile(MapHex hex, TileI tile, int orientation, int cost); ! public void layTileInNoMapMode(int cost); --- 289,293 ---- public void layTile(MapHex hex, TileI tile, int orientation, int cost); ! public void layTileInNoMapMode(int cost); Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** StockRound.java 9 Feb 2010 20:03:00 -0000 1.61 --- StockRound.java 16 Feb 2010 20:15:36 -0000 1.62 *************** *** 675,683 **** } ! // The presidents share may not be in IPO ! //if (company.getPresidentsShare().getHolder() == ipo) { ! // There is an exception for 1856 CGR. Just chech 'started', ! // but even this might not be true for e.g. 1835 Prussi ! if (!company.hasStarted()) { errMsg = LocalText.getText("NotYetStarted", companyName); break; --- 675,679 ---- } ! if (!company.isBuyable()) { errMsg = LocalText.getText("NotYetStarted", companyName); break; *************** *** 994,999 **** int price; // Get the sell price (does not change within a turn) ! if (sellPrices.containsKey(companyName)) { price = (sellPrices.get(companyName)).getPrice(); } else { --- 990,996 ---- int price; + boolean soldBefore = sellPrices.containsKey(companyName); // Get the sell price (does not change within a turn) ! if (soldBefore) { price = (sellPrices.get(companyName)).getPrice(); } else { *************** *** 1043,1047 **** } } ! company.adjustSharePrice (SOLD, numberSold, gameManager.getStockMarket()); // Check if we still have the presidency --- 1040,1044 ---- } } ! adjustSharePrice (company, numberSold, soldBefore); // Check if we still have the presidency *************** *** 1071,1074 **** --- 1068,1075 ---- return true; } + + protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { + company.adjustSharePrice (SOLD, numberSold, gameManager.getStockMarket()); + } public boolean useSpecialProperty(UseSpecialProperty action) { |