From: Erik V. <ev...@us...> - 2009-08-03 21:27:28
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23302/rails/game/specific/_1856 Modified Files: CGRFormationRound.java PublicCompany_1856.java Log Message: Make CGR have 10% shares if max. 10 shares are issued. Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CGRFormationRound.java 19 Jul 2009 19:24:21 -0000 1.8 --- CGRFormationRound.java 3 Aug 2009 21:27:19 -0000 1.9 *************** *** 391,396 **** log.info(cgrSharesUsed+" CGR shares are now in play"); // Move the remaining CGR shares to the ipo. ! // Must clone the list first certs = new ArrayList<PublicCertificateI>(unavailable.getCertificatesPerCompany("CGR")); for (PublicCertificateI cert : certs) { --- 391,408 ---- log.info(cgrSharesUsed+" CGR shares are now in play"); + + // If no more than 10 shares are in play, the CGR share + // unit becomes 10%; otherwise it stays 5%. + if (cgrSharesUsed <=10) { + ((PublicCompany_1856)cgr).setShareUnit (10); + // All superfluous shares have been removed + } + message = LocalText.getText("CompanyHasShares", + cgr.getName(), 100/cgr.getShareUnit(), cgr.getShareUnit()); + DisplayBuffer.add(message); + ReportBuffer.add(message); + // Move the remaining CGR shares to the ipo. ! // Clone the shares list first certs = new ArrayList<PublicCertificateI>(unavailable.getCertificatesPerCompany("CGR")); for (PublicCertificateI cert : certs) { Index: PublicCompany_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_1856.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PublicCompany_1856.java 4 May 2009 20:29:14 -0000 1.3 --- PublicCompany_1856.java 3 Aug 2009 21:27:19 -0000 1.4 *************** *** 1,5 **** --- 1,9 ---- package rails.game.specific._1856; + import java.util.ArrayList; + import java.util.List; + import rails.game.*; + import rails.game.move.MoveableHolderI; import rails.game.state.IntegerState; *************** *** 64,67 **** } ! } --- 68,102 ---- } ! public void setShareUnit (int percentage) { ! // Only allowed for CGR, the value must be 10 ! if (name.equalsIgnoreCase("CGR") && shareUnit.intValue() == 5 ! && percentage == 10) { ! shareUnit.set(percentage); ! // Drop the last 10 shares ! List<PublicCertificateI>certs = new ArrayList<PublicCertificateI>(certificates); ! int share = 0; ! MoveableHolderI scrapHeap = Bank.getScrapHeap(); ! for (PublicCertificateI cert : certs) { ! if (share >= 100) { ! cert.moveTo(scrapHeap); ! } else { ! share += cert.getShare(); ! } ! } ! ! // Update all owner ShareModels (once) ! // to have the UI get the correct percentage ! List<Portfolio> done = new ArrayList<Portfolio>(); ! Portfolio portfolio; ! for (PublicCertificateI cert : certificates) { ! portfolio = (Portfolio)cert.getHolder(); ! if (!done.contains(portfolio)) { ! portfolio.getShareModel(this).update(); ! done.add(portfolio); ! } ! } ! } ! ! } ! } |