Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18962/rails/game Modified Files: Portfolio.java Tile.java StockRound.java StartItem.java PublicCompany.java TreasuryShareRound.java Player.java TileI.java StartRound.java PublicCompanyI.java ShareSellingRound.java OperatingRound.java ReportBuffer.java Bank.java Round.java PrivateCompany.java Log Message: Implemented 1856 capitalisation rules. Implemented temporary procedure for destination reaching (checkboxes in OR) Cleanups Index: Portfolio.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Portfolio.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Portfolio.java 2 Nov 2008 19:52:48 -0000 1.28 --- Portfolio.java 20 Nov 2008 21:49:38 -0000 1.29 *************** *** 147,195 **** } - public void buyCertificate(PublicCertificateI certificate, Portfolio from, - int price) { - - // Move the certificate - // new CertificateMove (from, this, certificate); - certificate.moveTo(this); - - // Move the money. - if (price != 0) { - /* - * If the company has floated and capitalisation is incremental, the - * money goes to the company, even if the certificates are still in - * the IPO (as in 1835) - */ - PublicCompanyI comp = certificate.getCompany(); - CashHolder recipient; - if (comp.hasFloated() - && from == Bank.getIpo() - && comp.getCapitalisation() == PublicCompanyI.CAPITALISE_INCREMENTAL) { - recipient = comp; - } else { - recipient = from.owner; - } - // Bank.transferCash(owner, recipient, price); - new CashMove(owner, recipient, price); - } - } - - // Sales of stock always go to the Bank pool - // This method should be overridden for 1870 and other games - // that allow price protection. - public static void sellCertificate(PublicCertificateI certificate, - Portfolio from, int price) { - - ReportBuffer.add(LocalText.getText("SellsItemFor", new String[] { - from.getName(), certificate.getName(), Bank.format(price) })); - - // Move the certificate - // new CertificateMove (from, Bank.getPool(), certificate); - certificate.moveTo(Bank.getPool()); - - // Move the money - new CashMove(Bank.getInstance(), from.owner, price); - } - public void transferAssetsFrom(Portfolio otherPortfolio) { --- 147,150 ---- *************** *** 201,246 **** } - public static void transferCertificate(Certificate certificate, - Portfolio from, Portfolio to) { - if (certificate instanceof PublicCertificateI) { - if (from != null) - from.removeCertificate((PublicCertificateI) certificate); - to.addCertificate((PublicCertificateI) certificate); - } else if (certificate instanceof PrivateCompanyI) { - if (from != null) - from.removePrivate((PrivateCompanyI) certificate); - to.addPrivate((PrivateCompanyI) certificate); - } - - /* Update player's worth */ - if (from.owner instanceof Player) { - updatePlayerWorth((Player) from.owner, from, certificate); - } - if (to.owner instanceof Player) { - updatePlayerWorth((Player) to.owner, to, certificate); - } - } - - protected static void updatePlayerWorth(Player player, Portfolio portfolio, - Certificate certificate) { - - PublicCompanyI company; - - /* Update player worth */ - player.getWorthModel().update(); - - /* Make sure that future price changes will update the worth too */ - if (certificate instanceof PublicCertificateI) { - company = ((PublicCertificateI) certificate).getCompany(); - if (portfolio.certPerCompany.containsKey(company.getName())) { - company.getCurrentPriceModel().addDependent( - player.getWorthModel()); - } else { - company.getCurrentPriceModel().removeDependent( - player.getWorthModel()); - } - } - } - public void addPrivate(PrivateCompanyI privateCompany) { privateCompanies.add(privateCompany); --- 156,159 ---- Index: TreasuryShareRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TreasuryShareRound.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TreasuryShareRound.java 2 Nov 2008 19:52:48 -0000 1.7 --- TreasuryShareRound.java 20 Nov 2008 21:49:38 -0000 1.8 *************** *** 370,374 **** for (int i = 0; i < number; i++) { cert2 = from.findCertificate(company, cert.getShares(), false); ! portfolio.buyCertificate(cert2, from, shares * price); } --- 370,375 ---- for (int i = 0; i < number; i++) { cert2 = from.findCertificate(company, cert.getShares(), false); ! //portfolio.buyCertificate(cert2, from, shares * price); ! executeTradeCertificate(cert2, portfolio, shares * price); } *************** *** 493,498 **** // Transfer the sold certificates for (PublicCertificateI cert2 : certsToSell) { ! if (cert2 != null) ! pool.buyCertificate(cert2, portfolio, cert2.getShares() * price); } stockMarket.sell(company, numberSold); --- 494,501 ---- // Transfer the sold certificates for (PublicCertificateI cert2 : certsToSell) { ! if (cert2 != null) { ! //pool.buyCertificate(cert2, portfolio, cert2.getShares() * price); ! executeTradeCertificate (cert2, pool, cert2.getShares() * price); ! } } stockMarket.sell(company, numberSold); Index: StartItem.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartItem.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** StartItem.java 2 Nov 2008 19:52:48 -0000 1.12 --- StartItem.java 20 Nov 2008 21:49:38 -0000 1.13 *************** *** 154,159 **** if (pubcert.getPortfolio() == null ! || !pubcert.getPortfolio().getName().equals("Unavailable")) ! unavailable.buyCertificate(pubcert, pubcert.getPortfolio(), 0); } --- 154,159 ---- if (pubcert.getPortfolio() == null ! || pubcert.getPortfolio() != unavailable) ! pubcert.moveTo(unavailable); } *************** *** 170,176 **** // Move the certificate to the "unavailable" pool. PublicCertificateI pubcert2 = (PublicCertificateI) secondary; ! if (!pubcert2.getPortfolio().getName().equals("Unavailable")) ! unavailable.buyCertificate(pubcert2, ! pubcert2.getPortfolio(), 0); } } --- 170,175 ---- // Move the certificate to the "unavailable" pool. PublicCertificateI pubcert2 = (PublicCertificateI) secondary; ! if (pubcert2.getPortfolio() != unavailable) ! pubcert2.moveTo(unavailable); } } Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** PublicCompany.java 15 Nov 2008 13:42:27 -0000 1.42 --- PublicCompany.java 20 Nov 2008 21:49:38 -0000 1.43 *************** *** 290,295 **** if (privateBuyTag != null) { canBuyPrivates = true; - //GameManager.setCanAnyCompBuyPrivates(true); - //GameManager.setCompaniesCanBuyPrivates(); String lower = --- 290,293 ---- *************** *** 344,348 **** canHoldOwnShares = true; treasuryPaysOut = true; - //GameManager.setCanAnyCompanyHoldShares(true); maxPercOfOwnShares = --- 342,345 ---- *************** *** 380,383 **** --- 377,382 ---- } else if (capType.equalsIgnoreCase("incremental")) { setCapitalisation(CAPITALISE_INCREMENTAL); + } else if (capType.equalsIgnoreCase("whenBought")) { + setCapitalisation(CAPITALISE_WHEN_BOUGHT); } else { throw new ConfigurationException( *************** *** 434,439 **** } - //if (hasParPrice) GameManager.setHasAnyParPrice(true); - List<Tag> certificateTags = tag.getChildren("Certificate"); if (certificateTags != null) { --- 433,436 ---- *************** *** 499,503 **** if (buyCostTag != null) { baseTokensBuyCost = ! floatTag.getAttributeAsInteger("initialTokenCost", 0); } --- 496,500 ---- if (buyCostTag != null) { baseTokensBuyCost = ! buyCostTag.getAttributeAsInteger("initialTokenCost", 0); } *************** *** 730,733 **** --- 727,731 ---- public void start(StockSpaceI startSpace) { + log.debug("+++Starting1b "+name); hasStarted.set(true); setParSpace(startSpace); *************** *** 761,775 **** */ public void start() { ! hasStarted.set(true); ! if (hasStockPrice && parPrice.getPrice() != null) { ! // setCurrentPrice (parPrice.getPrice()); ! // The current price is set via the Stock Market ! StockMarket.getInstance().start(this, parPrice.getPrice()); ! } ! ! if (homeBaseTokensLayTime == WHEN_STARTED) { ! layHomeBaseTokens(); } - } --- 759,770 ---- */ public void start() { ! if (hasStockPrice) { ! start (getStartSpace()); ! } else { ! hasStarted.set(true); ! if (homeBaseTokensLayTime == WHEN_STARTED) { ! layHomeBaseTokens(); ! } } } *************** *** 799,827 **** getPresident().getPortfolio().getShareModel(this).update(); - /* - * // In 18EU, before phase 5, cash has already been moved if (moveCash) { - * - * int cash = 0; if (hasStockPrice) { int capFactor = 0; if - * (capitalisation == CAPITALISE_FULL) { capFactor = 100 / shareUnit; } - * else if (capitalisation == CAPITALISE_INCREMENTAL) { // TODO Should - * be: 100% - percentage still in IPO capFactor = - * percentageOwnedByPlayers() / shareUnit; } int price = (hasParPrice ? - * getParPrice() : getCurrentPrice()).getPrice(); cash = capFactor * - * price; } else { cash = fixedPrice; } - * - * if (baseTokensBuyCost > 0) cash -= baseTokensBuyCost; - * - * new CashMove(Bank.getInstance(), this, cash); - * ReportBuffer.add(LocalText.getText("FloatsWithCash", new String[] { - * name, Bank.format(cash) })); - * - * if (capitalisation == CAPITALISE_INCREMENTAL && canHoldOwnShares) { - * List<Certificate> moving = new ArrayList<Certificate>(); for - * (Certificate ipoCert : Bank.getIpo().getCertificatesPerCompany( - * name)) { moving.add(ipoCert); } for (Certificate ipoCert : moving) { - * ipoCert.moveTo(portfolio); } } } else { - * ReportBuffer.add(LocalText.getText("Floats", name)); } - */ - if (sharePriceUpOnFloating) { Game.getStockMarket().moveUp(this); --- 794,797 ---- *************** *** 986,998 **** * @return */ - /* - public static int getNumberOfPublicCompanies() { - return numberOfPublicCompanies; - } - /* - - /** - * @return - */ public int getPublicNumber() { return publicNumber; --- 956,959 ---- *************** *** 1021,1027 **** cert2 = cert.copy(); certificates.add(cert2); - //cert2.setCompany(this); - // TODO Questionable if it should be put in IPO or in - // Unavailable. } } --- 982,985 ---- *************** *** 1047,1051 **** certificates = new ArrayList<PublicCertificateI>(); certificates.add(certificate); - //certificate.setCompany(this); } --- 1005,1008 ---- *************** *** 1130,1148 **** } ! /** ! * Pay out a given amount of revenue (and store it). The amount is ! * distributed to all the certificate holders, or the "beneficiary" if ! * defined (e.g.: BankPool shares may pay to the company). ! * ! * @param The revenue amount. ! */ ! /* ! * public void payOut(int amount) { ! * ! * distributePayout(amount); // Move the token if (hasStockPrice && ! * (!payoutMustExceedPriceToMove || amount >= ! * currentPrice.getPrice().getPrice())) Game.getStockMarket().payOut(this); } /* ! * ! * /** Split a dividend. TODO Optional rounding down the payout * * @param amount --- 1087,1091 ---- } ! /** Split a dividend. TODO Optional rounding down the payout * * @param amount *************** *** 1150,1155 **** public void splitRevenue(int amount) { - // setLastRevenue(amount); - if (amount > 0) { // Withhold half of it --- 1093,1096 ---- *************** *** 1215,1221 **** beneficiary = this; } - // log.debug("Cert "+cert.getName()+"owned by "+holder.getName()+" - // benefits "+beneficiary.getName() - // +" (IPO:"+ipoPaysOut+" Pool:"+poolPaysOut+")"); return beneficiary; } --- 1156,1159 ---- *************** *** 1273,1299 **** } - public static boolean startCompany(String playerName, String companyName, - StockSpace startSpace) { - // TODO: Should probably do error checking in case names aren't found. - Player player = Game.getPlayerManager().getPlayerByName(playerName); - PublicCompany company = - (PublicCompany) Game.getCompanyManager().getPublicCompany( - companyName); - - PublicCertificate cert = - (PublicCertificate) company.certificates.get(0); - - if (player.getCash() >= (startSpace.getPrice() * (cert.getShare() / company.getShareUnit()))) { - company.start(startSpace); - int price = - startSpace.getPrice() - * (cert.getShare() / company.getShareUnit()); - player.buyShare(cert, price); - - return true; - } else - return false; - } - /** * @return Returns the lowerPrivatePriceFactor. --- 1211,1214 ---- *************** *** 1369,1374 **** pres.getPortfolio().swapPresidentCertificate(this, buyer.getPortfolio()); ! ReportBuffer.add(LocalText.getText("PresidencyIsTransferredTo", ! new String[] { name, buyer.getName() })); } } --- 1284,1289 ---- pres.getPortfolio().swapPresidentCertificate(this, buyer.getPortfolio()); ! ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", ! new String[] { buyer.getName(), name })); } } *************** *** 1394,1399 **** seller.getPortfolio().swapPresidentCertificate(this, player.getPortfolio()); ! ReportBuffer.add(LocalText.getText("PresidencyIsTransferredTo", ! new String[] { name, player.getName() })); } } --- 1309,1314 ---- seller.getPortfolio().swapPresidentCertificate(this, player.getPortfolio()); ! ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", ! new String[] { player.getName(), name })); } } *************** *** 1401,1415 **** /** - * Only usable if the float percentage is fixed. Games where the percentage - * varies must check this in StockRound and possibly StartRound. - */ - /* - * public boolean checkFlotation(boolean moveCash) { if (hasStarted() && - * !hasFloated() && (Bank.getIpo().getShare(this) + - * portfolio.getShare(this)) <= 100 - floatPerc) { // Float company - * setFloated(moveCash); return true; } else { return false; } } - */ - - /** * Return the unsold share percentage. It is calculated as the sum of the * percentages in IPO and in the company treasury. <p>The latter percentage --- 1316,1319 ---- *************** *** 1449,1457 **** } - /* - * public boolean mayBuyTrains() { - * - * return portfolio.getNumberOfTrains() < getCurrentTrainLimit(); } - */ public int getNumberOfTrains() { return portfolio.getNumberOfTrains(); --- 1353,1356 ---- *************** *** 1607,1614 **** } - /* - * public List<TokenI> getLaidBaseTokens() { return laidBaseTokens; } - */ - public List<TokenI> getTokens() { return allBaseTokens; --- 1506,1509 ---- Index: StartRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** StartRound.java 2 Nov 2008 19:52:48 -0000 1.20 --- StartRound.java 20 Nov 2008 21:49:38 -0000 1.21 *************** *** 21,25 **** protected int numPlayers; protected String variant; - //protected GameManager gameMgr; protected Player currentPlayer; --- 21,24 ---- *************** *** 74,78 **** auctionItemState.set(null); - //gameMgr = GameManager.getInstance(); gameManager.setRound(this); setCurrentPlayerIndex(gameManager.getPriorityPlayer().getIndex()); --- 73,76 ---- *************** *** 250,254 **** ReportBuffer.add(LocalText.getText("BuysItemFor", new String[] { player.getName(), primary.getName(), Bank.format(price) })); ! player.buy(primary, price); checksOnBuying(primary, sharePrice); if (item.hasSecondary()) { --- 248,253 ---- ReportBuffer.add(LocalText.getText("BuysItemFor", new String[] { player.getName(), primary.getName(), Bank.format(price) })); ! //player.buy(primary, price); ! executeTradeCertificate (primary, player.getPortfolio(), price); checksOnBuying(primary, sharePrice); if (item.hasSecondary()) { *************** *** 256,260 **** ReportBuffer.add(LocalText.getText("ALSO_GETS", new String[] { player.getName(), extra.getName() })); ! player.buy(extra, 0); checksOnBuying(extra, sharePrice); } --- 255,260 ---- ReportBuffer.add(LocalText.getText("ALSO_GETS", new String[] { player.getName(), extra.getName() })); ! //player.buy(extra, 0); ! executeTradeCertificate (extra, player.getPortfolio(), 0); checksOnBuying(extra, sharePrice); } Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Tile.java 15 Nov 2008 21:22:50 -0000 1.22 --- Tile.java 20 Nov 2008 21:49:38 -0000 1.23 *************** *** 30,39 **** private final List<Upgrade> upgrades = new ArrayList<Upgrade>(); // Contains ! // Upgrade ! // instances private String upgradesString = ""; ! private final List[] tracksPerSide = new ArrayList[6]; // Cannot ! // parametrise ! // collection array private Map<Integer, List<Track>> tracksPerStation = null; private final List<Track> tracks = new ArrayList<Track>(); --- 30,37 ---- private final List<Upgrade> upgrades = new ArrayList<Upgrade>(); // Contains ! // Upgrade instances private String upgradesString = ""; ! private final List[] tracksPerSide = new ArrayList[6]; ! // N.B. Cannot parametrise collection array private Map<Integer, List<Track>> tracksPerStation = null; private final List<Track> tracks = new ArrayList<Track>(); *************** *** 138,142 **** } value = stationTag.getAttributeAsInteger("value", 0); - // log.debug("Tile #"+id+" st."+number+" value="+value); slots = stationTag.getAttributeAsInteger("slots", 0); position = stationTag.getAttributeAsInteger("position", 0); --- 136,139 ---- *************** *** 247,250 **** --- 244,256 ---- } + + // Process any phases in which the upgrade is allowed + String phases = upgradeTag.getAttributeAsString("phase"); + if (phases != null) { + for (Upgrade newUpgrade : newUpgrades) { + newUpgrade.setPhases(phases); + } + + } } } *************** *** 325,334 **** * @return A List of valid upgrade TileI objects. */ ! public List<TileI> getUpgrades(MapHex hex) { List<TileI> upgr = new ArrayList<TileI>(); TileI tile; for (Upgrade upgrade : upgrades) { tile = upgrade.getTile(); ! if (hex == null || upgrade.isAllowedForHex(hex)) upgr.add(tile); } return upgr; --- 331,340 ---- * @return A List of valid upgrade TileI objects. */ ! public List<TileI> getUpgrades(MapHex hex, PhaseI phase) { List<TileI> upgr = new ArrayList<TileI>(); TileI tile; for (Upgrade upgrade : upgrades) { tile = upgrade.getTile(); ! if (hex == null || upgrade.isAllowedForHex(hex, phase.getName())) upgr.add(tile); } return upgr; *************** *** 347,351 **** if (phase.isTileColourAllowed(tile.getColourName()) && tile.countFreeTiles() != 0 /* -1 means unlimited */ ! && upgrade.isAllowedForHex(hex)) { valid.add(tile); } --- 353,357 ---- if (phase.isTileColourAllowed(tile.getColourName()) && tile.countFreeTiles() != 0 /* -1 means unlimited */ ! && upgrade.isAllowedForHex(hex, phase.getName())) { valid.add(tile); } *************** *** 421,424 **** --- 427,434 ---- */ List<MapHex> disallowedHexes = null; + /** + * Phases in which the upgrade can be executed. + */ + List<String> allowedPhases = null; /** *************** *** 435,440 **** } ! protected boolean isAllowedForHex(MapHex hex) { if (hexes != null) convertHexString(); --- 445,455 ---- } ! protected boolean isAllowedForHex(MapHex hex, String phaseName) { + if (allowedPhases != null + && !allowedPhases.contains(phaseName)) { + return false; + } + if (hexes != null) convertHexString(); *************** *** 447,451 **** } } ! protected TileI getTile() { return tile; --- 462,466 ---- } } ! protected TileI getTile() { return tile; *************** *** 455,458 **** --- 470,477 ---- this.hexes = hexes; } + + protected void setPhases (String phases) { + allowedPhases = Arrays.asList(phases.split(",")); + } private void convertHexString() { Index: Player.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Player.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Player.java 2 Nov 2008 19:52:48 -0000 1.14 --- Player.java 20 Nov 2008 21:49:38 -0000 1.15 *************** *** 2,6 **** package rails.game; - import java.util.ArrayList; import java.util.List; --- 2,5 ---- *************** *** 46,52 **** private Portfolio portfolio = null; - private ArrayList<PublicCompanyI> companiesSoldThisTurn = - new ArrayList<PublicCompanyI>(); - public static void setLimits(int number, int cash, int certLimit) { if (number > 1 && number <= MAX_PLAYERS) { --- 45,48 ---- *************** *** 107,148 **** } - /** - * @param share - * @throws NullPointerException if company hasn't started yet. UI needs to - * handle this. - */ - public void buyShare(PublicCertificate share, int price) - throws NullPointerException { - if (hasBoughtStockThisTurn) return; - - for (int i = 0; i < companiesSoldThisTurn.size(); i++) { - if (share.company.getName().equalsIgnoreCase( - companiesSoldThisTurn.get(i).toString())) return; - } - - if (portfolio.getCertificates().size() >= playerCertificateLimit) - return; - - try { - // throws nullpointer if company hasn't started yet. - // it's up to the UI to catch this and gracefully start the company. - getPortfolio().buyCertificate(share, share.getPortfolio(), price); - } catch (NullPointerException e) { - throw e; - } - - hasBoughtStockThisTurn = true; - } - - /* - public void buyShare(PublicCertificate share) throws NullPointerException { - try { - buyShare(share, share.getCompany().getCurrentSpace().getPrice()); - } catch (NullPointerException e) { - throw e; - } - } - */ - public boolean isOverLimits() { --- 103,106 ---- *************** *** 218,249 **** /** - * Front-end method for buying any kind of certificate from anyone. - * - * @param cert PrivateCompany or PublicCertificate. - * @param from Portfolio of seller. - * @param price Price. - */ - public void buy(Certificate cert, int price) { - - if (cert instanceof PrivateCompanyI) { - portfolio.buyPrivate((PrivateCompanyI) cert, cert.getPortfolio(), - price); - } else if (cert instanceof PublicCertificateI) { - Portfolio from = cert.getPortfolio(); - portfolio.buyCertificate((PublicCertificateI) cert, from, price); - ((PublicCertificateI) cert).getCompany().checkPresidencyOnBuy(this); - } - } - - /* - public int sellShare(PublicCertificate share) { - Portfolio.sellCertificate(share, portfolio, - share.getCompany().getCurrentSpace().getPrice()); - Game.getStockMarket().sell(share.getCompany(), 1); - return 1; - } - */ - - /** * @return Returns the player's portfolio. */ --- 176,179 ---- Index: Bank.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Bank.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Bank.java 28 Oct 2008 21:01:34 -0000 1.7 --- Bank.java 20 Nov 2008 21:49:38 -0000 1.8 *************** *** 147,151 **** * Put all available certificates in the IPO */ ! public /*static*/ void initCertificates() { // Add privates List<PrivateCompanyI> privates = --- 147,151 ---- * Put all available certificates in the IPO */ ! public void initCertificates() { // Add privates List<PrivateCompanyI> privates = *************** *** 243,247 **** public String getName() { ! return "Bank"; } --- 243,247 ---- public String getName() { ! return LocalText.getText("Bank"); } Index: PrivateCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PrivateCompany.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PrivateCompany.java 26 Oct 2008 20:47:37 -0000 1.18 --- PrivateCompany.java 20 Nov 2008 21:49:38 -0000 1.19 *************** *** 9,13 **** import rails.game.move.ObjectMove; import rails.game.special.SpecialPropertyI; - import rails.game.special.SpecialTokenLay; import rails.util.LocalText; import rails.util.Tag; --- 9,12 ---- *************** *** 54,58 **** if (hexes != null && hexes.length > 0) { blockedHexes = new ArrayList<MapHex>(); - // for (int i = 0; i < hexes.length; i++) for (String hexName : hexes) { MapHex hex = MapManager.getInstance().getHex(hexName); --- 53,56 ---- *************** *** 80,91 **** specialProperties.add(sp); sp.configureFromXML(spTag); - - /* - if (sp instanceof SpecialTokenLay - && ((SpecialTokenLay) sp).getToken() instanceof BonusToken) { - GameManager.setBonusTokensExist(true); - } - */ - } } --- 78,81 ---- Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Round.java 2 Nov 2008 19:52:48 -0000 1.11 --- Round.java 20 Nov 2008 21:49:38 -0000 1.12 *************** *** 171,174 **** --- 171,177 ---- // Incremental capitalisation as in 1851 capFactor = (100 - unsoldPercentage) / shareUnit; + } else if (capitalisationMode == PublicCompanyI.CAPITALISE_WHEN_BOUGHT) { + // Cash goes directly to treasury at each buy (as in 1856 before phase 6) + capFactor = 0; } int price = company.getIPOPrice(); *************** *** 178,181 **** --- 181,185 ---- } + // Substract initial token cost (e.g. 1851, 18EU) cash -= company.getBaseTokensBuyCost(); *************** *** 183,189 **** // up) ! new CashMove(Bank.getInstance(), company, cash); ! ReportBuffer.add(LocalText.getText("FloatsWithCash", new String[] { company.getName(), Bank.format(cash) })); if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL --- 187,198 ---- // up) ! if (cash > 0) { ! new CashMove(Bank.getInstance(), company, cash); ! ReportBuffer.add(LocalText.getText("FloatsWithCash", new String[] { company.getName(), Bank.format(cash) })); + } else { + ReportBuffer.add(LocalText.getText("Floats", + company.getName())); + } if (capitalisationMode == PublicCompanyI.CAPITALISE_INCREMENTAL *************** *** 205,207 **** --- 214,239 ---- } + protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price) { + + Portfolio oldHolder = (Portfolio) cert.getHolder(); + cert.moveTo(newHolder); + + if (price != 0) { + new CashMove(newHolder.getOwner(), oldHolder.getOwner(), price); + } + + } + + /** + * Who receives the cash when a certificate is bought. + * Normally this is owner of the previously holding portfolio. + * This method must be called <i>before</i> transferring the certificate. + * @param cert + * @param newHolder + * @return + */ + protected CashHolder getSharePriceRecipient (Certificate cert, int price) { + return ((Portfolio)cert.getHolder()).getOwner(); + } + } Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PublicCompanyI.java 15 Nov 2008 13:42:27 -0000 1.24 --- PublicCompanyI.java 20 Nov 2008 21:49:38 -0000 1.25 *************** *** 15,18 **** --- 15,20 ---- public static final int CAPITALISE_INCREMENTAL = 1; + + public static final int CAPITALISE_WHEN_BOUGHT = 2; public void init2() throws ConfigurationException; Index: ShareSellingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ShareSellingRound.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ShareSellingRound.java 2 Nov 2008 19:52:48 -0000 1.14 --- ShareSellingRound.java 20 Nov 2008 21:49:38 -0000 1.15 *************** *** 319,323 **** if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", new String[] { ! dumpedPlayer.getName(), companyName })); // First swap the certificates Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); --- 319,323 ---- if (presCert != null && dumpedPlayer != null && presSharesToSell > 0) { ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", new String[] { ! dumpedPlayer.getName(), companyName})); // First swap the certificates Portfolio dumpedPortfolio = dumpedPlayer.getPortfolio(); *************** *** 331,336 **** // Transfer the sold certificates for (PublicCertificateI cert2 : certsToSell) { ! if (cert2 != null) ! pool.buyCertificate(cert2, portfolio, cert2.getShares() * price); } stockMarket.sell(company, numberSold); --- 331,338 ---- // Transfer the sold certificates for (PublicCertificateI cert2 : certsToSell) { ! if (cert2 != null) { ! //pool.buyCertificate(cert2, portfolio, cert2.getShares() * price); ! executeTradeCertificate (cert2, pool, cert2.getShares() * price); ! } } stockMarket.sell(company, numberSold); *************** *** 346,350 **** ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", new String[] { otherPlayer.getName(), ! company.getName() })); break; } --- 348,353 ---- ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", new String[] { otherPlayer.getName(), ! company.getName() ! })); break; } Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** OperatingRound.java 15 Nov 2008 13:43:38 -0000 1.43 --- OperatingRound.java 20 Nov 2008 21:49:38 -0000 1.44 *************** *** 45,50 **** new HashMap<String, Integer>(); - // protected Map<MapHex, SpecialPropertyI> specialPropertyPerHex - // = new HashMap<MapHex, SpecialPropertyI>(); protected List<LayBaseToken> currentNormalTokenLays = new ArrayList<LayBaseToken>(); --- 45,48 ---- *************** *** 76,83 **** static protected int numberOfPlayers = 0; - // static protected int relativeORNumber = 0; - - // static protected int cumulativeORNumber = 0; - /* Constants */ public static final int SPLIT_NOT_ALLOWED = 0; --- 74,77 ---- *************** *** 122,138 **** */ public OperatingRound() { - // relativeORNumber++; - // cumulativeORNumber++; - // thisOrNumber = getCompositeORNumber(); - } public void start(boolean operate, String orNumber) { - //if (operatingCompanyIndexObject == null) { - // operatingCompanyIndexObject = - // new IntegerState("OperatingCompanyIndex", 0); - //} - if (players == null) { players = gameManager.getPlayers(); --- 116,123 ---- *************** *** 169,210 **** } - /*----- General methods -----*/ - /** - * Return the operating round (OR) number in the format sr.or, where sr is - * the last stock round number and or is the relative OR number. - * - * @return Composite SR/OR number. - */ - // public String getCompositeORNumber() { - // return StockRound.getLastStockRoundNumber() + "." + relativeORNumber; - // } - /** - * Get the relative OR number. This number restarts at 1 after each stock - * round. - * - * @return Relative OR number - */ - // public int getRelativeORNumber() { - // return relativeORNumber; - // } - /** - * Get the cumulative OR number. This number never restarts. - * - * @return Cumulative OR number. - */ - // public int getCumulativeORNumber() { - // return cumulativeORNumber; - // } - // public static int getLastORNumber() { - // return cumulativeORNumber; - // } - /** - * //@deprecated Currently needed, but will be removed in a later stage. - */ - // @Deprecated - // public static void resetRelativeORNumber() { - // relativeORNumber = 0; - // } /*----- METHODS THAT PROCESS PLAYER ACTIONS -----*/ --- 154,158 ---- *************** *** 256,259 **** --- 204,211 ---- result = buyPrivate((BuyPrivate) selectedAction); + + } else if (selectedAction instanceof ReachDestinations) { + + result = reachDestinations ((ReachDestinations) selectedAction); } else if (selectedAction instanceof NullAction) { *************** *** 321,325 **** if (tile == null) break; - //if (!tile.isLayableNow()) { if (!currentPhase.isTileColourAllowed(tile.getColourName())) { errMsg = --- 273,276 ---- *************** *** 409,414 **** if (tile != null) { ! if (cost > 0) // Bank.transferCash((CashHolder) operatingCompany, ! // null, cost); new CashMove(operatingCompany, null, cost); operatingCompany.layTile(hex, tile, orientation, cost); --- 360,364 ---- if (tile != null) { ! if (cost > 0) new CashMove(operatingCompany, null, cost); operatingCompany.layTile(hex, tile, orientation, cost); *************** *** 447,452 **** && currentSpecialTileLays.isEmpty()) { nextStep(); - } else { - // setPossibleActions("layTile"); } --- 397,400 ---- *************** *** 464,468 **** protected boolean checkNormalTileLay(TileI tile, boolean update) { - // if (currentNormalTileLays.isEmpty()) return false; if (tileLaysPerColour.isEmpty()) return false; String colour = tile.getColourName(); --- 412,415 ---- *************** *** 557,562 **** // Does the company have the money? if (cost > operatingCompany.getCash()) { ! errMsg = LocalText.getText("NotEnoughMoney", companyName); ! break; } break; --- 504,513 ---- // Does the company have the money? if (cost > operatingCompany.getCash()) { ! errMsg = LocalText.getText("NotEnoughMoney", new String[] { ! companyName, ! Bank.format(operatingCompany.getCash()), ! Bank.format(cost) ! }); ! break; } break; *************** *** 610,615 **** && currentSpecialTokenLays.isEmpty()) { nextStep(); - } else { - // setPossibleActions("layBaseToken"); } --- 561,564 ---- *************** *** 893,898 **** } - // if (step >= steps.length) { - // done(); if (step == STEP_FINAL) { finishTurn(); --- 842,845 ---- *************** *** 985,991 **** * normal tile lays are also (still) allowed */ - // for (MapHex hex : stl.getLocations()) { - // specialPropertyPerHex.put(hex, stl); - // } currentSpecialTileLays.add(new LayTile(stl)); } --- 932,935 ---- *************** *** 1015,1020 **** /* Special-property tile lays */ currentSpecialTokenLays.clear(); ! // specialPropertyPerHex.clear(); ! /* * In 1835, this only applies to major companies. TODO: For now, --- 959,963 ---- /* Special-property tile lays */ currentSpecialTokenLays.clear(); ! /* * In 1835, this only applies to major companies. TODO: For now, *************** *** 1031,1035 **** * normal tile lays are also (still) allowed */ - // specialPropertyPerHex.put(stl.getLocation(), stl); currentSpecialTokenLays.add(new LayBaseToken(stl)); } --- 974,977 ---- *************** *** 1219,1224 **** presidentCash = action.getPresidentCashToAdd(); if (currentPlayer.getCash() >= presidentCash) { - // new CashMove(currentPlayer, operatingCompany, - // presidentCash); actualPresidentCash = presidentCash; } else { --- 1161,1164 ---- *************** *** 1236,1242 **** break; } else if (currentPlayer.getCash() >= presidentCash) { ! // new CashMove(currentPlayer, operatingCompany, ! // presidentCash); ! actualPresidentCash = presidentCash; } else { presidentMustSellShares = true; --- 1176,1180 ---- break; } else if (currentPlayer.getCash() >= presidentCash) { ! actualPresidentCash = presidentCash; } else { presidentMustSellShares = true; *************** *** 1327,1331 **** } - // setPossibleActions("buyTrain"); return true; } --- 1265,1268 ---- *************** *** 1518,1521 **** --- 1455,1490 ---- } + + public boolean reachDestinations (ReachDestinations action) { + + List<PublicCompanyI> destinedCompanies + = action.getReachedCompanies(); + if (destinedCompanies != null) { + for (PublicCompanyI company : destinedCompanies) { + if (company.hasDestination() + && !company.hasReachedDestination()) { + if (!MoveSet.isOpen()) MoveSet.start(true); + company.setReachedDestination(true); + ReportBuffer.add(LocalText.getText("DestinationReached", new String[] { + company.getName(), + company.getDestinationHex().getName() + })); + // Process any consequences of reaching a destination + // (default none) + reachDestination (company); + } + } + } + return true; + } + + /** Stub for applying any follow-up actions when + * a company reaches it destinations. + * Default version: no actions. + * @param company + */ + protected void reachDestination (PublicCompanyI company) { + + } /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ *************** *** 1575,1580 **** public boolean setPossibleActions() { - // log.debug("Called from ", new Exception("HERE")); - operatingCompanyIndex = operatingCompanyIndexObject.intValue(); operatingCompany = operatingCompanyArray[operatingCompanyIndex]; --- 1544,1547 ---- *************** *** 1595,1598 **** --- 1562,1566 ---- possibleActions.addAll(currentSpecialTileLays); possibleActions.add(new NullAction(NullAction.SKIP)); + } else if (step == STEP_LAY_TOKEN) { setNormalTokenLays(); *************** *** 1629,1632 **** --- 1597,1602 ---- setBonusTokenLays(); + + setDestinationActions(); setGameSpecificPossibleActions(); *************** *** 1686,1690 **** int cost; List<TrainI> trains; ! // TrainI train; boolean hasTrains = operatingCompany.getPortfolio().getNumberOfTrains() > 0; --- 1656,1660 ---- int cost; List<TrainI> trains; ! boolean hasTrains = operatingCompany.getPortfolio().getNumberOfTrains() > 0; *************** *** 1859,1862 **** --- 1829,1842 ---- } } + + /** + * This is currently a stub, as it is unclear if there is a common + * rule for setting destination reaching options. + * See OperatingRound_1856 for a first implementation + * of such rules. + */ + protected void setDestinationActions () { + + } /* TODO This is just a start of a possible approach to a Help system */ Index: ReportBuffer.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ReportBuffer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReportBuffer.java 4 Jun 2008 19:00:30 -0000 1.3 --- ReportBuffer.java 20 Nov 2008 21:49:38 -0000 1.4 *************** *** 4,8 **** --- 4,10 ---- import java.io.*; import java.text.*; + import java.util.ArrayList; import java.util.Date; + import java.util.List; import org.apache.log4j.Logger; *************** *** 99,102 **** --- 101,118 ---- } } + + /* A stack for messages that must "wait" for other messages */ + private static List<String> waitQueue = new ArrayList<String> (); + + public static void addWaiting (String string) { + waitQueue.add (string); + } + + public static void getAllWaiting () { + for (String message : waitQueue) { + ReportBuffer.add (message); + } + waitQueue.clear(); + } } Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** StockRound.java 2 Nov 2008 19:52:48 -0000 1.31 --- StockRound.java 20 Nov 2008 21:49:38 -0000 1.32 *************** *** 4,7 **** --- 4,8 ---- import rails.game.action.*; + import rails.game.move.CashMove; import rails.game.move.DoubleMapChange; import rails.game.move.MoveSet; *************** *** 19,26 **** /* Transient memory (per round only) */ ! protected /*static*/ int numberOfPlayers; protected Player currentPlayer; - // protected PublicCompanyI companyBoughtThisTurn = null; protected State companyBoughtThisTurnWrapper = new State("CompanyBoughtThisTurn", PublicCompany.class); --- 20,26 ---- /* Transient memory (per round only) */ ! protected int numberOfPlayers; protected Player currentPlayer; protected State companyBoughtThisTurnWrapper = new State("CompanyBoughtThisTurn", PublicCompany.class); *************** *** 30,39 **** protected BooleanState hasActed = new BooleanState("HasActed", false); // Is - // set - // true - // on - // any - // player - // action protected IntegerState numPasses = new IntegerState("StockRoundPasses"); --- 30,33 ---- *************** *** 54,65 **** /* Permanent memory */ - //static IntegerState stockRoundNumber = - // new IntegerState("StockRoundNumber", 0); static protected StockMarketI stockMarket; static protected Portfolio ipo; static protected Portfolio pool; static protected Portfolio unavailable; - //static protected CompanyManagerI companyMgr; - //static protected GameManager gameMgr; /* Rules */ --- 48,55 ---- *************** *** 73,88 **** if (numberOfPlayers == 0) numberOfPlayers = gameManager.getPlayers().size(); - //if (gameMgr == null) gameMgr = GameManager.getInstance(); if (stockMarket == null) stockMarket = StockMarket.getInstance(); if (ipo == null) ipo = Bank.getIpo(); if (pool == null) pool = Bank.getPool(); if (unavailable == null) unavailable = Bank.getUnavailable(); - //if (companyMgr == null) companyMgr = Game.getCompanyManager(); gameManager.setRound(this); sequenceRule = gameManager.getStockRoundSequenceRule(); - //stockRoundNumber.add(1); - ReportBuffer.add("\n" + LocalText.getText("StartStockRound") + getStockRoundNumber()); --- 63,74 ---- *************** *** 101,105 **** } - @Override public boolean setPossibleActions() { --- 87,90 ---- *************** *** 174,178 **** price = comp.getIPOPrice(); if (price <= playerCash) { ! possibleActions.add(new BuyCertificate(cert, from, price)); } } else if (!comp.hasStarted()) { --- 159,164 ---- price = comp.getIPOPrice(); if (price <= playerCash) { ! possibleActions.add(new BuyCertificate(cert, from, ! price)); } } else if (!comp.hasStarted()) { *************** *** 180,185 **** price = comp.getIPOPrice() * cert.getShares(); if (price <= playerCash) { ! possibleActions.add(new StartCompany(cert, ! price)); } } else { --- 166,170 ---- price = comp.getIPOPrice() * cert.getShares(); if (price <= playerCash) { ! possibleActions.add(new StartCompany(cert, price)); } } else { *************** *** 199,203 **** } } ! } } --- 184,188 ---- } } ! } } *************** *** 267,272 **** if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, ! company.getPortfolio(), ! company.getMarketPrice())); } } --- 252,256 ---- if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, ! company.getPortfolio(), company.getMarketPrice())); } } *************** *** 414,423 **** } else if (action instanceof BuyCertificate) { - // BuyCertificate buyAction = (BuyCertificate) action; - // result = buyShare (playerName, - // buyAction.getCertificate().getPortfolio(), - // buyAction.getCertificate().getCompany().getName(), - // buyAction.getCertificate().getShares(), - // 1); result = buyShares(playerName, (BuyCertificate) action); --- 398,401 ---- *************** *** 430,434 **** result = useSpecialProperty((UseSpecialProperty) action); ! } else if ((result = processGameSpecificAction(action))) { } else { --- 408,412 ---- result = useSpecialProperty((UseSpecialProperty) action); ! } else if (!!(result = processGameSpecificAction(action))) { } else { *************** *** 546,553 **** // All is OK, now start the company company.start(startSpace); // Transfer the President's certificate ! currentPlayer.getPortfolio().buyCertificate(cert, ipo, ! company.getIPOPrice()); // If more than one certificate is bought at the same time, transfer --- 524,533 ---- // All is OK, now start the company company.start(startSpace); + + CashHolder priceRecipient = getSharePriceRecipient (cert, price); // Transfer the President's certificate ! executeTradeCertificate(cert, currentPlayer.getPortfolio(), ! price * cert.getShares(), priceRecipient); // If more than one certificate is bought at the same time, transfer *************** *** 555,560 **** for (int i = 1; i < numberOfCertsToBuy; i++) { cert = ipo.findCertificate(company, false); ! currentPlayer.getPortfolio().buyCertificate(cert, ipo, ! company.getIPOPrice()); } --- 535,540 ---- for (int i = 1; i < numberOfCertsToBuy; i++) { cert = ipo.findCertificate(company, false); ! executeTradeCertificate(cert, currentPlayer.getPortfolio(), ! company.getIPOPrice(), priceRecipient); } *************** *** 562,570 **** playerName, companyName, Bank.format(price), Bank.format(shares * price), String.valueOf(shares), ! String.valueOf(cert.getShare()), LocalText.getText("BANK") })); checkFlotation(company); - // companyBoughtThisTurn = company; companyBoughtThisTurnWrapper.set(company); hasActed.set(true); --- 542,551 ---- playerName, companyName, Bank.format(price), Bank.format(shares * price), String.valueOf(shares), ! String.valueOf(cert.getShare()), ! priceRecipient.getName()})); ! ReportBuffer.getAllWaiting(); checkFlotation(company); companyBoughtThisTurnWrapper.set(company); hasActed.set(true); *************** *** 598,601 **** --- 579,583 ---- String errMsg = null; int price = 0; + int cash = 0; PublicCompanyI company = null; *************** *** 627,634 **** } ! // The company must have started before ! //if (!company.hasStarted()) { ! // The above is not true for 1835 Pr (for instance) ! // New rule: the presidents share may not be in IPO if (company.getPresidentsShare().getHolder() == ipo) { errMsg = LocalText.getText("NotYetStarted", companyName); --- 609,613 ---- } ! // The presidents share may not be in IPO if (company.getPresidentsShare().getHolder() == ipo) { errMsg = LocalText.getText("NotYetStarted", companyName); *************** *** 689,695 **** price = currentSpace.getPrice(); // Check if the Player has the money. ! if (currentPlayer.getCash() < shares * price) { errMsg = LocalText.getText("NoMoney"); break; --- 668,675 ---- price = currentSpace.getPrice(); + cash = shares * price; // Check if the Player has the money. ! if (currentPlayer.getCash() < cash) { errMsg = LocalText.getText("NoMoney"); break; *************** *** 709,716 **** MoveSet.start(true); if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", new String[] { playerName, String.valueOf(shareUnit), companyName, ! from.getName(), Bank.format(shares * price) })); } else { ReportBuffer.add(LocalText.getText("BUY_SHARES_LOG", new String[] { --- 689,698 ---- MoveSet.start(true); + CashHolder priceRecipient = getSharePriceRecipient (cert, cash); + if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", new String[] { playerName, String.valueOf(shareUnit), companyName, ! from.getName(), Bank.format(cash) })); } else { ReportBuffer.add(LocalText.getText("BUY_SHARES_LOG", new String[] { *************** *** 718,723 **** String.valueOf(shareUnit), String.valueOf(number * shareUnit), companyName, ! from.getName(), Bank.format(shares * price) })); } PublicCertificateI cert2; --- 700,706 ---- String.valueOf(shareUnit), String.valueOf(number * shareUnit), companyName, ! from.getName(), Bank.format(cash) })); } + ReportBuffer.getAllWaiting(); PublicCertificateI cert2; *************** *** 728,732 **** + "% share in " + from.getName()); } ! currentPlayer.buy(cert2, price * shares); } --- 711,724 ---- + "% share in " + from.getName()); } ! executeTradeCertificate(cert2, currentPlayer.getPortfolio(), ! cash, priceRecipient); ! } ! ! if (priceRecipient != from.getOwner()) { ! ReportBuffer.add(LocalText.getText("PriceIsPaidTo", ! new String[] { ! Bank.format(price * shares), ! priceRecipient.getName() ! })); } *************** *** 735,741 **** setPriority(); // Check if the company has floated if (!company.hasFloated()) checkFlotation(company); ! // Check for any game-specific consequences // (such as making another company available in the IPO) --- 727,736 ---- setPriority(); + // Check if presidency has changed + company.checkPresidencyOnBuy(currentPlayer); + // Check if the company has floated if (!company.hasFloated()) checkFlotation(company); ! // Check for any game-specific consequences // (such as making another company available in the IPO) *************** *** 744,760 **** return true; } ! /** Stub, may be overridden in subclasses */ protected void gameSpecificChecks(Portfolio boughtFrom, PublicCompanyI company) { } ! ! /** Make the cerificates of one company available for buying * by putting these in the IPO. * @param company The company to be released. */ ! protected void releaseCompanyShares (PublicCompanyI company) { ! for (PublicCertificateI cert : company.getCertificates()) { if (cert.getHolder().e... [truncated message content] |