From: Erik V. <ev...@us...> - 2008-12-23 20:00:08
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27301/rails/game Modified Files: StockRound.java Log Message: Apply new round initialisation logic Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** StockRound.java 4 Dec 2008 00:54:43 -0000 1.33 --- StockRound.java 23 Dec 2008 20:00:03 -0000 1.34 *************** *** 4,10 **** import rails.game.action.*; ! import rails.game.move.CashMove; ! import rails.game.move.DoubleMapChange; ! import rails.game.move.MoveSet; import rails.game.special.*; import rails.game.state.*; --- 4,8 ---- import rails.game.action.*; ! import rails.game.move.*; import rails.game.special.*; import rails.game.state.*; *************** *** 60,71 **** /** - * Constructor with no parameters, call the super Class (Round's) Constructor with no parameters - * - */ - public StockRound () { - super (); - } - - /** * Constructor with the GameManager, will call super class (Round's) Constructor to initialize * --- 58,61 ---- *************** *** 73,81 **** * */ ! public StockRound (GameManager aGameManager) { super (aGameManager); - } - - public void start() { if (numberOfPlayers == 0) --- 63,68 ---- * */ ! public StockRound (GameManagerI aGameManager) { super (aGameManager); if (numberOfPlayers == 0) *************** *** 85,92 **** if (pool == null) pool = Bank.getPool(); if (unavailable == null) unavailable = Bank.getUnavailable(); - gameManager.setRound(this); sequenceRule = gameManager.getStockRoundSequenceRule(); ReportBuffer.add("\n" + LocalText.getText("StartStockRound") + getStockRoundNumber()); --- 72,82 ---- if (pool == null) pool = Bank.getPool(); if (unavailable == null) unavailable = Bank.getUnavailable(); sequenceRule = gameManager.getStockRoundSequenceRule(); + } + + public void start() { + ReportBuffer.add("\n" + LocalText.getText("StartStockRound") + getStockRoundNumber()); *************** *** 137,141 **** * Create a list of certificates that a player may buy in a Stock Round, * taking all rules into account. ! * * @return List of buyable certificates. */ --- 127,131 ---- * Create a list of certificates that a player may buy in a Stock Round, * taking all rules into account. ! * * @return List of buyable certificates. */ *************** *** 279,283 **** * Create a list of certificates that a player may sell in a Stock Round, * taking all rules taken into account. ! * * @return List of sellable certificates. */ --- 269,273 ---- * Create a list of certificates that a player may sell in a Stock Round, * taking all rules taken into account. ! * * @return List of sellable certificates. */ *************** *** 444,448 **** /** * Start a company by buying one or more shares (more applies to e.g. 1841) ! * * @param player The player that wants to start a company. * @param company The company to start. --- 434,438 ---- /** * Start a company by buying one or more shares (more applies to e.g. 1841) ! * * @param player The player that wants to start a company. * @param company The company to start. *************** *** 542,546 **** // All is OK, now start the company company.start(startSpace); ! CashHolder priceRecipient = getSharePriceRecipient (cert, price); --- 532,536 ---- // All is OK, now start the company company.start(startSpace); ! CashHolder priceRecipient = getSharePriceRecipient (cert, price); *************** *** 560,564 **** playerName, companyName, Bank.format(price), Bank.format(shares * price), String.valueOf(shares), ! String.valueOf(cert.getShare()), priceRecipient.getName()})); ReportBuffer.getAllWaiting(); --- 550,554 ---- playerName, companyName, Bank.format(price), Bank.format(shares * price), String.valueOf(shares), ! String.valueOf(cert.getShare()), priceRecipient.getName()})); ReportBuffer.getAllWaiting(); *************** *** 580,584 **** * Buying one or more single or double-share certificates (more is sometimes * possible) ! * * @param player The player that wants to buy shares. * @param action The executed BuyCertificates action --- 570,574 ---- * Buying one or more single or double-share certificates (more is sometimes * possible) ! * * @param player The player that wants to buy shares. * @param action The executed BuyCertificates action *************** *** 708,712 **** CashHolder priceRecipient = getSharePriceRecipient (cert, cash); ! if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", new String[] { --- 698,702 ---- CashHolder priceRecipient = getSharePriceRecipient (cert, cash); ! if (number == 1) { ReportBuffer.add(LocalText.getText("BUY_SHARE_LOG", new String[] { *************** *** 732,740 **** cash, priceRecipient); } ! if (priceRecipient != from.getOwner()) { ReportBuffer.add(LocalText.getText("PriceIsPaidTo", new String[] { ! Bank.format(price * shares), priceRecipient.getName() })); --- 722,730 ---- cash, priceRecipient); } ! if (priceRecipient != from.getOwner()) { ReportBuffer.add(LocalText.getText("PriceIsPaidTo", new String[] { ! Bank.format(price * shares), priceRecipient.getName() })); *************** *** 764,776 **** } ! protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price, CashHolder priceRecipient) { ! cert.moveTo(newHolder); new CashMove (newHolder.getOwner(), priceRecipient, price); ! } ! /** * Who receives the cash when a certificate is bought. * With incremental capitalization, this can be the company treasure. --- 754,766 ---- } ! protected void executeTradeCertificate(Certificate cert, Portfolio newHolder, int price, CashHolder priceRecipient) { ! cert.moveTo(newHolder); new CashMove (newHolder.getOwner(), priceRecipient, price); ! } ! /** * Who receives the cash when a certificate is bought. * With incremental capitalization, this can be the company treasure. *************** *** 779,782 **** --- 769,773 ---- * @return */ + @Override protected CashHolder getSharePriceRecipient (Certificate cert, int price) { *************** *** 996,1000 **** otherPlayer.getPortfolio()); ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", ! new String[] { otherPlayer.getName(), company.getName() })); break; --- 987,991 ---- otherPlayer.getPortfolio()); ReportBuffer.add(LocalText.getText("IS_NOW_PRES_OF", ! new String[] { otherPlayer.getName(), company.getName() })); break; *************** *** 1033,1037 **** /** * The current Player passes or is done. ! * * @param player Name of the passing player. * @return False if an error is found. --- 1024,1028 ---- /** * The current Player passes or is done. ! * * @param player Name of the passing player. * @return False if an error is found. *************** *** 1135,1138 **** --- 1126,1130 ---- * @return The index of the player that has the turn. */ + @Override public int getCurrentPlayerIndex() { return currentPlayer.getIndex(); *************** *** 1141,1145 **** /** * Can the current player do any selling? ! * * @return True if any selling is allowed. */ --- 1133,1137 ---- /** * Can the current player do any selling? ! * * @return True if any selling is allowed. */ *************** *** 1157,1161 **** /** * Can the current player do any buying? ! * * @return True if any buying is allowed. */ --- 1149,1153 ---- /** * Can the current player do any buying? ! * * @return True if any buying is allowed. */ |