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-08-28 20:24:48
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28789/rails/game Modified Files: Bank.java Log Message: Minor change in imports Index: Bank.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Bank.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Bank.java 28 Nov 2008 19:46:17 -0000 1.9 --- Bank.java 28 Aug 2009 20:24:39 -0000 1.10 *************** *** 1,5 **** package rails.game; ! import java.util.*; import org.apache.log4j.Logger; --- 1,5 ---- package rails.game; ! import java.util.List; import org.apache.log4j.Logger; *************** *** 64,68 **** /** * Central method for transferring all cash. ! * * @param from Who pays the money (null = Bank). * @param to Who received the money (null = Bank). --- 64,68 ---- /** * Central method for transferring all cash. ! * * @param from Who pays the money (null = Bank). * @param to Who received the money (null = Bank). *************** *** 162,168 **** if (cert.isInitiallyAvailable()) { ipo.addCertificate(cert); ! } else { unavailable.addCertificate(cert); ! } } } --- 162,168 ---- if (cert.isInitiallyAvailable()) { ipo.addCertificate(cert); ! } else { unavailable.addCertificate(cert); ! } } } *************** *** 256,260 **** /** * Get the maximum share percentage that may be sold to the Bank Pool. ! * * @return The maximum percentage. */ --- 256,260 ---- /** * Get the maximum share percentage that may be sold to the Bank Pool. ! * * @return The maximum percentage. */ |
From: Erik V. <ev...@us...> - 2009-08-05 20:55:21
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11579/rails/game/specific/_1856 Modified Files: PublicCompany_1856.java Log Message: CGR 5% to 10% share conversion made undoable Index: PublicCompany_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_1856.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PublicCompany_1856.java 4 Aug 2009 22:16:52 -0000 1.5 --- PublicCompany_1856.java 5 Aug 2009 20:55:05 -0000 1.6 *************** *** 6,9 **** --- 6,10 ---- import rails.game.*; import rails.game.move.MoveableHolderI; + import rails.game.move.RemoveFromList; import rails.game.state.IntegerState; *************** *** 80,84 **** if (share >= 100) { cert.moveTo(scrapHeap); ! certificates.remove(cert); } else { share += cert.getShare(); --- 81,85 ---- if (share >= 100) { cert.moveTo(scrapHeap); ! new RemoveFromList<PublicCertificateI>(certificates, cert, "CGR_Certs"); } else { share += cert.getShare(); |
From: Erik V. <ev...@us...> - 2009-08-04 22:17:03
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24644/rails/game/specific/_1856 Modified Files: PublicCompany_1856.java Log Message: Fix to CGR share% display Index: PublicCompany_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_1856.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PublicCompany_1856.java 3 Aug 2009 21:27:19 -0000 1.4 --- PublicCompany_1856.java 4 Aug 2009 22:16:52 -0000 1.5 *************** *** 80,83 **** --- 80,84 ---- if (share >= 100) { cert.moveTo(scrapHeap); + certificates.remove(cert); } else { share += cert.getShare(); *************** *** 92,96 **** portfolio = (Portfolio)cert.getHolder(); if (!done.contains(portfolio)) { ! portfolio.getShareModel(this).update(); done.add(portfolio); } --- 93,97 ---- portfolio = (Portfolio)cert.getHolder(); if (!done.contains(portfolio)) { ! portfolio.getShareModel(this).setShare(); done.add(portfolio); } |
From: Erik V. <ev...@us...> - 2009-08-03 21:27:35
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23302 Modified Files: LocalisedText.properties Log Message: Make CGR have 10% shares if max. 10 shares are issued. Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** LocalisedText.properties 14 Jul 2009 20:49:34 -0000 1.72 --- LocalisedText.properties 3 Aug 2009 21:27:19 -0000 1.73 *************** *** 86,89 **** --- 86,90 ---- CompanyDoesNotPayDividend={0} does not pay a dividend CompanyHasLoans={0} (president {1}) has {2} loans of {3}, total is {4} + CompanyHasShares={0} has {1} shares of {2}% each CompanyHasNoType=Company {0} has no type defined CompanyHasUnknownType=Company {0} has an undefined type {1} *************** *** 101,105 **** CompanyTypeHasNoClass=Company type {0} has no class defined. CompanyWithholds={0} withholds dividend of {1}. ! ComponentConfiguredTwice=Compinent {0} is configured twice. ComponentHasNoClass=Component {0} has no class defined. ComponentInitAs=Component {0} is initialized as class {1} --- 102,106 ---- CompanyTypeHasNoClass=Company type {0} has no class defined. CompanyWithholds={0} withholds dividend of {1}. ! ComponentConfiguredTwice=Component {0} is configured twice. ComponentHasNoClass=Component {0} has no class defined. ComponentInitAs=Component {0} is initialized as class {1} |
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); ! } ! } ! } ! ! } ! } |
From: Erik V. <ev...@us...> - 2009-08-03 21:27:28
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23302/rails/game Modified Files: PublicCompany.java Log Message: Make CGR have 10% shares if max. 10 shares are issued. Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PublicCompany.java 4 May 2009 20:29:14 -0000 1.49 --- PublicCompany.java 3 Aug 2009 21:27:19 -0000 1.50 *************** *** 175,179 **** /** What percentage of ownership constitutes "one share" */ ! protected int shareUnit = DEFAULT_SHARE_UNIT; /** At what percentage sold does the company float */ --- 175,179 ---- /** What percentage of ownership constitutes "one share" */ ! protected IntegerState shareUnit; /** At what percentage sold does the company float */ *************** *** 265,270 **** Tag shareUnitTag = tag.getChild("ShareUnit"); if (shareUnitTag != null) { ! shareUnit = ! shareUnitTag.getAttributeAsInteger("percentage", shareUnit); } --- 265,270 ---- Tag shareUnitTag = tag.getChild("ShareUnit"); if (shareUnitTag != null) { ! shareUnit = new IntegerState (name+"_ShareUnit", ! shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT)); } *************** *** 476,480 **** certIsInitiallyAvailable); addCertificate(certificate); ! shareTotal += shares * shareUnit; } } --- 476,480 ---- certIsInitiallyAvailable); addCertificate(certificate); ! shareTotal += shares * shareUnit.intValue(); } } *************** *** 629,632 **** --- 629,636 ---- } + + if (shareUnit == null) { + shareUnit = new IntegerState (name+"_ShareUnit", DEFAULT_SHARE_UNIT); + } // Give each certificate an unique Id *************** *** 1156,1160 **** for (PublicCertificateI cert : certificates) { CashHolder recipient = getBeneficiary(cert); ! part = amount * cert.getShares() * shareUnit / 100; // For reporting, we want to add up the amounts per recipient if (split.containsKey(recipient)) { --- 1160,1164 ---- for (PublicCertificateI cert : certificates) { CashHolder recipient = getBeneficiary(cert); ! part = amount * cert.getShares() * shareUnit.intValue() / 100; // For reporting, we want to add up the amounts per recipient if (split.containsKey(recipient)) { *************** *** 1237,1241 **** */ public int getShareUnit() { ! return shareUnit; } --- 1241,1245 ---- */ public int getShareUnit() { ! return shareUnit.intValue(); } *************** *** 1378,1382 **** public int getNumberOfShares() { ! return 100 / shareUnit; } --- 1382,1386 ---- public int getNumberOfShares() { ! return 100 / shareUnit.intValue(); } |
From: Erik V. <ev...@us...> - 2009-08-03 21:26:35
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23258/rails/game/action Modified Files: ExchangeTokens.java Log Message: Removed unused imports Index: ExchangeTokens.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/ExchangeTokens.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExchangeTokens.java 4 May 2009 20:29:15 -0000 1.1 --- ExchangeTokens.java 3 Aug 2009 21:26:20 -0000 1.2 *************** *** 8,17 **** import java.io.IOException; import java.io.ObjectInputStream; - import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import rails.game.*; - /** * @author Erik Vos --- 8,14 ---- |
From: Erik V. <ev...@us...> - 2009-07-19 19:24:28
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10234/rails/ui/swing Modified Files: ORWindow.java Log Message: Fixes to CGR formation. Consistent use of the new Round.finishRound() method. Index: ORWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORWindow.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ORWindow.java 4 Feb 2009 20:36:40 -0000 1.23 --- ORWindow.java 19 Jul 2009 19:24:21 -0000 1.24 *************** *** 158,162 **** String numORs = gameManager.getNumOfORs (); ! 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, |
From: Erik V. <ev...@us...> - 2009-07-19 19:24:28
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1851 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10234/rails/game/specific/_1851 Modified Files: StartRound_1851.java Log Message: Fixes to CGR formation. Consistent use of the new Round.finishRound() method. Index: StartRound_1851.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1851/StartRound_1851.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** StartRound_1851.java 23 Dec 2008 19:59:06 -0000 1.7 --- StartRound_1851.java 19 Jul 2009 19:24:21 -0000 1.8 *************** *** 37,41 **** * ultimately be possible. */ ! gameManager.nextRound(this); } --- 37,42 ---- * ultimately be possible. */ ! //gameManager.nextRound(this); ! finishRound(); } |
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10234/rails/game Modified Files: StartRound_1830.java Round.java StartRound_1835.java StartRound.java RoundI.java OperatingRound.java Log Message: Fixes to CGR formation. Consistent use of the new Round.finishRound() method. Index: StartRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** StartRound.java 15 Jan 2009 20:53:28 -0000 1.24 --- StartRound.java 19 Jul 2009 19:24:21 -0000 1.25 *************** *** 137,141 **** */ possibleActions.clear(); ! gameManager.nextRound(this); } else if (!setPossibleActions()) { /* --- 137,142 ---- */ possibleActions.clear(); ! //gameManager.nextRound(this); ! finishRound(); } else if (!setPossibleActions()) { /* *************** *** 145,149 **** * ultimately be possible. */ ! gameManager.nextRound(this); } --- 146,151 ---- * ultimately be possible. */ ! //gameManager.nextRound(this); ! finishRound(); } Index: RoundI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/RoundI.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RoundI.java 4 Feb 2009 20:36:39 -0000 1.10 --- RoundI.java 19 Jul 2009 19:24:21 -0000 1.11 *************** *** 25,27 **** --- 25,28 ---- public boolean setPossibleActions(); + public boolean wasInterrupted (); } Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Round.java 14 Jul 2009 20:49:34 -0000 1.18 --- Round.java 19 Jul 2009 19:24:21 -0000 1.19 *************** *** 17,20 **** --- 17,21 ---- import rails.game.move.MoveSet; import rails.game.special.SpecialPropertyI; + import rails.game.state.BooleanState; import rails.util.LocalText; *************** *** 33,36 **** --- 34,38 ---- protected Class<? extends RoundI> roundTypeForUI = null; + protected BooleanState wasInterrupted = new BooleanState ("RoundInterrupted", false); /** Default constructor cannot be used */ *************** *** 324,327 **** --- 326,333 ---- gameManager.nextRound(this); } + + public boolean wasInterrupted () { + return wasInterrupted.booleanValue(); + } @Override Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** OperatingRound.java 17 Jul 2009 21:40:39 -0000 1.60 --- OperatingRound.java 19 Jul 2009 19:24:21 -0000 1.61 *************** *** 176,180 **** ReportBuffer.add(text); DisplayBuffer.add(text); ! gameManager.nextRound(this); } --- 176,181 ---- ReportBuffer.add(text); DisplayBuffer.add(text); ! //gameManager.nextRound(this); ! finishRound(); } *************** *** 1199,1203 **** // OR done. Inform GameManager. ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber)); ! gameManager.nextRound(this); } --- 1200,1205 ---- // OR done. Inform GameManager. ReportBuffer.add(LocalText.getText("EndOfOperatingRound", thisOrNumber)); ! //gameManager.nextRound(this); ! finishRound(); } *************** *** 1404,1407 **** --- 1406,1410 ---- } savedAction = null; + wasInterrupted.set(true); } Index: StartRound_1830.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1830.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** StartRound_1830.java 15 Jan 2009 20:53:28 -0000 1.18 --- StartRound_1830.java 19 Jul 2009 19:24:21 -0000 1.19 *************** *** 335,339 **** } else { numPasses.set(0); ! gameManager.nextRound(this); } --- 335,340 ---- } else { numPasses.set(0); ! //gameManager.nextRound(this); ! finishRound(); } Index: StartRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1835.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** StartRound_1835.java 15 Jan 2009 20:53:28 -0000 1.19 --- StartRound_1835.java 19 Jul 2009 19:24:21 -0000 1.20 *************** *** 50,54 **** * ultimately be possible. */ ! gameManager.nextRound(this); } --- 50,55 ---- * ultimately be possible. */ ! //gameManager.nextRound(this); ! finishRound(); } *************** *** 249,253 **** ReportBuffer.add(LocalText.getText("ALL_PASSED")); numPasses.set(0); ! gameManager.nextRound(this); } else { setNextPlayer(); --- 250,255 ---- ReportBuffer.add(LocalText.getText("ALL_PASSED")); numPasses.set(0); ! //gameManager.nextRound(this); ! finishRound(); } else { setNextPlayer(); |
From: Erik V. <ev...@us...> - 2009-07-19 19:24:24
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10234/rails/game/specific/_1856 Modified Files: CGRFormationRound.java OperatingRound_1856.java Log Message: Fixes to CGR formation. Consistent use of the new Round.finishRound() method. Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CGRFormationRound.java 19 Jul 2009 16:12:24 -0000 1.7 --- CGRFormationRound.java 19 Jul 2009 19:24:21 -0000 1.8 *************** *** 605,609 **** setStep (STEP_EXCHANGE_TOKENS); } else { ! gameManager.nextRound(this); } } --- 605,610 ---- setStep (STEP_EXCHANGE_TOKENS); } else { ! //gameManager.nextRound(this); ! finishRound(); } } *************** *** 623,627 **** if (checkForTrainsToDiscard()) return true; ! gameManager.nextRound(this); } --- 624,629 ---- if (checkForTrainsToDiscard()) return true; ! //gameManager.nextRound(this); ! finishRound(); } Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** OperatingRound_1856.java 17 Jul 2009 21:40:39 -0000 1.11 --- OperatingRound_1856.java 19 Jul 2009 19:24:21 -0000 1.12 *************** *** 440,443 **** --- 440,444 ---- finishOR(); } + wasInterrupted.set(true); } else { super.resume(); |
From: Erik V. <ev...@us...> - 2009-07-19 16:12:29
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24122/rails/game/specific/_1856 Modified Files: CGRFormationRound.java Log Message: Fixes to CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CGRFormationRound.java 17 Jul 2009 21:40:39 -0000 1.6 --- CGRFormationRound.java 19 Jul 2009 16:12:24 -0000 1.7 *************** *** 604,607 **** --- 604,609 ---- formCGR(); setStep (STEP_EXCHANGE_TOKENS); + } else { + gameManager.nextRound(this); } } |
From: Erik V. <ev...@us...> - 2009-07-17 21:40:53
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21046/rails/game Modified Files: OperatingRound.java Log Message: Fixes to CGR formation Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** OperatingRound.java 14 Jul 2009 20:49:34 -0000 1.59 --- OperatingRound.java 17 Jul 2009 21:40:39 -0000 1.60 *************** *** 2074,2078 **** for (int j = 0; j < operatingCompanyArray.length; j++) { c = operatingCompanyArray[j]; ! if (c == operatingCompany) continue; p = c.getPresident(); index = p.getIndex(); --- 2074,2078 ---- for (int j = 0; j < operatingCompanyArray.length; j++) { c = operatingCompanyArray[j]; ! if (c.isClosed() || c == operatingCompany) continue; p = c.getPresident(); index = p.getIndex(); |
From: Erik V. <ev...@us...> - 2009-07-17 21:40:42
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv21046/rails/game/specific/_1856 Modified Files: CGRFormationRound.java OperatingRound_1856.java Log Message: Fixes to CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CGRFormationRound.java 14 Jul 2009 20:49:33 -0000 1.5 --- CGRFormationRound.java 17 Jul 2009 21:40:39 -0000 1.6 *************** *** 81,88 **** setCurrentPlayer (startingPlayer); ! if (!setNextCompanyNeedingPresidentIntervention()) { ! finishRound(); ! return; ! } } --- 81,85 ---- setCurrentPlayer (startingPlayer); ! process (null); } *************** *** 587,591 **** public boolean process (PossibleAction action) { ! boolean result = false; if (action instanceof RepayLoans) { --- 584,588 ---- public boolean process (PossibleAction action) { ! boolean result = true; if (action instanceof RepayLoans) { Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** OperatingRound_1856.java 14 Jul 2009 20:49:33 -0000 1.10 --- OperatingRound_1856.java 17 Jul 2009 21:40:39 -0000 1.11 *************** *** 464,468 **** if (company.isClosed()) { if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! it.remove(); } } --- 464,468 ---- if (company.isClosed()) { if (index <= lastOperatingCompanyIndex) cgrCanOperate = false; ! //it.remove(); } } |
From: Erik V. <ev...@us...> - 2009-07-14 20:49:47
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9599 Modified Files: LocalisedText.properties Log Message: Fixes to CGR formation Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** LocalisedText.properties 12 Jul 2009 21:06:18 -0000 1.71 --- LocalisedText.properties 14 Jul 2009 20:49:34 -0000 1.72 *************** *** 115,118 **** --- 115,119 ---- DiscardTrain=Discard {0}-train DoesNotExist=Item does not exist + DoesNotForm={0} does not form DoesNotHaveTheShares=Does not have the shares Done=Done |
From: Erik V. <ev...@us...> - 2009-07-14 20:49:44
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9599/rails/game Modified Files: Round.java StockRound.java OperatingRound.java Log Message: Fixes to CGR formation Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** OperatingRound.java 12 Jul 2009 21:06:18 -0000 1.58 --- OperatingRound.java 14 Jul 2009 20:49:34 -0000 1.59 *************** *** 955,958 **** --- 955,959 ---- protected void initTurn() { + System.out.println("---Starting turn of "+operatingCompany.getName()); setCurrentPlayer(operatingCompany.getPresident()); operatingCompany.initTurn(); Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Round.java 4 May 2009 20:29:14 -0000 1.17 --- Round.java 14 Jul 2009 20:49:34 -0000 1.18 *************** *** 319,322 **** --- 319,327 ---- } } + + protected void finishRound() { + // Inform GameManager + gameManager.nextRound(this); + } @Override Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** StockRound.java 4 May 2009 20:29:14 -0000 1.36 --- StockRound.java 14 Jul 2009 20:49:34 -0000 1.37 *************** *** 1137,1145 **** } - protected void finishRound() { - // Inform GameManager - gameManager.nextRound(this); - } - /*----- METHODS TO BE CALLED TO SET UP THE NEXT TURN -----*/ --- 1137,1140 ---- |
From: Erik V. <ev...@us...> - 2009-07-14 20:49:37
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9599/rails/game/specific/_1856 Modified Files: CGRFormationRound.java OperatingRound_1856.java Log Message: Fixes to CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CGRFormationRound.java 12 Jul 2009 21:06:18 -0000 1.4 --- CGRFormationRound.java 14 Jul 2009 20:49:33 -0000 1.5 *************** *** 71,74 **** --- 71,79 ---- } } + + if (companiesToRepayLoans == null) { + finishRound(); + return; + } setStep(STEP_REPAY_LOANS); *************** *** 76,80 **** setCurrentPlayer (startingPlayer); ! setNextCompanyNeedingPresidentIntervention(); } --- 81,88 ---- setCurrentPlayer (startingPlayer); ! if (!setNextCompanyNeedingPresidentIntervention()) { ! finishRound(); ! return; ! } } Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** OperatingRound_1856.java 4 May 2009 20:29:14 -0000 1.9 --- OperatingRound_1856.java 14 Jul 2009 20:49:33 -0000 1.10 *************** *** 458,462 **** PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); int index = 0; ! boolean cgrCanOperate = true; for (Iterator<PublicCompanyI> it = companies.iterator(); it.hasNext(); ) { --- 458,462 ---- PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); int index = 0; ! boolean cgrCanOperate = cgr.hasStarted(); for (Iterator<PublicCompanyI> it = companies.iterator(); it.hasNext(); ) { *************** *** 477,487 **** String message; ! if (cgrCanOperate) { ! operatingCompanyIndex = Math.max (0, operatingCompanyIndex); ! companies.add(operatingCompanyIndex, cgr); ! operatingCompany = cgr; ! message = LocalText.getText("CanOperate", cgr.getName()); } else { ! message = LocalText.getText("CannotOperate", cgr.getName()); } ReportBuffer.add (message); --- 477,491 ---- String message; ! if (cgr.hasStarted()) { ! if (cgrCanOperate) { ! operatingCompanyIndex = Math.max (0, operatingCompanyIndex); ! companies.add(operatingCompanyIndex, cgr); ! operatingCompany = cgr; ! message = LocalText.getText("CanOperate", cgr.getName()); ! } else { ! message = LocalText.getText("CannotOperate", cgr.getName()); ! } } else { ! message = LocalText.getText("DoesNotForm", cgr.getName()); } ReportBuffer.add (message); |
From: Erik V. <ev...@us...> - 2009-07-12 21:46:27
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24531/rails/game/specific/_1856 Modified Files: CGRFormationRound.java Log Message: Fixes to CGR formation Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CGRFormationRound.java 24 May 2009 18:44:40 -0000 1.3 --- CGRFormationRound.java 12 Jul 2009 21:06:18 -0000 1.4 *************** *** 456,460 **** if (otherTokens != null) { for (BaseToken token2 : otherTokens) { ! if (token2.getCompany() == cgr) { ReportBuffer.add(LocalText.getText("DiscardsBaseToken", cgrName, token.getCompany().getName(), --- 456,461 ---- if (otherTokens != null) { for (BaseToken token2 : otherTokens) { ! if (token2.getCompany() == cgr ! || nonHomeTokens.contains(token2) && token2 != token) { ReportBuffer.add(LocalText.getText("DiscardsBaseToken", cgrName, token.getCompany().getName(), |
From: Erik V. <ev...@us...> - 2009-07-12 21:46:21
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24531/rails/game Modified Files: OperatingRound.java Log Message: Fixes to CGR formation Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** OperatingRound.java 4 May 2009 20:29:14 -0000 1.57 --- OperatingRound.java 12 Jul 2009 21:06:18 -0000 1.58 *************** *** 186,189 **** --- 186,190 ---- boolean result = false; + doneAllowed = false; /*--- Common OR checks ---*/ *************** *** 1738,1741 **** --- 1739,1744 ---- if (repayment > 0) executeRepayLoans (action); + + doneAllowed = true; return true; *************** *** 1850,1854 **** possibleActions.clear(); selectedAction = null; - doneAllowed = false; int step = getStep(); --- 1853,1856 ---- |
From: Erik V. <ev...@us...> - 2009-07-12 21:06:30
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24531 Modified Files: LocalisedText.properties Log Message: Fixes to CGR formation Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** LocalisedText.properties 24 May 2009 18:45:15 -0000 1.70 --- LocalisedText.properties 12 Jul 2009 21:06:18 -0000 1.71 *************** *** 209,213 **** MAP=Map MapWindowTitle=Rails: Map ! MapWindowORTitle=Rails: Map, Operating Round {0} or {1} MARKET=Stock Market MayDiscardTrain={0} may voluntarily discard a train --- 209,213 ---- MAP=Map MapWindowTitle=Rails: Map ! MapWindowORTitle=Rails: Map, Operating Round {0} of {1} MARKET=Stock Market MayDiscardTrain={0} may voluntarily discard a train |
From: Erik V. <ev...@us...> - 2009-05-24 18:45:27
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20723 Modified Files: LocalisedText.properties Log Message: Added message to start merged company Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** LocalisedText.properties 4 May 2009 20:29:15 -0000 1.69 --- LocalisedText.properties 24 May 2009 18:45:15 -0000 1.70 *************** *** 331,334 **** --- 331,335 ---- SRHelpText=Stock round help text goes here. START_COMPANY={0} starts {1} at {2}. + START_MERGED_COMPANY={0} starts at {1} ({2}) START_COMPANY_LOG={0} starts {1} at {2} and pays {3} for {4} shares ({5}%) to {6} StartACompany=Start {0} by buying a {1}% share for {2} |
From: Erik V. <ev...@us...> - 2009-05-24 18:44:51
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20632/rails/game/specific/_1856 Modified Files: CGRFormationRound.java Log Message: Implemented correct CGR start price Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CGRFormationRound.java 4 May 2009 20:29:14 -0000 1.2 --- CGRFormationRound.java 24 May 2009 18:44:40 -0000 1.3 *************** *** 494,504 **** executeExchangeTokens (nonHomeTokens); } ! ! // Close the absorbed companies and float the CGR for (PublicCompanyI comp : mergingCompanies) { comp.setClosed(); } ! cgr.start(100); // TODO: assign correct starting price cgr.setFloated(); // Check the trains, autodiscard any excess non-permanent trains --- 494,544 ---- executeExchangeTokens (nonHomeTokens); } ! ! // 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, ((int)((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 |
From: Erik V. <ev...@us...> - 2009-05-24 18:44:31
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20593/rails/game/specific/_1856 Modified Files: GameUIManager_1856.java Log Message: Removed outcommented code Index: GameUIManager_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/GameUIManager_1856.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameUIManager_1856.java 4 May 2009 20:29:14 -0000 1.1 --- GameUIManager_1856.java 24 May 2009 18:44:20 -0000 1.2 *************** *** 1,17 **** package rails.game.specific._1856; - import rails.game.action.PossibleActions; - import rails.ui.swing.ActionPerformer; import rails.ui.swing.GameUIManager; public class GameUIManager_1856 extends GameUIManager { - /* - protected void updateStatus(ActionPerformer activeWindow) { - - PossibleActions possibleActions = PossibleActions.getInstance(); - - } - */ } --- 1,8 ---- |
From: Erik V. <ev...@us...> - 2009-05-04 20:29:32
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29969/rails/game/specific/_1856 Modified Files: CGRFormationRound.java PublicCompany_1856.java OperatingRound_1856.java Added Files: GameUIManager_1856.java Log Message: 1856 CGR formation round --- NEW FILE: GameUIManager_1856.java --- package rails.game.specific._1856; import rails.game.action.PossibleActions; import rails.ui.swing.ActionPerformer; import rails.ui.swing.GameUIManager; public class GameUIManager_1856 extends GameUIManager { /* protected void updateStatus(ActionPerformer activeWindow) { PossibleActions possibleActions = PossibleActions.getInstance(); } */ } Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OperatingRound_1856.java 4 Feb 2009 20:36:39 -0000 1.8 --- OperatingRound_1856.java 4 May 2009 20:29:14 -0000 1.9 *************** *** 2,5 **** --- 2,7 ---- import java.util.ArrayList; + import java.util.Arrays; + import java.util.Iterator; import java.util.List; *************** *** 432,436 **** // End of CGRFormationRound finalLoanRepaymentPending.set(false); ! if (setNextOperatingCompany(false)) { setStep(STEP_INITIAL); } else { --- 434,439 ---- // End of CGRFormationRound finalLoanRepaymentPending.set(false); ! resetOperatingCompanies(); ! if (operatingCompany != null) { setStep(STEP_INITIAL); } else { *************** *** 442,445 **** --- 445,496 ---- } + 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 = true; + 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); + } + + for (PublicCompanyI c : companies) { + log.debug("Now operating: "+c.getName()); + } + + String message; + if (cgrCanOperate) { + operatingCompanyIndex = Math.max (0, operatingCompanyIndex); + companies.add(operatingCompanyIndex, cgr); + operatingCompany = cgr; + message = LocalText.getText("CanOperate", cgr.getName()); + } else { + message = LocalText.getText("CannotOperate", cgr.getName()); + } + ReportBuffer.add (message); + DisplayBuffer.add(message); + + operatingCompanyArray = companies.toArray(new PublicCompanyI[0]); + operatingCompanyIndexObject.set(operatingCompanyIndex); + + log.debug ("Next operating company: "+operatingCompany.getName()); + } @Override Index: PublicCompany_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_1856.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PublicCompany_1856.java 24 Jan 2009 15:10:29 -0000 1.2 --- PublicCompany_1856.java 4 May 2009 20:29:14 -0000 1.3 *************** *** 1,7 **** package rails.game.specific._1856; ! import rails.game.PublicCompany; ! import rails.game.StockSpaceI; ! import rails.game.TrainI; import rails.game.state.IntegerState; --- 1,5 ---- package rails.game.specific._1856; ! import rails.game.*; import rails.game.state.IntegerState; *************** *** 9,23 **** private IntegerState trainNumberAvailableAtStart; ! private IntegerState moneyInEscrow; ! public void start(StockSpaceI startSpace) { ! super.start(startSpace); ! ! TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); int trainNumber; ! try { trainNumber = Integer.parseInt(nextAvailableTrain.getName()); } catch (NumberFormatException e) { --- 7,25 ---- private IntegerState trainNumberAvailableAtStart; ! private IntegerState moneyInEscrow; ! ! /** Used for CGR */ ! private boolean hadPermanentTrain = false; ! ! @Override public void start(StockSpaceI startSpace) { ! super.start(startSpace); ! ! TrainI nextAvailableTrain = gameManager.getTrainManager().getAvailableNewTrains().get(0); int trainNumber; ! try { trainNumber = Integer.parseInt(nextAvailableTrain.getName()); } catch (NumberFormatException e) { *************** *** 27,43 **** = new IntegerState (name+"_trainAtStart"); trainNumberAvailableAtStart.set(trainNumber); ! if (trainNumber == 6) { this.capitalisation = CAPITALISE_FULL; } ! moneyInEscrow = new IntegerState (name+"_moneyInEscrow", 0); } ! public int getTrainNumberAvailableAtStart () { return trainNumberAvailableAtStart.intValue(); } ! public void setMoneyInEscrow (int amount) { moneyInEscrow.set(amount); --- 29,45 ---- = new IntegerState (name+"_trainAtStart"); trainNumberAvailableAtStart.set(trainNumber); ! if (trainNumber == 6) { this.capitalisation = CAPITALISE_FULL; } ! moneyInEscrow = new IntegerState (name+"_moneyInEscrow", 0); } ! public int getTrainNumberAvailableAtStart () { return trainNumberAvailableAtStart.intValue(); } ! public void setMoneyInEscrow (int amount) { moneyInEscrow.set(amount); *************** *** 47,53 **** moneyInEscrow.add(amount); } ! public int getMoneyInEscrow () { return moneyInEscrow.intValue(); } } --- 49,67 ---- moneyInEscrow.add(amount); } ! public int getMoneyInEscrow () { return moneyInEscrow.intValue(); } + + public boolean hadPermanentTrain() { + return hadPermanentTrain; + } + + @Override + public void buyTrain(TrainI train, int price) { + super.buyTrain (train, price); + if (train.getType().isPermanent()) hadPermanentTrain = true; + } + + } Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CGRFormationRound.java 4 Feb 2009 20:36:39 -0000 1.1 --- CGRFormationRound.java 4 May 2009 20:29:14 -0000 1.2 *************** *** 4,18 **** import rails.game.*; ! import rails.game.action.RepayLoans; import rails.game.move.CashMove; import rails.util.LocalText; ! public class CGRFormationRound extends OperatingRound { ! /* This isn't really a stock round, but it must subclass one of the ! * three base types, otherwise the not-subclassable GameUIManager ! * cannot handle it. StockRound has been chosen because the UI ! * should show the StatusWindow. ! */ private Player startingPlayer; --- 4,17 ---- import rails.game.*; ! import rails.game.action.*; import rails.game.move.CashMove; + import rails.game.move.MoveSet; + import rails.game.state.IntegerState; import rails.util.LocalText; ! public class CGRFormationRound extends SwitchableUIRound { ! ! private final String CGRNAME = "CGR"; private Player startingPlayer; *************** *** 21,24 **** --- 20,35 ---- 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; + private boolean forcedTrainDiscard = true; + private List<ExchangeableToken> tokensToExchangeFrom = null; + private List<BaseToken> nonHomeTokens = null; + + private IntegerState stepObject = new IntegerState ("CGRFormStep", 0); + + public static final int STEP_REPAY_LOANS = 1; + public static final int STEP_DISCARD_TRAINS = 2; + public static final int STEP_EXCHANGE_TOKENS = 3; public CGRFormationRound (GameManagerI gameManager) { *************** *** 32,35 **** --- 43,47 ---- public Class<? extends RoundI> getRoundTypeForUI () { return StockRound.class; + //return OperatingRound.class; } *************** *** 60,67 **** --- 72,89 ---- } + setStep(STEP_REPAY_LOANS); + setCurrentPlayer (startingPlayer); setNextCompanyNeedingPresidentIntervention(); } + + private void setStep(int step) { + stepObject.set(step); + } + + private int getStep() { + return stepObject.intValue(); + } private boolean setNextCompanyNeedingPresidentIntervention () { *************** *** 164,181 **** public boolean setPossibleActions() { ! RepayLoans action = new RepayLoans (currentCompany, 0, ! maxLoansToRepayByPresident, ! currentCompany.getValuePerLoan()); ! possibleActions.add(action); ! operatingCompany = currentCompany; return true; } - @Override protected boolean repayLoans (RepayLoans action) { ! boolean result = super.repayLoans(action); ! if (action.getCompany().getCurrentNumberOfLoans() > 0) { mergingCompanies.add(currentCompany); String message = LocalText.getText("WillMergeInto", --- 186,252 ---- public boolean setPossibleActions() { ! int step = getStep(); ! if (step == STEP_REPAY_LOANS) { ! RepayLoans action = new RepayLoans (currentCompany, 0, ! maxLoansToRepayByPresident, ! currentCompany.getValuePerLoan()); ! possibleActions.add(action); ! roundTypeForUI = StockRound_1856.class; ! } else if (step == STEP_EXCHANGE_TOKENS) { ! int numberToExchange = cgr.getNumberOfFreeBaseTokens(); ! ExchangeTokens action = new ExchangeTokens (tokensToExchangeFrom, ! numberToExchange, numberToExchange); ! action.setCompany(cgr); ! possibleActions.add(action); ! roundTypeForUI = OperatingRound_1856.class; ! } else if (step == STEP_DISCARD_TRAINS) { ! DiscardTrain action = new DiscardTrain (cgr, ! trainsToDiscardFrom, forcedTrainDiscard); ! possibleActions.add(action); ! roundTypeForUI = OperatingRound_1856.class; ! } return true; } protected boolean repayLoans (RepayLoans action) { + + // TODO Validation skipped for now... ! MoveSet.start(true); ! ! PublicCompanyI company = action.getCompany(); ! int numberRepaid = action.getNumberRepaid(); ! int repayment = numberRepaid * company.getValuePerLoan(); ! ! if (repayment > 0) { ! ! int repaymentByCompany = Math.min (repayment, company.getCash()); ! int repaymentByPresident = repayment - repaymentByCompany; ! ! company.addLoans(-numberRepaid); ! if (repaymentByCompany > 0) { ! new CashMove (company, null, repaymentByCompany); ! ReportBuffer.add (LocalText.getText("CompanyRepaysLoans", ! company.getName(), ! Bank.format(repaymentByCompany), ! Bank.format(repayment), ! numberRepaid, ! Bank.format(company.getValuePerLoan()))); ! } ! if (repaymentByPresident > 0) { ! Player president = company.getPresident(); ! new CashMove (president, null, repaymentByPresident); ! ReportBuffer.add (LocalText.getText("CompanyRepaysLoansWithPresCash", ! company.getName(), ! Bank.format(repaymentByPresident), ! Bank.format(repayment), ! numberRepaid, ! Bank.format(company.getValuePerLoan()), ! president.getName())); ! } ! } ! ! if (action.getCompany().getCurrentNumberOfLoans() > 0) { mergingCompanies.add(currentCompany); String message = LocalText.getText("WillMergeInto", *************** *** 184,197 **** DisplayBuffer.add(message, true); ReportBuffer.add(message); } ! if (!setNextCompanyNeedingPresidentIntervention()) { gameManager.nextRound(this); } ! return result; } --- 255,680 ---- DisplayBuffer.add(message, true); ReportBuffer.add(message); + + } + + return true; + + } + + private void formCGR () { + + Player player; + Portfolio portfolio; + int count, cgrSharesUsed, oldShares, newShares; + PublicCertificateI cgrCert, poolCert; + List<PublicCertificateI> certs = new ArrayList<PublicCertificateI>(); + Portfolio scrapHeap = Bank.getScrapHeap(); + Portfolio pool = Bank.getPool(); + Portfolio unavailable = Bank.getUnavailable(); + Portfolio ipo = Bank.getIpo(); + Player temporaryPresident = null; + Player newPresident = null; + Player firstCGRowner = null; + int maxShares = 0; + + // Exchange the player shares + setCurrentPlayer(startingPlayer); + cgrSharesUsed = 0; + + do { + player = getCurrentPlayer(); + portfolio = player.getPortfolio(); + oldShares = newShares = 0; + certs.clear(); + poolCert = null; + + for (PublicCertificateI cert : player.getPortfolio().getCertificates()) { + if (mergingCompanies.contains(cert.getCompany())) { + certs.add((cert)); + oldShares++; + if (cert.isPresidentShare()) { + oldShares++; + } + } + } + if (oldShares > 0) { + + count = oldShares; + if (count >= 4 && temporaryPresident == null && cgrSharesUsed <= 18) { + cgrCert = cgr.getPresidentsShare(); + cgrCert.moveTo(portfolio); + count -= 4; + cgrSharesUsed += 2; + newShares += 2; + temporaryPresident = player; + } + while (count >= 2 && cgrSharesUsed <= 19) { + cgrCert = unavailable.findCertificate(cgr, false); + cgrCert.moveTo(portfolio); + count -= 2; + cgrSharesUsed++; + newShares++; + } + + String message = LocalText.getText("HasMergedShares", + player.getName(), + oldShares, + newShares, + "CGR"); + DisplayBuffer.add(message, false); + ReportBuffer.add(message); + + if (count == 1) { + // Should work OK even if this is a president's share. + // In the pool we will treat all certs equally. + poolCert = certs.get(certs.size()-1); + poolCert.moveTo(pool); + certs.remove(poolCert); + + message = LocalText.getText("HasPutShareInPool", + player.getName()); + DisplayBuffer.add(message, false); + ReportBuffer.add(message); + + } + // Note: old shares are removed when company is closed + + if (firstCGRowner == null) firstCGRowner = player; + + // Check for presidency + if (newShares > maxShares) { + maxShares = newShares; + newPresident = player; + } + } + + gameManager.setNextPlayer(); + + } while (getCurrentPlayer() != startingPlayer); + + // Exchange the pool shares + certs.clear(); + oldShares = newShares = 0; + + for (PublicCertificateI cert : pool.getCertificates()) { + if (mergingCompanies.contains(cert.getCompany())) { + certs.add((cert)); + oldShares++; + } + } + count = oldShares; + while (count >= 2 && cgrSharesUsed <= 19) { + cgrCert = unavailable.findCertificate(cgr, false); + cgrCert.moveTo(pool); + count -= 2; + cgrSharesUsed++; + newShares++; } ! String message = LocalText.getText("HasMergedShares", ! LocalText.getText("POOL"), ! oldShares, ! newShares, ! "CGR"); ! DisplayBuffer.add(message); ! ReportBuffer.add(message); ! ! for (PublicCertificateI discardCert : certs) { ! discardCert.moveTo(scrapHeap); ! } ! ! 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) { ! cert.moveTo(ipo); ! } ! ! // Assign the new president ! if (temporaryPresident != newPresident) { ! temporaryPresident.getPortfolio().swapPresidentCertificate(cgr, ! newPresident.getPortfolio()); ! } ! ! newPresident.getPortfolio().getShareModel(cgr).setShare(); ! message = LocalText.getText("IS_NOW_PRES_OF", ! newPresident.getName(), cgrName); ! ReportBuffer.add(message); ! DisplayBuffer.add(message); ! ! // Collect the old token spots, and move cash and trains ! List<BaseToken> homeTokens = new ArrayList<BaseToken>(); ! nonHomeTokens = new ArrayList<BaseToken>(); ! BaseToken bt; ! MapHex hex; ! City city; ! for (PublicCompanyI comp : mergingCompanies) { ! for (TokenI token :comp.getTokens()) { ! if (token instanceof BaseToken) { ! bt = (BaseToken) token; ! if (!bt.isPlaced()) continue; ! city = (City) bt.getHolder(); ! hex = city.getHolder(); ! if (hex == comp.getHomeHex()) { ! homeTokens.add(bt); ! } else { ! nonHomeTokens.add(bt); ! } ! } ! } ! ! if (comp.getCash() > 0) { ! new CashMove (comp, cgr, comp.getCash()); ! } ! List<TrainI> trains = new ArrayList<TrainI> (comp.getPortfolio().getTrainList()); ! for (TrainI train : trains) { ! train.moveTo(cgr.getPortfolio()); ! } ! } ! ! // Replace the home tokens ! for (BaseToken token : homeTokens) { ! city = (City) token.getHolder(); ! hex = city.getHolder(); ! token.moveTo(token.getCompany()); ! if (hex.layBaseToken(cgr, city.getNumber())) { ! /* TODO: the false return value must be impossible. */ ! ReportBuffer.add(LocalText.getText("ExchangesBaseToken", ! cgrName, token.getCompany().getName(), ! city.getName())); ! cgr.layBaseToken(hex, 0); ! } ! } ! ! // Clean up any non-home tokens on cities now having a CGR token ! for (BaseToken token : new ArrayList<BaseToken>(nonHomeTokens)) { ! city = (City) token.getHolder(); ! hex = city.getHolder(); ! List<BaseToken> otherTokens = hex.getBaseTokens(); ! if (otherTokens != null) { ! for (BaseToken token2 : otherTokens) { ! if (token2.getCompany() == cgr) { ! ReportBuffer.add(LocalText.getText("DiscardsBaseToken", ! cgrName, token.getCompany().getName(), ! city.getName())); ! token.moveTo(token.getCompany()); ! nonHomeTokens.remove(token); ! break; ! } ! } ! } ! } ! ! // Prepare replacing the other tokens, if possible ! if (homeTokens.size() + nonHomeTokens.size() > cgr.getNumberOfBaseTokens()) { ! // CGR cannot replace all tokens, must choose ! // First collect old names per city ! Map<String, String> oldTokens = new HashMap<String, String>(); ! String cityName; ! for (BaseToken token : nonHomeTokens) { ! if (token.getHolder() instanceof City) { ! cityName = token.getHolder().getName(); ! if (oldTokens.containsKey(cityName)) { ! oldTokens.put(cityName, ! oldTokens.get(cityName)+","+token.getCompany().getName()); ! } else { ! oldTokens.put(cityName, token.getCompany().getName()); ! } ! } ! } ! // Then create list of exchange spots. Sort it on hexname/city number ! tokensToExchangeFrom = new ArrayList<ExchangeableToken>(); ! for (String key : new TreeSet<String> (oldTokens.keySet())) { ! tokensToExchangeFrom.add(new ExchangeableToken( ! key, oldTokens.get(key))); ! } ! } else { ! executeExchangeTokens (nonHomeTokens); ! } + // Close the absorbed companies and float the CGR + for (PublicCompanyI comp : mergingCompanies) { + comp.setClosed(); + } + cgr.start(100); // TODO: assign correct starting price + cgr.setFloated(); + + // Check the trains, autodiscard any excess non-permanent trains + int trainLimit = cgr.getTrainLimit(gameManager.getCurrentPlayerIndex()); + List<TrainI> trains = cgr.getPortfolio().getTrainList(); + outer: while (cgr.getNumberOfTrains() > trainLimit) { + for (TrainI train : trains) { + if (!train.getType().isPermanent()) { + train.moveTo(pool); + ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain", + cgrName, train.getName())); + continue outer; + } + } + break; + } + } + + private void executeExchangeTokens (List<BaseToken> exchangedTokens) { + City city; + MapHex hex; + for (BaseToken token : exchangedTokens) { + // Remove old token + city = (City) token.getHolder(); + hex = city.getHolder(); + token.moveTo(token.getCompany()); + // Replace it with a CGR token + if (hex.layBaseToken(cgr, city.getNumber())) { + cgr.layBaseToken(hex, 0); + //log.debug("CGR exchanges a token at "+hex.getName()+" "+hex.getCityName()); + } else { + log.error("Error in laying CGR token on "+hex.getName()+" "+hex.getCityName()); + } + } + } + + public boolean process (PossibleAction action) { + + boolean result = false; + + if (action instanceof RepayLoans) { + result = repayLoans((RepayLoans)action); + } else if (action instanceof DiscardTrain) { + result = discardTrain((DiscardTrain)action); + } else if (action instanceof ExchangeTokens) { + result = exchangeTokens ((ExchangeTokens)action); + } + if (!result) return false; + + if (getStep() == STEP_REPAY_LOANS) { + + if (setNextCompanyNeedingPresidentIntervention()) { + return true; + } + + if (!mergingCompanies.isEmpty()) { + formCGR(); + setStep (STEP_EXCHANGE_TOKENS); + } + } + + if (getStep() == STEP_EXCHANGE_TOKENS) { + + if (action instanceof ExchangeTokens) { + tokensToExchangeFrom = null; + } else if (tokensToExchangeFrom != null + && !tokensToExchangeFrom.isEmpty()) { + return true; + } + setStep (STEP_DISCARD_TRAINS); + } + + if (getStep() == STEP_DISCARD_TRAINS) { + + if (checkForTrainsToDiscard()) return true; gameManager.nextRound(this); } ! return true; ! } ! ! ! private boolean checkForTrainsToDiscard () { + // Check if CGR must discard trains + if (cgr.getNumberOfTrains() > cgr.getCurrentTrainLimit()) { + log.debug("CGR must discard trains"); + if (getStep() != STEP_DISCARD_TRAINS) { + setStep(STEP_DISCARD_TRAINS); + } + trainsToDiscardFrom = cgr.getPortfolio().getTrainList(); + forcedTrainDiscard = true; + return true; + } else { + // Check if CGR still has non-permanent trains + // these may be discarded voluntarily + trainsToDiscardFrom = new ArrayList<TrainI>(); + for (TrainI train : cgr.getPortfolio().getTrainList()) { + if (!train.getType().isPermanent()) { + trainsToDiscardFrom.add(train); + } + } + if (!trainsToDiscardFrom.isEmpty()) { + if (getStep() != STEP_DISCARD_TRAINS) { + setStep(STEP_DISCARD_TRAINS); + } + forcedTrainDiscard = false; + return true; + } + } + return false; + } + + public boolean discardTrain(DiscardTrain action) { + + TrainI train = action.getDiscardedTrain(); + PublicCompanyI company = action.getCompany(); + String companyName = company.getName(); + + String errMsg = null; + + // Dummy loop to enable a quick jump out. + while (true) { + // Checks + // Must be CGR + if (company != cgr) { + errMsg = LocalText.getText("WrongCompany", + company.getName(), + cgrName); + break; + } + // Must be correct step + if (getStep() != STEP_DISCARD_TRAINS) { + errMsg = LocalText.getText("WrongActionNoDiscardTrain"); + break; + } + + if (train == null && action.isForced()) { + errMsg = LocalText.getText("NoTrainSpecified"); + break; + } + + // Does the company own such a train? + + if (train != null && !company.getPortfolio().getTrainList().contains(train)) { + errMsg = + LocalText.getText("CompanyDoesNotOwnTrain", + company.getName(), + train.getName() ); + break; + } + + break; + } + if (errMsg != null) { + DisplayBuffer.add(LocalText.getText("CannotDiscardTrain", + companyName, + train.getName(), + errMsg )); + return false; + } + + /* End of validation, start of execution */ + MoveSet.start(true); + + if (train != null) { + + if (action.isForced()) MoveSet.setLinkedToPrevious(); + + train.moveTo(Bank.getPool()); + ReportBuffer.add(LocalText.getText("CompanyDiscardsTrain", + companyName, + train.getName() )); + + } + + return true; } *************** *** 201,203 **** --- 684,687 ---- } + } |
From: Erik V. <ev...@us...> - 2009-05-04 20:29:32
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29969/rails/game/action Modified Files: DiscardTrain.java RepayLoans.java Added Files: ExchangeableToken.java ExchangeTokens.java Log Message: 1856 CGR formation round Index: RepayLoans.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/RepayLoans.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RepayLoans.java 4 Feb 2009 20:36:40 -0000 1.3 --- RepayLoans.java 4 May 2009 20:29:15 -0000 1.4 *************** *** 96,100 **** .append(" maxNumber=").append(maxNumber) .append(" value=").append(price); ! if (numberRepaid != 0) { b.append(" numberRepaid="+numberRepaid); } --- 96,100 ---- .append(" maxNumber=").append(maxNumber) .append(" value=").append(price); ! if (acted) { b.append(" numberRepaid="+numberRepaid); } --- NEW FILE: ExchangeableToken.java --- /* $Header: /cvsroot/rails/18xx/rails/game/action/ExchangeableToken.java,v 1.1 2009/05/04 20:29:15 evos Exp $ * * Created on 20-May-2006 * Change Log: */ package rails.game.action; import java.io.Serializable; /** * A simple, serializable class that holds the <i>original</i> location * of a Base token, to facilitate its replacement even after its company * has been closed and all its tokens removed. This class is used in * the ExchangeTokens action class. * @author Erik Vos */ public class ExchangeableToken implements Serializable { private String cityName; private String oldCompanyName; private boolean selected = false; public static final long serialVersionUID = 1L; public ExchangeableToken (String cityName, String oldCompanyName) { this.cityName = cityName; this.oldCompanyName = oldCompanyName; } public String getCityName() { return cityName; } public String getOldCompanyName() { return oldCompanyName; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } public String toString() { return cityName+"["+oldCompanyName+"]" + (selected ? "*" : ""); } } --- NEW FILE: ExchangeTokens.java --- /* $Header: /cvsroot/rails/18xx/rails/game/action/ExchangeTokens.java,v 1.1 2009/05/04 20:29:15 evos Exp $ * * Created on 20-May-2006 * Change Log: */ package rails.game.action; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import rails.game.*; /** * @author Erik Vos */ public class ExchangeTokens extends PossibleORAction { // Server settings private List<ExchangeableToken> tokensToExchange = new ArrayList<ExchangeableToken>(); private int minNumberToExchange = 0; private int maxNumberToExchange = 0; // Client settings public static final long serialVersionUID = 1L; public ExchangeTokens(List<ExchangeableToken> tokensToSelectFrom, int minNumberToExchange, int maxNumberToExchange) { super(); this.tokensToExchange = tokensToSelectFrom; this.minNumberToExchange = minNumberToExchange; this.maxNumberToExchange = maxNumberToExchange; } public void setExchangedTokens(List<ExchangeableToken> exchangedTokens) { for (ExchangeableToken t : exchangedTokens) { t.setSelected(true); } } public int getMaxNumberToExchange() { return maxNumberToExchange; } public int getMinNumberToExchange() { return minNumberToExchange; } public List<ExchangeableToken> getTokensToExchange() { return tokensToExchange; } @Override public String toString() { StringBuffer b = new StringBuffer(); b.append("ExchangeTokens for "+companyName+":"); for (ExchangeableToken token : tokensToExchange) { b.append(" ").append(token.toString()); } b.append(" min=").append (minNumberToExchange); b.append(" max=").append (maxNumberToExchange); return b.toString(); } @Override public boolean equals(PossibleAction action) { if (!(action instanceof ExchangeTokens)) return false; ExchangeTokens a = (ExchangeTokens) action; return a.tokensToExchange == tokensToExchange && a.company == company; } /** Deserialize */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); } } Index: DiscardTrain.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/DiscardTrain.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DiscardTrain.java 4 Jun 2008 19:00:29 -0000 1.8 --- DiscardTrain.java 4 May 2009 20:29:15 -0000 1.9 *************** *** 71,80 **** StringBuffer b = new StringBuffer(); b.append("Discard train: ").append(company.getName()); ! b.append(" has"); for (TrainI train : ownedTrains) { b.append(" ").append(train.getName()); } if (discardedTrain != null) { ! b.append(" discards ").append(discardedTrain.getName()); } return b.toString(); --- 71,81 ---- StringBuffer b = new StringBuffer(); b.append("Discard train: ").append(company.getName()); ! b.append(" one of"); for (TrainI train : ownedTrains) { b.append(" ").append(train.getName()); } + b.append(forced ? "," : ", not").append (" forced,"); if (discardedTrain != null) { ! b.append(" and discards ").append(discardedTrain.getName()); } return b.toString(); |