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-09-11 19:27:03
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23094/rails/ui/swing/gamespecific/_1856 Modified Files: StatusWindow_1856.java Log Message: Added SerialVersionUID Index: StatusWindow_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1856/StatusWindow_1856.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatusWindow_1856.java 4 May 2009 20:29:15 -0000 1.2 --- StatusWindow_1856.java 11 Sep 2009 19:26:44 -0000 1.3 *************** *** 7,13 **** import rails.game.*; ! import rails.game.action.DiscardTrain; ! import rails.game.action.ExchangeTokens; ! import rails.game.action.RepayLoans; import rails.game.specific._1856.CGRFormationRound; import rails.ui.swing.StatusWindow; --- 7,11 ---- import rails.game.*; ! import rails.game.action.*; import rails.game.specific._1856.CGRFormationRound; import rails.ui.swing.StatusWindow; *************** *** 16,19 **** --- 14,19 ---- public class StatusWindow_1856 extends StatusWindow { + private static final long serialVersionUID = 1L; + public StatusWindow_1856() { super(); |
From: Erik V. <ev...@us...> - 2009-09-11 19:27:02
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23094/rails/ui/swing Modified Files: UpgradesPanel.java Log Message: Added SerialVersionUID Index: UpgradesPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/UpgradesPanel.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** UpgradesPanel.java 30 Jun 2008 20:35:29 -0000 1.16 --- UpgradesPanel.java 11 Sep 2009 19:26:44 -0000 1.17 *************** *** 4,13 **** import java.awt.*; import java.awt.event.*; ! import java.awt.image.*; ! import java.util.*; import java.util.List; import javax.swing.*; ! import javax.swing.border.*; import org.apache.log4j.Logger; --- 4,14 ---- import java.awt.*; import java.awt.event.*; ! import java.awt.image.BufferedImage; ! import java.util.ArrayList; import java.util.List; import javax.swing.*; ! import javax.swing.border.Border; ! import javax.swing.border.EtchedBorder; import org.apache.log4j.Logger; *************** *** 16,20 **** import rails.game.action.*; import rails.ui.swing.elements.ActionLabel; ! import rails.ui.swing.hexmap.*; import rails.util.LocalText; --- 17,22 ---- import rails.game.action.*; import rails.ui.swing.elements.ActionLabel; ! import rails.ui.swing.hexmap.GUIHex; ! import rails.ui.swing.hexmap.HexMap; import rails.util.LocalText; *************** *** 321,324 **** --- 323,328 ---- private class HexLabel extends JLabel { + private static final long serialVersionUID = 1L; + String toolTip; int internalId; |
From: Erik V. <ev...@us...> - 2009-09-11 19:26:57
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23094/rails/game/action Modified Files: AssignNamedTrains.java Log Message: Added SerialVersionUID Index: AssignNamedTrains.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/AssignNamedTrains.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssignNamedTrains.java 4 Jun 2008 19:00:29 -0000 1.2 --- AssignNamedTrains.java 11 Sep 2009 19:26:44 -0000 1.3 *************** *** 5,10 **** import rails.game.special.SpecialProperty; - import rails.game.specific._18AL.NamedTrainToken; import rails.game.specific._18AL.NameTrains; public class AssignNamedTrains extends PossibleAction { --- 5,10 ---- import rails.game.special.SpecialProperty; import rails.game.specific._18AL.NameTrains; + import rails.game.specific._18AL.NamedTrainToken; public class AssignNamedTrains extends PossibleAction { *************** *** 13,16 **** --- 13,18 ---- private int namedTrainsSpecialPropertyId; + private static final long serialVersionUID = 1L; + public AssignNamedTrains(NameTrains namedTrainsSpecialProperty) { this.namedTrainsSpecialProperty = namedTrainsSpecialProperty; *************** *** 19,23 **** } ! public String toString() { StringBuffer b = new StringBuffer("AssignNamedTrains "); for (NamedTrainToken token : namedTrainsSpecialProperty.getTokens()) { --- 21,26 ---- } ! @Override ! public String toString() { StringBuffer b = new StringBuffer("AssignNamedTrains "); for (NamedTrainToken token : namedTrainsSpecialProperty.getTokens()) { |
From: Erik V. <ev...@us...> - 2009-09-11 19:26:57
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv23094/rails/ui/swing/gamespecific/_18EU Modified Files: StatusWindow_18EU.java GameStatus_18EU.java Log Message: Added SerialVersionUID Index: StatusWindow_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_18EU/StatusWindow_18EU.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StatusWindow_18EU.java 15 Jan 2009 20:53:28 -0000 1.5 --- StatusWindow_18EU.java 11 Sep 2009 19:26:44 -0000 1.6 *************** *** 21,24 **** --- 21,26 ---- public class StatusWindow_18EU extends StatusWindow { + private static final long serialVersionUID = 1L; + @Override protected boolean updateGameSpecificSettings() { Index: GameStatus_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GameStatus_18EU.java 15 Jan 2009 20:53:28 -0000 1.7 --- GameStatus_18EU.java 11 Sep 2009 19:26:44 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- */ public class GameStatus_18EU extends GameStatus { + + private static final long serialVersionUID = 1L; + @Override protected void initGameSpecificActions() { |
From: Erik V. <ev...@us...> - 2009-09-08 21:49:16
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28138/rails/game Modified Files: BonusToken.java OperatingRound.java PhaseManager.java GameManagerI.java MapHex.java Game.java PublicCompany.java TrainManagerI.java TrainManager.java Token.java GameManager.java Added Files: PhaseManagerI.java Log Message: Removed statics from some manager classes --- NEW FILE: PhaseManagerI.java --- /* $Header: /cvsroot/rails/18xx/rails/game/PhaseManagerI.java,v 1.7 2009/09/08 21:48:59 evos Exp $ */ package rails.game; public interface PhaseManagerI { public void init (GameManagerI gameManager); public int getCurrentPhaseIndex(); public PhaseI getCurrentPhase(); public void setPhase(String name); public PhaseI getPhaseNyName (String name); public boolean hasReachedPhase (String phaseName); } Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** PublicCompany.java 6 Sep 2009 12:27:32 -0000 1.57 --- PublicCompany.java 8 Sep 2009 21:48:59 -0000 1.58 *************** *** 1223,1228 **** CashHolder beneficiary = holder.getOwner(); // Special cases apply if the holder is the IPO or the Pool ! if (holder == Bank.getIpo() && ipoPaysOut || holder == Bank.getPool() ! && poolPaysOut) { beneficiary = this; } --- 1223,1228 ---- CashHolder beneficiary = holder.getOwner(); // Special cases apply if the holder is the IPO or the Pool ! if (holder == Bank.getIpo() && ipoPaysOut ! || holder == Bank.getPool() && poolPaysOut) { beneficiary = this; } Index: TrainManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainManager.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TrainManager.java 4 May 2009 20:29:14 -0000 1.16 --- TrainManager.java 8 Sep 2009 21:48:59 -0000 1.17 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements TrainManagerI, ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected boolean buyAtFaceValueBetweenDifferentPresidents = false; // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; // Non-game attributes private static TrainManagerI instance = null; protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { instance = this; ipo = Bank.getIpo(); unavailable = Bank.getUnavailable(); // Nothing to do here, everything happens when configured. newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special buyAtFaceValueBetweenDifferentPresidents = rulesTag.getChild("FaceValueIfDifferentPresidents") != null; } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(); } /** * Make an abbreviated list of trains, like "2(6) 3(5)" etc, to show in the * IPO. * * @param holder The Portfolio for which this list will be made (always * IPO). */ public static String makeAbbreviatedList(Portfolio holder) { StringBuffer b = new StringBuffer(); TrainI[] trains; for (TrainTypeI type : instance.getTrainTypes()) { trains = holder.getTrainsPerType(type); if (trains.length > 0) { if (b.length() > 0) b.append(" "); b.append(type.getName()).append("("); if (type.hasInfiniteAmount()) { b.append("+"); } else { b.append(trains.length); } b.append(")"); } } return b.toString(); } /** * Make a full list of trains, like "2 2 3 3", to show in any field * describing train possessions, except the IPO. * * @param holder The Portfolio for which this list will be made. */ public static String makeFullList(Portfolio holder) { List<TrainI> trains = holder.getTrainList(); if (trains == null || trains.size() == 0) return ""; return makeFullList(trains); } public static String makeFullList(List<TrainI> trains) { StringBuffer b = new StringBuffer(); for (TrainI train : trains) { if (b.length() > 0) b.append(" "); if (train.isObsolete()) b.append("("); b.append(train.toDisplay()); if (train.isObsolete()) b.append(")"); } return b.toString(); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == ((TrainTypeI) lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); nextType = ((TrainTypeI) lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { PhaseManager.getInstance().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public TrainTypeI getTypeByName(String name) { return (TrainTypeI) mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } public boolean buyAtFaceValueBetweenDifferentPresidents() { return buyAtFaceValueBetweenDifferentPresidents; } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import rails.game.state.IntegerState; import rails.util.LocalText; import rails.util.Tag; public class TrainManager implements TrainManagerI, ConfigurableComponentI { // Static attributes protected List<TrainTypeI> lTrainTypes = new ArrayList<TrainTypeI>(); protected Map<String, TrainTypeI> mTrainTypes = new HashMap<String, TrainTypeI>(); protected boolean buyAtFaceValueBetweenDifferentPresidents = false; // Dynamic attributes protected Portfolio unavailable = null; protected IntegerState newTypeIndex; protected boolean trainsHaveRusted = false; protected boolean phaseHasChanged = false; protected boolean trainAvailabilityChanged = false; protected List<PublicCompanyI> companiesWithExcessTrains; protected GameManagerI gameManager = null; // Non-game attributes private static TrainManagerI instance = null; protected Portfolio ipo = null; /** * No-args constructor. */ public TrainManager() { instance = this; ipo = Bank.getIpo(); unavailable = Bank.getUnavailable(); // Nothing to do here, everything happens when configured. newTypeIndex = new IntegerState("NewTrainTypeIndex", 0); } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tag) throws ConfigurationException { TrainType defaultType = null; TrainType newType; Tag defaultsTag = tag.getChild("Defaults"); if (defaultsTag != null) { defaultType = new TrainType(false); defaultType.configureFromXML(defaultsTag); } List<Tag> typeTags = tag.getChildren("Train"); for (Tag typeTag : typeTags) { if (defaultType != null) { newType = (TrainType) defaultType.clone(); if (newType == null) { throw new ConfigurationException("Cannot clone traintype " + defaultType.getName()); } } else { newType = new TrainType(true); } lTrainTypes.add(newType); newType.configureFromXML(typeTag); mTrainTypes.put(newType.getName(), newType); } // Special train buying rules Tag rulesTag = tag.getChild("TrainBuyingRules"); if (rulesTag != null) { // A 1851 special buyAtFaceValueBetweenDifferentPresidents = rulesTag.getChild("FaceValueIfDifferentPresidents") != null; } // Finish initialisation of the train types for (TrainTypeI type : lTrainTypes) { if (type.getReleasedTrainTypeName() != null) { type.setReleasedTrainType(mTrainTypes.get(type.getReleasedTrainTypeName())); } if (type.getRustedTrainTypeName() != null) { type.setRustedTrainType(mTrainTypes.get(type.getRustedTrainTypeName())); mTrainTypes.get(type.getRustedTrainTypeName()).setPermanent(false); } } // By default, set the first train type to "available". newTypeIndex.set(0); lTrainTypes.get(newTypeIndex.intValue()).setAvailable(); } public void init (GameManagerI gameManager) { this.gameManager = gameManager; } /** * Make an abbreviated list of trains, like "2(6) 3(5)" etc, to show in the * IPO. * * @param holder The Portfolio for which this list will be made (always * IPO). */ public static String makeAbbreviatedList(Portfolio holder) { StringBuffer b = new StringBuffer(); TrainI[] trains; for (TrainTypeI type : instance.getTrainTypes()) { trains = holder.getTrainsPerType(type); if (trains.length > 0) { if (b.length() > 0) b.append(" "); b.append(type.getName()).append("("); if (type.hasInfiniteAmount()) { b.append("+"); } else { b.append(trains.length); } b.append(")"); } } return b.toString(); } /** * Make a full list of trains, like "2 2 3 3", to show in any field * describing train possessions, except the IPO. * * @param holder The Portfolio for which this list will be made. */ public static String makeFullList(Portfolio holder) { List<TrainI> trains = holder.getTrainList(); if (trains == null || trains.size() == 0) return ""; return makeFullList(trains); } public static String makeFullList(List<TrainI> trains) { StringBuffer b = new StringBuffer(); for (TrainI train : trains) { if (b.length() > 0) b.append(" "); if (train.isObsolete()) b.append("("); b.append(train.toDisplay()); if (train.isObsolete()) b.append(")"); } return b.toString(); } /** * This method handles any consequences of new train buying (from the IPO), * such as rusting and phase changes. It must be called <b>after</b> the * train has been transferred. * */ public void checkTrainAvailability(TrainI train, Portfolio from) { trainsHaveRusted = false; phaseHasChanged = false; if (from != ipo) return; TrainTypeI boughtType, nextType; boughtType = train.getType(); if (boughtType == (lTrainTypes.get(newTypeIndex.intValue())) && ipo.getTrainOfType(boughtType) == null) { // Last train bought, make a new type available. newTypeIndex.add(1); nextType = (lTrainTypes.get(newTypeIndex.intValue())); if (nextType != null) { if (!nextType.isAvailable()) nextType.setAvailable(); trainAvailabilityChanged = true; ReportBuffer.add("All " + boughtType.getName() + "-trains are sold out, " + nextType.getName() + "-trains now available"); } } if (boughtType.getNumberBoughtFromIPO() == 1) { // First train of a new type bought ReportBuffer.add(LocalText.getText("FirstTrainBought", boughtType.getName())); String newPhase = boughtType.getStartedPhaseName(); if (newPhase != null) { gameManager.getPhaseManager().setPhase(newPhase); phaseHasChanged = true; } TrainTypeI rustedType = boughtType.getRustedTrainType(); if (rustedType != null && !rustedType.hasRusted()) { rustedType.setRusted(train.getHolder()); // Or obsolete, // where applicable ReportBuffer.add(LocalText.getText("TrainsRusted", rustedType.getName())); trainsHaveRusted = true; trainAvailabilityChanged = true; } TrainTypeI releasedType = boughtType.getReleasedTrainType(); if (releasedType != null) { if (!releasedType.isAvailable()) releasedType.setAvailable(); ReportBuffer.add(LocalText.getText("TrainsAvailable", releasedType.getName())); trainAvailabilityChanged = true; } } } public List<TrainI> getAvailableNewTrains() { List<TrainI> availableTrains = new ArrayList<TrainI>(); TrainI train; for (TrainTypeI type : lTrainTypes) { if (type.isAvailable()) { train = ipo.getTrainOfType(type); if (train != null) { availableTrains.add(train); } } } return availableTrains; } public TrainTypeI getTypeByName(String name) { return mTrainTypes.get(name); } public List<TrainTypeI> getTrainTypes() { return lTrainTypes; } public boolean hasAvailabilityChanged() { return trainAvailabilityChanged; } public void resetAvailabilityChanged() { trainAvailabilityChanged = false; } public boolean hasPhaseChanged() { return phaseHasChanged; } public boolean buyAtFaceValueBetweenDifferentPresidents() { return buyAtFaceValueBetweenDifferentPresidents; } } \ No newline at end of file Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** GameManager.java 6 Sep 2009 12:27:36 -0000 1.49 --- GameManager.java 8 Sep 2009 21:48:59 -0000 1.50 *************** *** 939,943 **** // TODO Should be removed ! public static void initialiseNewPhase(PhaseI phase) { ReportBuffer.add(LocalText.getText("StartOfPhase", phase.getName())); --- 939,943 ---- // TODO Should be removed ! public void initialiseNewPhase(PhaseI phase) { ReportBuffer.add(LocalText.getText("StartOfPhase", phase.getName())); Index: Token.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Token.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Token.java 4 Jun 2008 19:00:31 -0000 1.5 --- Token.java 8 Sep 2009 21:48:59 -0000 1.6 *************** *** 1,4 **** /* $Header$ ! * * Created on Jan 1, 2007 * Change Log: --- 1,4 ---- /* $Header$ ! * * Created on Jan 1, 2007 * Change Log: *************** *** 17,23 **** public abstract class Token implements TokenI { ! TokenHolderI holder = null; ! String description = ""; ! String uniqueId; private static Map<String, TokenI> tokenMap = new HashMap<String, TokenI>(); --- 17,23 ---- public abstract class Token implements TokenI { ! protected TokenHolderI holder = null; ! protected String description = ""; ! protected String uniqueId; private static Map<String, TokenI> tokenMap = new HashMap<String, TokenI>(); *************** *** 59,63 **** * Transfer a token object from one TokenHolder (e.g. a Company) to another * (e.g. a Station in a MapHex). ! * * @param token * @param from --- 59,63 ---- * Transfer a token object from one TokenHolder (e.g. a Company) to another * (e.g. a Station in a MapHex). ! * * @param token * @param from Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Game.java 6 Sep 2009 12:27:31 -0000 1.25 --- Game.java 8 Sep 2009 21:48:59 -0000 1.26 *************** *** 35,39 **** protected List<String> directories = new ArrayList<String>(); protected Map<String, String> gameOptions; ! protected List<String> players; --- 35,39 ---- protected List<String> directories = new ArrayList<String>(); protected Map<String, String> gameOptions; ! protected List<String> players; *************** *** 102,106 **** "No PlayerManager XML element found in file " + GAME_XML_FILE); } ! bank = (Bank) componentManager.findComponent("Bank"); if (bank == null) { --- 102,106 ---- "No PlayerManager XML element found in file " + GAME_XML_FILE); } ! bank = (Bank) componentManager.findComponent("Bank"); if (bank == null) { *************** *** 108,112 **** "No Bank XML element found in file " + GAME_XML_FILE); } ! companyManager = (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); --- 108,112 ---- "No Bank XML element found in file " + GAME_XML_FILE); } ! companyManager = (CompanyManagerI) componentManager.findComponent(CompanyManagerI.COMPONENT_NAME); *************** *** 154,157 **** --- 154,158 ---- companyManager.initCompanies(gameManager); + trainManager.init(gameManager); bank.initCertificates(); StartPacket.init(); Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** OperatingRound.java 6 Sep 2009 12:27:36 -0000 1.66 --- OperatingRound.java 8 Sep 2009 21:48:59 -0000 1.67 *************** *** 667,671 **** MoveSet.start(true); ! if (hex.layBonusToken(token)) { /* TODO: the false return value must be impossible. */ --- 667,671 ---- MoveSet.start(true); ! if (hex.layBonusToken(token, gameManager.getPhaseManager())) { /* TODO: the false return value must be impossible. */ Index: PhaseManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PhaseManager.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PhaseManager.java 11 Jan 2009 17:24:46 -0000 1.13 --- PhaseManager.java 8 Sep 2009 21:48:59 -0000 1.14 *************** *** 9,14 **** public class PhaseManager implements ConfigurableComponentI { - protected static PhaseManager instance = null; - protected ArrayList<Phase> phaseList; protected HashMap<String, Phase> phaseMap; --- 9,12 ---- *************** *** 17,28 **** protected State currentPhase = new State("CurrentPhase", Phase.class); ! public PhaseManager() { ! ! instance = this; ! } ! public static PhaseManager getInstance() { ! return instance; ! } public void configureFromXML(Tag tag) throws ConfigurationException { --- 15,22 ---- protected State currentPhase = new State("CurrentPhase", Phase.class); ! // Can be removed once setPhase() has been redone. ! protected GameManagerI gameManager; ! public PhaseManager() {} public void configureFromXML(Tag tag) throws ConfigurationException { *************** *** 41,45 **** int n = 0; for (Tag phaseTag : phaseTags) { ! name = phaseTag.getAttributeAsString("name", "" + (n + 1)); phase = new Phase(n++, name, previousPhase); phaseList.add(phase); --- 35,39 ---- int n = 0; for (Tag phaseTag : phaseTags) { ! name = phaseTag.getAttributeAsString("name", String.valueOf(n + 1)); phase = new Phase(n++, name, previousPhase); phaseList.add(phase); *************** *** 53,56 **** --- 47,54 ---- } + public void init (GameManagerI gameManager) { + this.gameManager = gameManager; + } + public PhaseI getCurrentPhase() { return (PhaseI) currentPhase.getObject(); *************** *** 72,76 **** // as soon as privates closing is included there. // Please consider Undo/Redo as well ! GameManager.initialiseNewPhase(phase); } } --- 70,74 ---- // as soon as privates closing is included there. // Please consider Undo/Redo as well ! gameManager.initialiseNewPhase(phase); } } Index: MapHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapHex.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** MapHex.java 4 May 2009 20:29:14 -0000 1.23 --- MapHex.java 8 Sep 2009 21:48:59 -0000 1.24 *************** *** 730,734 **** } ! public boolean layBonusToken(BonusToken token) { if (token == null) { log.error("No token specified"); --- 730,741 ---- } ! /** ! * Lay a bonus token. ! * @param token The bonus token object to place ! * @param phaseManager The PhaseManager is also passed in case the ! * token must register itself for removal when a certain phase starts. ! * @return ! */ ! public boolean layBonusToken(BonusToken token, PhaseManager phaseManager) { if (token == null) { log.error("No token specified"); *************** *** 736,739 **** --- 743,747 ---- } else { token.moveTo(this); + token.prepareForRemoval (phaseManager); return true; } *************** *** 751,755 **** } } ! public List<BaseToken> getBaseTokens () { if (cities == null || cities.isEmpty()) return null; --- 759,763 ---- } } ! public List<BaseToken> getBaseTokens () { if (cities == null || cities.isEmpty()) return null; *************** *** 930,938 **** } ! public int getCurrentOffBoardValue() { ! if (hasOffBoardValues()) { return offBoardValues[Math.min( offBoardValues.length, ! PhaseManager.getInstance().getCurrentPhase().getOffBoardRevenueStep()) - 1]; } else { return 0; --- 938,946 ---- } ! public int getCurrentOffBoardValue(PhaseI phase) { ! if (hasOffBoardValues() && phase != null) { return offBoardValues[Math.min( offBoardValues.length, ! phase.getOffBoardRevenueStep()) - 1]; } else { return 0; Index: BonusToken.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/BonusToken.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** BonusToken.java 11 Jan 2009 17:24:46 -0000 1.8 --- BonusToken.java 8 Sep 2009 21:48:58 -0000 1.9 *************** *** 17,21 **** * a base from which a company can operate. Other names used in various games * and discussions are "railhead", "station", "garrison", or just "token". ! * * @author Erik Vos */ --- 17,21 ---- * a base from which a company can operate. Other names used in various games * and discussions are "railhead", "station", "garrison", or just "token". ! * * @author Erik Vos */ *************** *** 56,83 **** } public void close() { ! // new TokenMove (this, holder, Bank.getScrapHeap()); new ObjectMove(this, holder, Bank.getScrapHeap()); user.removeBonusToken(this); } ! @Override ! public void setHolder(TokenHolderI newHolder) { ! super.setHolder(newHolder); ! // Prepare for removal, is requested ! if (removingObjectDesc != null && removingObject == null) { ! String[] spec = removingObjectDesc.split(":"); ! if (spec[0].equalsIgnoreCase("Phase")) { ! removingObject = ! PhaseManager.getInstance().getPhaseByName(spec[1]); ! } } ! // If the token is placed, prepare its removal when required ! if (newHolder instanceof MapHex && removingObject != null) { ! if (removingObject instanceof Phase) { ! ((Phase) removingObject).addObjectToClose(this); ! } } } --- 56,89 ---- } + /** + * Remove the token. + * This method can be called by a certain phase when it starts. + * See prepareForRemovel(). + */ public void close() { ! new ObjectMove(this, holder, Bank.getScrapHeap()); user.removeBonusToken(this); } ! /** ! * Prepare the bonus token for removal, if so configured. ! * The only case currently implemented to trigger removal ! * is the start of a given phase. ! */ ! public void prepareForRemoval (PhaseManager phaseManager) { ! if (removingObjectDesc == null) return; ! ! if (removingObject == null) { ! String[] spec = removingObjectDesc.split(":"); ! if (spec[0].equalsIgnoreCase("Phase")) { ! removingObject = ! phaseManager.getPhaseByName(spec[1]); ! } } ! if (removingObject instanceof Phase) { ! ((Phase) removingObject).addObjectToClose(this); } } Index: TrainManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainManagerI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TrainManagerI.java 4 Jun 2008 19:00:30 -0000 1.6 --- TrainManagerI.java 8 Sep 2009 21:48:59 -0000 1.7 *************** *** 16,19 **** --- 16,21 ---- static final String COMPONENT_NAME = "TrainManager"; + public void init (GameManagerI gameManager); + public List<TrainI> getAvailableNewTrains(); Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GameManagerI.java 6 Sep 2009 12:27:36 -0000 1.7 --- GameManagerI.java 8 Sep 2009 21:48:59 -0000 1.8 *************** *** 143,151 **** public abstract PhaseManager getPhaseManager(); public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); public StockMarketI getStockMarket(); ! public int getPlayerCertificateLimit(); public void setPlayerCertificateLimit(int newLimit); --- 143,152 ---- public abstract PhaseManager getPhaseManager(); + public void initialiseNewPhase(PhaseI phase); public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); public StockMarketI getStockMarket(); ! public int getPlayerCertificateLimit(); public void setPlayerCertificateLimit(int newLimit); *************** *** 153,157 **** public int getPlayerShareLimit(); ! public abstract String getHelp(); --- 154,158 ---- public int getPlayerShareLimit(); ! public abstract String getHelp(); |
From: Erik V. <ev...@us...> - 2009-09-08 21:49:11
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28138/rails/ui/swing Modified Files: ORUIManager.java Log Message: Removed statics from some manager classes Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ORUIManager.java 4 May 2009 20:29:15 -0000 1.27 --- ORUIManager.java 8 Sep 2009 21:48:59 -0000 1.28 *************** *** 99,102 **** --- 99,103 ---- oRound = or; companies = (oRound).getOperatingCompanies(); + map.updateOffBoardToolTips(); orWindow.activate(oRound); } *************** *** 904,908 **** gameUIManager.getCurrentPhase().getOffBoardRevenueStep(); if (newOffBoardRevenueStep != oldOffBoardRevenueStep) { ! HexMap.updateOffBoardToolTips(); } --- 905,909 ---- gameUIManager.getCurrentPhase().getOffBoardRevenueStep(); if (newOffBoardRevenueStep != oldOffBoardRevenueStep) { ! map.updateOffBoardToolTips(); } *************** *** 1363,1366 **** --- 1364,1371 ---- } + public GameUIManager getGameUIManager () { + return gameUIManager; + } + private void displayRemainingTiles() { |
From: Erik V. <ev...@us...> - 2009-09-08 21:49:07
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28138/rails/ui/swing/hexmap Modified Files: GUIHex.java HexMap.java Log Message: Removed statics from some manager classes Index: GUIHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUIHex.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** GUIHex.java 2 Dec 2008 20:29:15 -0000 1.20 --- GUIHex.java 8 Sep 2009 21:48:57 -0000 1.21 *************** *** 58,62 **** * Stores the neighbouring views. This parallels the neighors field in * MapHex, just on the view side. ! * * @todo check if we can avoid this */ --- 58,62 ---- * Stores the neighbouring views. This parallels the neighors field in * MapHex, just on the view side. ! * * @todo check if we can avoid this */ *************** *** 554,558 **** "): value "); if (model.hasOffBoardValues()) { ! tt.append(model.getCurrentOffBoardValue()).append(" ["); int[] values = model.getOffBoardValues(); for (int i = 0; i < values.length; i++) { --- 554,558 ---- "): value "); if (model.hasOffBoardValues()) { ! tt.append(model.getCurrentOffBoardValue(hexMap.getPhase())).append(" ["); int[] values = model.getOffBoardValues(); for (int i = 0; i < values.length; i++) { Index: HexMap.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/HexMap.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** HexMap.java 4 May 2009 20:29:15 -0000 1.15 --- HexMap.java 8 Sep 2009 21:48:58 -0000 1.16 *************** *** 3,21 **** import java.awt.*; - import java.awt.geom.*; import java.awt.event.*; import java.util.*; import java.util.List; ! import javax.swing.*; import org.apache.log4j.Logger; ! import rails.game.*; ! import rails.game.action.LayBonusToken; ! import rails.game.action.LayTile; ! import rails.game.action.LayBaseToken; ! import rails.game.action.LayToken; ! import rails.ui.swing.*; /** --- 3,20 ---- import java.awt.*; import java.awt.event.*; + import java.awt.geom.Point2D; import java.util.*; import java.util.List; ! import javax.swing.JComponent; import org.apache.log4j.Logger; ! import rails.game.MapHex; ! import rails.game.PhaseI; ! import rails.game.action.*; ! import rails.ui.swing.ORUIManager; ! import rails.ui.swing.Scale; /** *************** *** 95,104 **** return null; } ! public GUIHex getHexByName (String hexName) { return hexesByName.get (hexName); } ! public void paintComponent(Graphics g) { super.paintComponent(g); --- 94,104 ---- return null; } ! public GUIHex getHexByName (String hexName) { return hexesByName.get (hexName); } ! @Override ! public void paintComponent(Graphics g) { super.paintComponent(g); *************** *** 124,130 **** } ! public Dimension getMinimumSize() { Dimension dim = new Dimension(); ! Rectangle r = ((GUIHex) h[h.length][h[0].length]).getBounds(); dim.height = r.height + 40; dim.width = r.width + 100; --- 124,131 ---- } ! @Override ! public Dimension getMinimumSize() { Dimension dim = new Dimension(); ! Rectangle r = (h[h.length][h[0].length]).getBounds(); dim.height = r.height + 40; dim.width = r.width + 100; *************** *** 132,136 **** } ! public Dimension getPreferredSize() { return preferredSize; } --- 133,138 ---- } ! @Override ! public Dimension getPreferredSize() { return preferredSize; } *************** *** 282,285 **** --- 284,300 ---- } + /** + * Off-board tiles must be able to retrieve the current phase. + * + * @return The current Phase object. + */ + public PhaseI getPhase () { + if (orUIManager != null) { + return orUIManager.getGameUIManager().getGameManager().getPhaseManager().getCurrentPhase(); + } else { + return null; + } + } + public void mouseClicked(MouseEvent arg0) { Point point = arg0.getPoint(); *************** *** 291,295 **** /* * (non-Javadoc) ! * * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent) */ --- 306,310 ---- /* * (non-Javadoc) ! * * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent) */ *************** *** 298,302 **** /* * (non-Javadoc) ! * * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent) */ --- 313,317 ---- /* * (non-Javadoc) ! * * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent) */ *************** *** 315,319 **** public void mouseReleased(MouseEvent arg0) {} ! public static void updateOffBoardToolTips() { for (GUIHex hex : hexes) { if (hex.getHexModel().hasOffBoardValues()) { --- 330,334 ---- public void mouseReleased(MouseEvent arg0) {} ! public void updateOffBoardToolTips() { for (GUIHex hex : hexes) { if (hex.getHexModel().hasOffBoardValues()) { |
From: Erik V. <ev...@us...> - 2009-09-08 21:48:18
|
Update of /cvsroot/rails/18xx/data/18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28035/data/18EU Modified Files: Map.xml Log Message: revenue -> value Index: Map.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Map.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Map.xml 16 Mar 2008 17:28:07 -0000 1.8 --- Map.xml 8 Sep 2009 21:48:09 -0000 1.9 *************** *** 1,124 **** <Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A"> ! <!-- Hex name="" tile="" orientation="" revenue="" impassable="" label="" cost="" value="" port="yes/no" --> ! <Hex name="A4" port="yes" value="10" tile="-901" orientation="1"/> ! <Hex name="B7" value="30,50" tile="-939" orientation="1" city="Hamburg"/> ! <Hex name="C4" label="Y" tile="-10" city="Amsterdam"/> ! <Hex name="C6" tile="-1" city="Bremen"/> ! <Hex name="C8" tile="0" /> ! <Hex name="C10" tile="0" /> ! <Hex name="D3" tile="-1" city="Rotterdam"/> ! <Hex name="D5" tile="0" /> ! <Hex name="D7" tile="0" /> ! <Hex name="D9" tile="0" /> ! <Hex name="D11" tile="-1" city="Stettin"/> ! <Hex name="E4" tile="-1" city="Utrecht"/> ! <Hex name="E6" tile="0" /> ! <Hex name="E8" tile="0" /> ! <Hex name="E10" label="B" tile="-3005" orientation="1" city="Berlin"/> ! <Hex name="E12" tile="-1" city="Thorn"/> ! <Hex name="E14" value="20,30" tile="-901" orientation="2" city="Warsaw"/> ! <Hex name="F1" value="40,70" tile="-902" orientation="1" city="London"/> ! <Hex name="F3" tile="-1" city="Antwerp"/> ! <Hex name="F5" tile="-10" city="Dortmund"/> ! <Hex name="F7" tile="-1" city="Hannover"/> ! <Hex name="F9" tile="0" /> ! <Hex name="F11" tile="0" /> ! <Hex name="F13" tile="0" /> ! <Hex name="G2" tile="-1" city="Lille"/> ! <Hex name="G4" tile="-10" city="Cologne"/> ! <Hex name="G6" tile="0" /> ! <Hex name="G8" tile="-1" city="Magdeburg"/> ! <Hex name="G10" label="Y" tile="-10" city="Dresden"/> ! <Hex name="G12" tile="0" /> ! <Hex name="H1" tile="0" /> ! <Hex name="H3" label="Y" tile="-10" city="Brussels"/> ! <Hex name="H5" tile="0" /> ! <Hex name="H7" tile="0" /> ! <Hex name="H9" tile="-1" city="Leipzig"/> ! <Hex name="H11" cost="60" tile="0" /> ! <Hex name="H13" tile="0" /> ! <Hex name="I2" tile="0" /> ! <Hex name="I4" cost="60" tile="0" /> ! <Hex name="I6" tile="-10" city="Frankfurt"/> ! <Hex name="I8" tile="0" /> ! <Hex name="I10" cost="60" tile="0" /> ! <Hex name="I12" cost="60" tile="0" /> ! <Hex name="J1" label="P" tile="-3006" city="Paris"/> ! <Hex name="J3" cost="60" tile="0" /> ! <Hex name="J5" tile="0" /> ! <Hex name="J7" tile="-1" city="Nuremberg"/> ! <Hex name="J9" cost="60" tile="0" /> ! <Hex name="J11" tile="0" /> ! <Hex name="J13" cost="60" tile="-1" city="Krakau"/> ! <Hex name="K2" tile="0" /> ! <Hex name="K4" cost="60" tile="0" /> ! <Hex name="K6" tile="-1" city="Augsburg"/> ! <Hex name="K8" tile="0" /> ! <Hex name="K10" tile="-10" city="Prague"/> ! <Hex name="K12" tile="0" /> ! <Hex name="L1" tile="0" /> ! <Hex name="L3" tile="0" /> ! <Hex name="L5" tile="-1" city="Stuttgart"/> ! <Hex name="L7" tile="-10" city="Munich"/> ! <Hex name="L9" cost="60" tile="0" /> ! <Hex name="L11" tile="-1" city="Brunn"/> ! <Hex name="L13" tile="0" /> ! <Hex name="M2" tile="-1" city="Dijon"/> ! <Hex name="M4" label="Y" tile="-10" city="Strasbourg"/> ! <Hex name="M6" tile="0" /> ! <Hex name="M8" tile="0" /> ! <Hex name="M10" cost="60" tile="0" /> ! <Hex name="M12" tile="0" /> ! <Hex name="N1" cost="60" tile="0" /> ! <Hex name="N3" tile="0" /> ! <Hex name="N5" cost="60" tile="-1" city="Zurich"/> ! <Hex name="N7" tile="0" /> ! <Hex name="N9" cost="60" tile="-1" city="Salzburg"/> ! <Hex name="N11" label="V" tile="-3005" city="Vienna"/> ! <Hex name="N13" tile="0" /> ! <Hex name="O2" tile="0" /> ! <Hex name="O4" tile="-1" city="Basel"/> ! <Hex name="O6" cost="60" tile="0" /> ! <Hex name="O8" cost="60" tile="-1" city="Innsbruck"/> ! <Hex name="O10" cost="120,60" label="M" tile="0" /><!-- Tauern --> ! <Hex name="O12" cost="60" tile="-1" city="Pressburg"/> ! <Hex name="P1" cost="60" tile="0" /> ! <Hex name="P3" tile="-1" city="Geneva"/> ! <!-- Multiple upgrade costs: first value applies to FIRST tile laid ! (regardless the colour). Any subsequent values apply to ! yellow-to-green, green-to-brown etc. upgrades --> ! <Hex name="P5" cost="120,60" label="M" tile="0" /><!-- Simplon --> ! <Hex name="P7" cost="60" tile="0" /> ! <Hex name="P9" cost="120,60" label="M" tile="0" /><!-- Arlberg --> ! <Hex name="P11" cost="60" label="M" tile="8" orientation="1"/><!-- Semmering --> ! <Hex name="P13" label="Y" tile="-10" city="Budapest"/> ! <Hex name="Q2" label="Y" tile="-10" city="Lyon"/> ! <Hex name="Q4" cost="120,60" label="M" tile="0" /><!-- Lotschberg --> ! <Hex name="Q6" cost="120,60" label="M" tile="0" /><!-- Gotthard --> ! <Hex name="Q8" cost="120,60" label="M" tile="0" /><!-- Brenner --> ! <Hex name="Q10" tile="0" /> ! <Hex name="Q12" tile="0" /> ! <Hex name="Q14" value="30,50" tile="-901" orientation="3" city="Bucharest"/> ! <Hex name="R1" tile="0" /> ! <Hex name="R3" cost="120,60" label="M" tile="0" /><!-- Frejus --> ! <Hex name="R5" label="Y" tile="-10" city="Milan"/> ! <Hex name="R7" cost="120,60" label="M" tile="0" /><!-- Albula --> ! <Hex name="R9" tile="-10" orientation="4" city="Trieste"/> ! <Hex name="R11" tile="0" /> ! <Hex name="S2" tile="-10" city="Marseille"/> ! <Hex name="S4" tile="-10" city="Turin"/> ! <Hex name="S6" tile="0" /> ! <Hex name="S8" label="Y" tile="-10" city="Venice"/> ! <Hex name="S10" tile="0" /> ! <Hex name="T1" tile="0" /> ! <Hex name="T3" cost="60" tile="-1" city="Nice"/> ! <Hex name="T5" tile="-10" city="Genoa"/> ! <Hex name="T7" tile="-1" city="Bologna"/> ! <Hex name="T9" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="U2" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="U4" tile="0" /> ! <Hex name="U6" tile="-1" city="Florence"/> ! <Hex name="U8" tile="0" /> ! <Hex name="V5" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="V7" label="V" value="30,50" tile="-903" orientation="4"/><!-- Rome --> </Map> --- 1,124 ---- <Map mapClass="rails.ui.swing.hexmap.NSHexMap" tileOrientation="NS" letterOrientation="vertical" even="A"> ! <!-- Hex name="" tile="" orientation="" value="" impassable="" label="" cost="" value="" port="yes/no" --> ! <Hex name="A4" port="yes" value="10" tile="-901" orientation="1"/> ! <Hex name="B7" value="30,50" tile="-939" orientation="1" city="Hamburg"/> ! <Hex name="C4" label="Y" tile="-10" city="Amsterdam"/> ! <Hex name="C6" tile="-1" city="Bremen"/> ! <Hex name="C8" tile="0" /> ! <Hex name="C10" tile="0" /> ! <Hex name="D3" tile="-1" city="Rotterdam"/> ! <Hex name="D5" tile="0" /> ! <Hex name="D7" tile="0" /> ! <Hex name="D9" tile="0" /> ! <Hex name="D11" tile="-1" city="Stettin"/> ! <Hex name="E4" tile="-1" city="Utrecht"/> ! <Hex name="E6" tile="0" /> ! <Hex name="E8" tile="0" /> ! <Hex name="E10" label="B" tile="-3005" orientation="1" city="Berlin"/> ! <Hex name="E12" tile="-1" city="Thorn"/> ! <Hex name="E14" value="20,30" tile="-901" orientation="2" city="Warsaw"/> ! <Hex name="F1" value="40,70" tile="-902" orientation="1" city="London"/> ! <Hex name="F3" tile="-1" city="Antwerp"/> ! <Hex name="F5" tile="-10" city="Dortmund"/> ! <Hex name="F7" tile="-1" city="Hannover"/> ! <Hex name="F9" tile="0" /> ! <Hex name="F11" tile="0" /> ! <Hex name="F13" tile="0" /> ! <Hex name="G2" tile="-1" city="Lille"/> ! <Hex name="G4" tile="-10" city="Cologne"/> ! <Hex name="G6" tile="0" /> ! <Hex name="G8" tile="-1" city="Magdeburg"/> ! <Hex name="G10" label="Y" tile="-10" city="Dresden"/> ! <Hex name="G12" tile="0" /> ! <Hex name="H1" tile="0" /> ! <Hex name="H3" label="Y" tile="-10" city="Brussels"/> ! <Hex name="H5" tile="0" /> ! <Hex name="H7" tile="0" /> ! <Hex name="H9" tile="-1" city="Leipzig"/> ! <Hex name="H11" cost="60" tile="0" /> ! <Hex name="H13" tile="0" /> ! <Hex name="I2" tile="0" /> ! <Hex name="I4" cost="60" tile="0" /> ! <Hex name="I6" tile="-10" city="Frankfurt"/> ! <Hex name="I8" tile="0" /> ! <Hex name="I10" cost="60" tile="0" /> ! <Hex name="I12" cost="60" tile="0" /> ! <Hex name="J1" label="P" tile="-3006" city="Paris"/> ! <Hex name="J3" cost="60" tile="0" /> ! <Hex name="J5" tile="0" /> ! <Hex name="J7" tile="-1" city="Nuremberg"/> ! <Hex name="J9" cost="60" tile="0" /> ! <Hex name="J11" tile="0" /> ! <Hex name="J13" cost="60" tile="-1" city="Krakau"/> ! <Hex name="K2" tile="0" /> ! <Hex name="K4" cost="60" tile="0" /> ! <Hex name="K6" tile="-1" city="Augsburg"/> ! <Hex name="K8" tile="0" /> ! <Hex name="K10" tile="-10" city="Prague"/> ! <Hex name="K12" tile="0" /> ! <Hex name="L1" tile="0" /> ! <Hex name="L3" tile="0" /> ! <Hex name="L5" tile="-1" city="Stuttgart"/> ! <Hex name="L7" tile="-10" city="Munich"/> ! <Hex name="L9" cost="60" tile="0" /> ! <Hex name="L11" tile="-1" city="Brunn"/> ! <Hex name="L13" tile="0" /> ! <Hex name="M2" tile="-1" city="Dijon"/> ! <Hex name="M4" label="Y" tile="-10" city="Strasbourg"/> ! <Hex name="M6" tile="0" /> ! <Hex name="M8" tile="0" /> ! <Hex name="M10" cost="60" tile="0" /> ! <Hex name="M12" tile="0" /> ! <Hex name="N1" cost="60" tile="0" /> ! <Hex name="N3" tile="0" /> ! <Hex name="N5" cost="60" tile="-1" city="Zurich"/> ! <Hex name="N7" tile="0" /> ! <Hex name="N9" cost="60" tile="-1" city="Salzburg"/> ! <Hex name="N11" label="V" tile="-3005" city="Vienna"/> ! <Hex name="N13" tile="0" /> ! <Hex name="O2" tile="0" /> ! <Hex name="O4" tile="-1" city="Basel"/> ! <Hex name="O6" cost="60" tile="0" /> ! <Hex name="O8" cost="60" tile="-1" city="Innsbruck"/> ! <Hex name="O10" cost="120,60" label="M" tile="0" /><!-- Tauern --> ! <Hex name="O12" cost="60" tile="-1" city="Pressburg"/> ! <Hex name="P1" cost="60" tile="0" /> ! <Hex name="P3" tile="-1" city="Geneva"/> ! <!-- Multiple upgrade costs: first value applies to FIRST tile laid ! (regardless the colour). Any subsequent values apply to ! yellow-to-green, green-to-brown etc. upgrades --> ! <Hex name="P5" cost="120,60" label="M" tile="0" /><!-- Simplon --> ! <Hex name="P7" cost="60" tile="0" /> ! <Hex name="P9" cost="120,60" label="M" tile="0" /><!-- Arlberg --> ! <Hex name="P11" cost="60" label="M" tile="8" orientation="1"/><!-- Semmering --> ! <Hex name="P13" label="Y" tile="-10" city="Budapest"/> ! <Hex name="Q2" label="Y" tile="-10" city="Lyon"/> ! <Hex name="Q4" cost="120,60" label="M" tile="0" /><!-- Lotschberg --> ! <Hex name="Q6" cost="120,60" label="M" tile="0" /><!-- Gotthard --> ! <Hex name="Q8" cost="120,60" label="M" tile="0" /><!-- Brenner --> ! <Hex name="Q10" tile="0" /> ! <Hex name="Q12" tile="0" /> ! <Hex name="Q14" value="30,50" tile="-901" orientation="3" city="Bucharest"/> ! <Hex name="R1" tile="0" /> ! <Hex name="R3" cost="120,60" label="M" tile="0" /><!-- Frejus --> ! <Hex name="R5" label="Y" tile="-10" city="Milan"/> ! <Hex name="R7" cost="120,60" label="M" tile="0" /><!-- Albula --> ! <Hex name="R9" tile="-10" orientation="4" city="Trieste"/> ! <Hex name="R11" tile="0" /> ! <Hex name="S2" tile="-10" city="Marseille"/> ! <Hex name="S4" tile="-10" city="Turin"/> ! <Hex name="S6" tile="0" /> ! <Hex name="S8" label="Y" tile="-10" city="Venice"/> ! <Hex name="S10" tile="0" /> ! <Hex name="T1" tile="0" /> ! <Hex name="T3" cost="60" tile="-1" city="Nice"/> ! <Hex name="T5" tile="-10" city="Genoa"/> ! <Hex name="T7" tile="-1" city="Bologna"/> ! <Hex name="T9" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="U2" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="U4" tile="0" /> ! <Hex name="U6" tile="-1" city="Florence"/> ! <Hex name="U8" tile="0" /> ! <Hex name="V5" port="yes" value="10" tile="-901" orientation="4"/> ! <Hex name="V7" label="V" value="30,50" tile="-903" orientation="4"/><!-- Rome --> </Map> |
From: Erik V. <ev...@us...> - 2009-09-08 21:47:22
|
Update of /cvsroot/rails/18xx/data/1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27815/data/1856 Modified Files: Map.xml Log Message: revenue -> value (to fix tooltips) Index: Map.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/Map.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Map.xml 7 Nov 2008 01:20:12 -0000 1.10 --- Map.xml 8 Sep 2009 21:47:03 -0000 1.11 *************** *** 18,22 **** <Hex name="E16" tile="0"/> <Hex name="E18" tile="-2" port="yes"/> ! <Hex name="F9" tile="-939" port="yes" revenue="30,50,40" city="Goderich"/> <Hex name="F11" tile="0"/> <Hex name="F13" tile="-2"/> --- 18,22 ---- <Hex name="E16" tile="0"/> <Hex name="E18" tile="-2" port="yes"/> ! <Hex name="F9" tile="-939" port="yes" value="30,50,40" city="Goderich"/> <Hex name="F11" tile="0"/> <Hex name="F13" tile="-2"/> *************** *** 29,33 **** <Hex name="G16" tile="0"/> <Hex name="G18" tile="0"/> ! <Hex name="H5" tile="-902" orientation="1" port="yes" revenue="30,50,40" city="Lake Huron"/> <Hex name="H7" tile="-2" port="yes"/> <Hex name="H9" tile="0"/> --- 29,33 ---- <Hex name="G16" tile="0"/> <Hex name="G18" tile="0"/> ! <Hex name="H5" tile="-902" orientation="1" port="yes" value="30,50,40" city="Lake Huron"/> <Hex name="H7" tile="-2" port="yes"/> <Hex name="H9" tile="0"/> *************** *** 50,54 **** <Hex name="J15" tile="-10" city="Brantford"/> <Hex name="J17" tile="-2" port="yes"/> ! <Hex name="K2" tile="-902" orientation="1" port="yes" revenue="20,30,30" city="Georgian Bay"/> <Hex name="K4" tile="0"/> <Hex name="K6" tile="0"/> --- 50,54 ---- <Hex name="J15" tile="-10" city="Brantford"/> <Hex name="J17" tile="-2" port="yes"/> ! <Hex name="K2" tile="-902" orientation="1" port="yes" value="20,30,30" city="Georgian Bay"/> <Hex name="K4" tile="0"/> <Hex name="K6" tile="0"/> |
From: Erik V. <ev...@us...> - 2009-09-06 16:17:07
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29724/rails/ui/swing/hexmap Modified Files: GUITile.java Log Message: Fix tile downgrading Index: GUITile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUITile.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GUITile.java 30 Aug 2009 18:13:29 -0000 1.15 --- GUITile.java 6 Sep 2009 16:16:56 -0000 1.16 *************** *** 146,151 **** int otherNewEndPoint = newTracks.get(0).getEndPoint(tempTileSide); // Calculate the corresponding old tile side number ! int otherOldEndPoint = (otherNewEndPoint - tempRot + prevTileRotation +6 ) % 6; ! // That old tile side must have track too if (prevTile.getTracksPerSide(otherOldEndPoint) == null || prevTile.getTracksPerSide(otherOldEndPoint).isEmpty()) { --- 146,151 ---- int otherNewEndPoint = newTracks.get(0).getEndPoint(tempTileSide); // Calculate the corresponding old tile side number ! int otherOldEndPoint = (otherNewEndPoint + tempRot - prevTileRotation + 6) % 6; ! // That old tile side must have track too if (prevTile.getTracksPerSide(otherOldEndPoint) == null || prevTile.getTracksPerSide(otherOldEndPoint).isEmpty()) { |
From: Erik V. <ev...@us...> - 2009-09-06 13:59:41
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12356/rails/game/specific/_1856 Modified Files: CGRFormationRound.java PublicCompany_CGR.java OperatingRound_1856.java Log Message: CGR price down on selling every *two* 5% shares Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CGRFormationRound.java 4 Sep 2009 18:40:29 -0000 1.14 --- CGRFormationRound.java 6 Sep 2009 12:27:31 -0000 1.15 *************** *** 563,567 **** tokensToExchangeFrom.add(new ExchangeableToken( key, oldTokens.get(key))); ! } } else { executeExchangeTokens (nonHomeTokens); --- 563,567 ---- tokensToExchangeFrom.add(new ExchangeableToken( key, oldTokens.get(key))); ! } } else { executeExchangeTokens (nonHomeTokens); Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** OperatingRound_1856.java 4 Sep 2009 18:40:30 -0000 1.19 --- OperatingRound_1856.java 6 Sep 2009 12:27:31 -0000 1.20 *************** *** 66,69 **** --- 66,72 ---- // This check does not apply to the CGR if (operatingCompany instanceof PublicCompany_CGR) return true; + + if (operatingCompany.isClosed()) continue; + if (!operatingCompany.hasOperated()) { int soldPercentage *************** *** 471,475 **** // and is not closed. while (setNextOperatingCompany(false) ! && getOperatingCompany().isClosed()); // Remove closed companies from the operating company list --- 474,478 ---- // and is not closed. while (setNextOperatingCompany(false) ! && operatingCompany.isClosed()); // Remove closed companies from the operating company list *************** *** 487,491 **** for (PublicCompanyI c : companies) { ! log.debug("Now operating: "+c.getName()); } --- 490,498 ---- for (PublicCompanyI c : companies) { ! if (c.isClosed()) { ! log.info(c.getName()+" is closed"); ! } else { ! log.debug(c.getName()+" is operating"); ! } } Index: PublicCompany_CGR.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_CGR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PublicCompany_CGR.java 4 Sep 2009 18:40:30 -0000 1.1 --- PublicCompany_CGR.java 6 Sep 2009 12:27:31 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- import rails.game.move.*; import rails.game.state.BooleanState; + import rails.game.state.IntegerState; public class PublicCompany_CGR extends PublicCompany { *************** *** 12,17 **** public static final String NAME = "CGR"; ! /** Used for CGR */ private BooleanState hadPermanentTrain; /** Initialisation, to be called directly after instantiation (cloning) */ --- 13,22 ---- public static final String NAME = "CGR"; ! /** Special rules apply before CGR has got its first permanent train */ private BooleanState hadPermanentTrain; + + /* Cope with multiple 5% share sales in one turn */ + private IntegerState sharesSoldSoFar; + private IntegerState squaresDownSoFar; /** Initialisation, to be called directly after instantiation (cloning) */ *************** *** 23,26 **** --- 28,34 ---- // Share price is initially fixed canSharePriceVary.set(false); + + sharesSoldSoFar = new IntegerState(name+"_SharesSoldSoFar", 0); + squaresDownSoFar = new IntegerState(name+"_SquaresDownSoFar", 0); } *************** *** 99,102 **** --- 107,140 ---- } + public void adjustSharePrice (int actionPerformed, int numberOfSharesSold, + StockMarketI stockMarket) { + + if (actionPerformed == StockRound.SOLD) { + if (canSharePriceVary()) { + int numberOfSpaces; + if (shareUnit.intValue() == 5) { + // Take care for selling 5% shares in multiple blocks per turn + numberOfSpaces + = (sharesSoldSoFar.intValue() + numberOfSharesSold)/2 + - squaresDownSoFar.intValue(); + sharesSoldSoFar.add(numberOfSharesSold); + squaresDownSoFar.add(numberOfSpaces); + } else { + numberOfSpaces = numberOfSharesSold; + } + stockMarket.sell(this, numberOfSpaces); + } + } + } + + public void setOperated() { + super.setOperated(); + + // Reset the share selling counts + // TODO Should this be a generic function? + sharesSoldSoFar.set(0); + squaresDownSoFar.set(0); + } + @Override public boolean mustOwnATrain() { |
From: Erik V. <ev...@us...> - 2009-09-06 13:52:28
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12269/rails/game Modified Files: DisplayBuffer.java Log Message: Remove duplicate debug log Index: DisplayBuffer.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/DisplayBuffer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DisplayBuffer.java 4 Feb 2009 20:36:39 -0000 1.6 --- DisplayBuffer.java 6 Sep 2009 12:26:11 -0000 1.7 *************** *** 43,47 **** displayBuffer.add(message); /* Also log the message */ ! log.info("To display: " + message); } } --- 43,47 ---- displayBuffer.add(message); /* Also log the message */ ! //log.info("To display: " + message); } } |
From: Erik V. <ev...@us...> - 2009-09-06 12:27:45
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12356/rails/game Modified Files: Game.java PublicCompanyI.java PublicCompany.java StockRound.java StockMarket.java ShareSellingRound.java OperatingRound.java GameManagerI.java GameManager.java Log Message: CGR price down on selling every *two* 5% shares Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** OperatingRound.java 3 Sep 2009 18:33:28 -0000 1.65 --- OperatingRound.java 6 Sep 2009 12:27:36 -0000 1.66 *************** *** 1153,1157 **** protected void finishTurn() { ! operatingCompany.setOperated(true); companiesOperatedThisRound.add(operatingCompany); --- 1153,1157 ---- protected void finishTurn() { ! operatingCompany.setOperated(); companiesOperatedThisRound.add(operatingCompany); Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** PublicCompany.java 4 Sep 2009 18:38:11 -0000 1.56 --- PublicCompany.java 6 Sep 2009 12:27:32 -0000 1.57 *************** *** 888,893 **** } ! public void setOperated(boolean value) { ! hasOperated.set(value); } --- 888,893 ---- } ! public void setOperated() { ! hasOperated.set(true); } *************** *** 990,993 **** --- 990,1003 ---- } + public void adjustSharePrice (int actionPerformed, int numberOfSharesSold, + StockMarketI stockMarket) { + if (actionPerformed == StockRound.SOLD) { + if (canSharePriceVary()) { + stockMarket.sell(this, numberOfSharesSold); + } + } + } + + /** * Add a given amount to the company treasury. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** GameManager.java 4 Sep 2009 18:56:16 -0000 1.48 --- GameManager.java 6 Sep 2009 12:27:36 -0000 1.49 *************** *** 47,50 **** --- 47,51 ---- protected PhaseManager phaseManager; protected TrainManagerI trainManager; + protected StockMarketI stockMarket; protected List<Player> players; *************** *** 319,327 **** CompanyManagerI companyManager, PhaseManager phaseManager, ! TrainManagerI trainManager) { this.playerManager = playerManager; this.companyManager = companyManager; this.phaseManager = phaseManager; this.trainManager = trainManager; players = playerManager.getPlayers(); --- 320,330 ---- CompanyManagerI companyManager, PhaseManager phaseManager, ! TrainManagerI trainManager, ! StockMarketI stockMarket) { this.playerManager = playerManager; this.companyManager = companyManager; this.phaseManager = phaseManager; this.trainManager = trainManager; + this.stockMarket = stockMarket; players = playerManager.getPlayers(); *************** *** 931,934 **** --- 934,941 ---- } + public StockMarketI getStockMarket() { + return stockMarket; + } + // TODO Should be removed public static void initialiseNewPhase(PhaseI phase) { Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Game.java 3 Sep 2009 21:36:53 -0000 1.24 --- Game.java 6 Sep 2009 12:27:31 -0000 1.25 *************** *** 68,72 **** public void start() { gameManager.startGame(playerManager, companyManager, ! phaseManager, trainManager); } --- 68,72 ---- public void start() { gameManager.startGame(playerManager, companyManager, ! phaseManager, trainManager, stockMarket); } Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PublicCompanyI.java 4 Sep 2009 18:38:11 -0000 1.33 --- PublicCompanyI.java 6 Sep 2009 12:27:32 -0000 1.34 *************** *** 102,106 **** public boolean hasOperated(); ! public void setOperated(boolean value); /** --- 102,106 ---- public boolean hasOperated(); ! public void setOperated(); /** *************** *** 249,252 **** --- 249,255 ---- public boolean canSharePriceVary(); + public void adjustSharePrice (int actionPerformed, int numberOfSharesSold, + StockMarketI stockMarket); + public boolean isSplitAllowed(); Index: ShareSellingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ShareSellingRound.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ShareSellingRound.java 15 Jan 2009 20:53:28 -0000 1.20 --- ShareSellingRound.java 6 Sep 2009 12:27:33 -0000 1.21 *************** *** 356,360 **** } } ! stockMarket.sell(company, numberSold); // Check if we still have the presidency --- 356,360 ---- } } ! company.adjustSharePrice (SOLD, numberToSell, gameManager.getStockMarket()); // Check if we still have the presidency Index: StockMarket.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockMarket.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StockMarket.java 4 Sep 2009 18:38:11 -0000 1.16 --- StockMarket.java 6 Sep 2009 12:27:33 -0000 1.17 *************** *** 268,272 **** else if (row > 0 && (newsquare = getStockSpace(row - 1, col)) != null) {} - if (newsquare == oldsquare) return; prepareMove(company, oldsquare, newsquare); } --- 268,271 ---- *************** *** 280,284 **** else if (row < numRows - 1 && (newsquare = getStockSpace(row + 1, col)) != null) {} - if (newsquare == oldsquare) return; if (newsquare.closesCompany()) { if (!company.canClose()) return; // E.g. 1856 CGR --- 279,282 ---- Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** StockRound.java 4 Sep 2009 18:56:15 -0000 1.41 --- StockRound.java 6 Sep 2009 12:27:32 -0000 1.42 *************** *** 44,47 **** --- 44,51 ---- static protected final int SELL_BUY = 1; static protected final int SELL_BUY_OR_BUY_SELL = 2; + + /* Action comnstants */ + static public final int BOUGHT = 0; + static public final int SOLD = 1; /* Permanent memory */ *************** *** 997,1001 **** } } ! if (company.canSharePriceVary()) stockMarket.sell(company, numberToSell); // Check if we still have the presidency --- 1001,1005 ---- } } ! company.adjustSharePrice (SOLD, numberToSell, gameManager.getStockMarket()); // Check if we still have the presidency Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GameManagerI.java 4 Sep 2009 18:56:16 -0000 1.6 --- GameManagerI.java 6 Sep 2009 12:27:36 -0000 1.7 *************** *** 18,22 **** public abstract void startGame(PlayerManager playerManager, CompanyManagerI companyManager, PhaseManager phaseManager, ! TrainManagerI trainManager); public abstract CompanyManagerI getCompanyManager(); --- 18,22 ---- public abstract void startGame(PlayerManager playerManager, CompanyManagerI companyManager, PhaseManager phaseManager, ! TrainManagerI trainManager, StockMarketI stockMarket); public abstract CompanyManagerI getCompanyManager(); *************** *** 146,150 **** public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); ! public int getPlayerCertificateLimit(); public void setPlayerCertificateLimit(int newLimit); --- 146,151 ---- public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); ! public StockMarketI getStockMarket(); ! public int getPlayerCertificateLimit(); public void setPlayerCertificateLimit(int newLimit); |
From: Erik V. <ev...@us...> - 2009-09-04 18:56:34
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28727/rails/game/specific/_18EU Modified Files: StockRound_18EU.java Log Message: Moved player share limit from Player to GameManager Index: StockRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StockRound_18EU.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** StockRound_18EU.java 4 Sep 2009 18:40:30 -0000 1.22 --- StockRound_18EU.java 4 Sep 2009 18:56:16 -0000 1.23 *************** *** 116,120 **** comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(comp, cert.getShare()) < 1) continue; shares = cert.getShares(); --- 116,120 ---- comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, comp, cert.getShare()) < 1) continue; shares = cert.getShares(); *************** *** 168,172 **** comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(comp, cert.getShare()) < 1) continue; price = comp.getMarketPrice(); --- 168,172 ---- comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, comp, cert.getShare()) < 1) continue; price = comp.getMarketPrice(); *************** *** 197,201 **** if (isSaleRecorded(currentPlayer, company)) continue; if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); --- 197,201 ---- if (isSaleRecorded(currentPlayer, company)) continue; if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); |
From: Erik V. <ev...@us...> - 2009-09-04 18:56:30
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28727/rails/game Modified Files: Round.java StockRound.java Player.java GameManagerI.java GameManager.java Log Message: Moved player share limit from Player to GameManager Index: Player.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Player.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Player.java 3 Sep 2009 21:36:53 -0000 1.19 --- Player.java 4 Sep 2009 18:56:16 -0000 1.20 *************** *** 10,23 **** public class Player implements CashHolder, Comparable<Player> { - /** Default limit to percentage of a company a player may hold */ - private static final int DEFAULT_PLAYER_SHARE_LIMIT = 60; - public static int MAX_PLAYERS = 8; public static int MIN_PLAYERS = 2; - private static int playerShareLimit = DEFAULT_PLAYER_SHARE_LIMIT; - // May need to become an array - private String name = ""; --- 10,17 ---- *************** *** 48,77 **** } - /** - * Return the number of <i>additional</i> shares of a certain company and - * of a certain size that a player may buy, given the share "hold limit" per - * company, that is the percentage of shares of one company that a player - * may hold (typically 60%). <p>If no hold limit applies, it is taken to be - * 100%. - * - * @param company The company from which to buy - * @param number The share unit (typically 10%). - * @return The maximum number of such shares that would not let the player - * overrun the per-company share hold limit. - */ - public int maxAllowedNumberOfSharesToBuy(PublicCompanyI company, - int shareSize) { - - int limit; - if (!company.hasStarted()) { - limit = playerShareLimit; - } else { - limit = - company.getCurrentSpace().isNoHoldLimit() ? 100 - : playerShareLimit; - } - return (limit - portfolio.getShare(company)) / shareSize; - } - /** * @return Returns the player's portfolio. --- 42,45 ---- *************** *** 202,212 **** } - public static void setShareLimit(int percentage) { - playerShareLimit = percentage; - } - - public static int getShareLimit() { - return playerShareLimit; - } /** * Compare Players by their total worth, in descending order. This method --- 170,173 ---- Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** GameManager.java 4 Sep 2009 18:40:30 -0000 1.47 --- GameManager.java 4 Sep 2009 18:56:16 -0000 1.48 *************** *** 212,216 **** Tag shareLimitTag = tag.getChild("PlayerShareLimit"); if (shareLimitTag != null) { ! Player.setShareLimit(shareLimitTag.getAttributeAsInteger("percentage")); } --- 212,216 ---- Tag shareLimitTag = tag.getChild("PlayerShareLimit"); if (shareLimitTag != null) { ! playerShareLimit = shareLimitTag.getAttributeAsInteger("percentage", playerShareLimit); } *************** *** 868,872 **** } ! /* (non-Javadoc) * @see rails.game.GameManagerI#getAllPublicCompanies() */ --- 868,876 ---- } ! public int getPlayerShareLimit() { ! return playerShareLimit; ! } ! ! /* (non-Javadoc) * @see rails.game.GameManagerI#getAllPublicCompanies() */ Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GameManagerI.java 4 Sep 2009 18:40:30 -0000 1.5 --- GameManagerI.java 4 Sep 2009 18:56:16 -0000 1.6 *************** *** 151,154 **** --- 151,156 ---- public ModelObject getPlayerCertificateLimitModel (); + public int getPlayerShareLimit(); + public abstract String getHelp(); Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Round.java 3 Sep 2009 21:36:53 -0000 1.20 --- Round.java 4 Sep 2009 18:56:15 -0000 1.21 *************** *** 361,363 **** --- 361,368 ---- } + public GameManagerI getGameManager() { + return gameManager; + } + + } Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** StockRound.java 4 Sep 2009 18:40:30 -0000 1.40 --- StockRound.java 4 Sep 2009 18:56:15 -0000 1.41 *************** *** 160,164 **** comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(comp, cert.getShare()) < 1) continue; shares = cert.getShares(); --- 160,164 ---- comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, comp, cert.getShare()) < 1) continue; shares = cert.getShares(); *************** *** 209,213 **** comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(comp, cert.getShare()) < 1) continue; stockSpace = comp.getCurrentSpace(); --- 209,213 ---- comp = cert.getCompany(); if (isSaleRecorded(currentPlayer, comp)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, comp, cert.getShare()) < 1) continue; stockSpace = comp.getCurrentSpace(); *************** *** 253,257 **** if (isSaleRecorded(currentPlayer, company)) continue; if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; ! if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); --- 253,257 ---- if (isSaleRecorded(currentPlayer, company)) continue; if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; ! if (maxAllowedNumberOfSharesToBuy(currentPlayer, company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); *************** *** 1214,1222 **** public boolean mayPlayerBuyCompanyShare(Player player, PublicCompanyI company, int number) { // Check for per-company share limit ! if (player.getPortfolio().getShare(company) + number * company.getShareUnit() > Player.getShareLimit() && !company.getCurrentSpace().isNoHoldLimit()) return false; return true; } public static void setNoSaleInFirstSR() { --- 1214,1251 ---- public boolean mayPlayerBuyCompanyShare(Player player, PublicCompanyI company, int number) { // Check for per-company share limit ! if (player.getPortfolio().getShare(company) ! + number * company.getShareUnit() ! > gameManager.getPlayerShareLimit() && !company.getCurrentSpace().isNoHoldLimit()) return false; return true; } + /** + * Return the number of <i>additional</i> shares of a certain company and + * of a certain size that a player may buy, given the share "hold limit" per + * company, that is the percentage of shares of one company that a player + * may hold (typically 60%). <p>If no hold limit applies, it is taken to be + * 100%. + * + * @param company The company from which to buy + * @param number The share unit (typically 10%). + * @return The maximum number of such shares that would not let the player + * overrun the per-company share hold limit. + */ + public int maxAllowedNumberOfSharesToBuy(Player player, + PublicCompanyI company, + int shareSize) { + + int limit; + if (!company.hasStarted()) { + limit = gameManager.getPlayerShareLimit(); + } else { + limit = + company.getCurrentSpace().isNoHoldLimit() ? 100 + : gameManager.getPlayerShareLimit(); + } + return (limit - player.getPortfolio().getShare(company)) / shareSize; + } + public static void setNoSaleInFirstSR() { |
From: Erik V. <ev...@us...> - 2009-09-04 18:56:29
|
Update of /cvsroot/rails/18xx/rails/game/special In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28727/rails/game/special Modified Files: ExchangeForShare.java Log Message: Moved player share limit from Player to GameManager Index: ExchangeForShare.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/special/ExchangeForShare.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ExchangeForShare.java 4 Sep 2009 18:40:30 -0000 1.11 --- ExchangeForShare.java 4 Sep 2009 18:56:16 -0000 1.12 *************** *** 69,73 **** errMsg = LocalText.getText("WouldExceedHoldLimit", ! String.valueOf(Player.getShareLimit())); break; } --- 69,73 ---- errMsg = LocalText.getText("WouldExceedHoldLimit", ! String.valueOf(round.getGameManager().getPlayerShareLimit())); break; } |
From: Erik V. <ev...@us...> - 2009-09-04 18:42:50
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27767/rails/game/specific/_1856 Removed Files: PublicCompany_State.java Log Message: Renamed PublicCompany_State to PublicCompany_CGR. --- PublicCompany_State.java DELETED --- |
From: Erik V. <ev...@us...> - 2009-09-04 18:40:52
|
Update of /cvsroot/rails/18xx/rails/game/special In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27615/rails/game/special Modified Files: ExchangeForShare.java Log Message: Renamed PublicCompany_State to PublicCompany_CGR. Centralized CGR name there. Moved player limits to GameManager. Some method renaming. Index: ExchangeForShare.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/special/ExchangeForShare.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExchangeForShare.java 3 Sep 2009 21:36:53 -0000 1.10 --- ExchangeForShare.java 4 Sep 2009 18:40:30 -0000 1.11 *************** *** 65,69 **** } /* Check if the player has room for a share of this company */ ! if (!round.playerMayBuyCompanyShare(player, publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = --- 65,69 ---- } /* Check if the player has room for a share of this company */ ! if (!round.mayPlayerBuyCompanyShare(player, publicCompany, 1)) { // TODO: Not nice to use '1' here, should be percentage. errMsg = |
From: Erik V. <ev...@us...> - 2009-09-04 18:40:39
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27615/rails/game/specific/_1856 Modified Files: CGRFormationRound.java PublicCompany_1856.java OperatingRound_1856.java Added Files: PublicCompany_CGR.java Log Message: Renamed PublicCompany_State to PublicCompany_CGR. Centralized CGR name there. Moved player limits to GameManager. Some method renaming. Index: CGRFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/CGRFormationRound.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CGRFormationRound.java 3 Sep 2009 21:36:53 -0000 1.13 --- CGRFormationRound.java 4 Sep 2009 18:40:29 -0000 1.14 *************** *** 13,18 **** public class CGRFormationRound extends SwitchableUIRound { - private final String CGRNAME = "CGR"; - private Player startingPlayer; private Map<Player, List<PublicCompanyI>> companiesToRepayLoans = null; --- 13,16 ---- *************** *** 20,25 **** private int maxLoansToRepayByPresident = 0; private List<PublicCompanyI> mergingCompanies = new ArrayList<PublicCompanyI>(); ! private PublicCompany_State cgr = (PublicCompany_State)gameManager.getCompanyManager().getCompanyByName(CGRNAME); ! private String cgrName = CGRNAME; private List<TrainI> trainsToDiscardFrom = null; private boolean forcedTrainDiscard = true; --- 18,24 ---- private int maxLoansToRepayByPresident = 0; private List<PublicCompanyI> mergingCompanies = new ArrayList<PublicCompanyI>(); ! private String cgrName = PublicCompany_CGR.NAME; ! private PublicCompany_CGR cgr ! = (PublicCompany_CGR)gameManager.getCompanyManager().getCompanyByName(cgrName); private List<TrainI> trainsToDiscardFrom = null; private boolean forcedTrainDiscard = true; *************** *** 186,190 **** message = LocalText.getText("WillMergeInto", currentCompany.getName(), ! "CGR"); DisplayBuffer.add(message, false); ReportBuffer.add(message); --- 185,189 ---- message = LocalText.getText("WillMergeInto", currentCompany.getName(), ! PublicCompany_CGR.NAME); DisplayBuffer.add(message, false); ReportBuffer.add(message); *************** *** 264,268 **** String message = LocalText.getText("WillMergeInto", currentCompany.getName(), ! "CGR"); DisplayBuffer.add(message, true); ReportBuffer.add(message); --- 263,267 ---- String message = LocalText.getText("WillMergeInto", currentCompany.getName(), ! PublicCompany_CGR.NAME); DisplayBuffer.add(message, true); ReportBuffer.add(message); *************** *** 334,338 **** oldShares, newShares, ! "CGR"); DisplayBuffer.add(message, false); ReportBuffer.add(message); --- 333,337 ---- oldShares, newShares, ! PublicCompany_CGR.NAME); DisplayBuffer.add(message, false); ReportBuffer.add(message); *************** *** 389,393 **** oldShares, newShares, ! "CGR"); DisplayBuffer.add(message); ReportBuffer.add(message); --- 388,392 ---- oldShares, newShares, ! PublicCompany_CGR.NAME); DisplayBuffer.add(message); ReportBuffer.add(message); *************** *** 402,406 **** // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! (cgr).setShareUnit (10); // All superfluous shares have been removed } --- 401,405 ---- // unit becomes 10%; otherwise it stays 5%. if (cgrSharesUsed <=10) { ! cgr.setShareUnit (10); // All superfluous shares have been removed } *************** *** 412,416 **** // Move the remaining CGR shares to the ipo. // Clone the shares list first ! certs = new ArrayList<PublicCertificateI>(unavailable.getCertificatesPerCompany("CGR")); for (PublicCertificateI cert : certs) { cert.moveTo(ipo); --- 411,416 ---- // Move the remaining CGR shares to the ipo. // Clone the shares list first ! certs = new ArrayList<PublicCertificateI> ! (unavailable.getCertificatesPerCompany(PublicCompany_CGR.NAME)); for (PublicCertificateI cert : certs) { cert.moveTo(ipo); *************** *** 465,469 **** cgr.start(startSpace); message = LocalText.getText("START_MERGED_COMPANY", ! "CGR", Bank.format(startSpace.getPrice()), startSpace.getName()); --- 465,469 ---- cgr.start(startSpace); message = LocalText.getText("START_MERGED_COMPANY", ! PublicCompany_CGR.NAME, Bank.format(startSpace.getPrice()), startSpace.getName()); *************** *** 474,478 **** } cgr.setFloated(); ! ReportBuffer.add (LocalText.getText("Floats", "CGR")); // Collect the old token spots, and move cash and trains --- 474,478 ---- } cgr.setFloated(); ! ReportBuffer.add (LocalText.getText("Floats", PublicCompany_CGR.NAME)); // Collect the old token spots, and move cash and trains *************** *** 595,599 **** // Need some checks here... int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; ! playerManager.setPlayerCertificateLimit(newCertLimit); message = LocalText.getText("CertificateLimit", newCertLimit, --- 595,599 ---- // Need some checks here... int newCertLimit = certLimitsTable[numPlayers-3][numCompanies-4]; ! gameManager.setPlayerCertificateLimit(newCertLimit); message = LocalText.getText("CertificateLimit", newCertLimit, Index: OperatingRound_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/OperatingRound_1856.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** OperatingRound_1856.java 3 Sep 2009 18:33:26 -0000 1.18 --- OperatingRound_1856.java 4 Sep 2009 18:40:30 -0000 1.19 *************** *** 17,21 **** public static final int STEP_REPAY_LOANS = 6; - private final String CGRNAME = "CGR"; static { --- 17,20 ---- *************** *** 66,70 **** // 1856 special: check if the company has sold enough shares to operate // This check does not apply to the CGR ! if (operatingCompany.getName().equals(CGRNAME)) return true; if (!operatingCompany.hasOperated()) { int soldPercentage --- 65,69 ---- // 1856 special: check if the company has sold enough shares to operate // This check does not apply to the CGR ! if (operatingCompany instanceof PublicCompany_CGR) return true; if (!operatingCompany.hasOperated()) { int soldPercentage *************** *** 108,115 **** if (operatingCompany.canRunTrains()) { ! if (operatingCompany instanceof PublicCompany_State ! && ((PublicCompany_State)operatingCompany).runsWithBorrowedTrain()) { DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", ! "CGR", "D")); possibleActions.add(new SetDividend( operatingCompany.getLastRevenue(), true, --- 107,114 ---- if (operatingCompany.canRunTrains()) { ! if (operatingCompany instanceof PublicCompany_CGR ! && ((PublicCompany_CGR)operatingCompany).runsWithBorrowedTrain()) { DisplayBuffer.add(LocalText.getText("RunsWithBorrowedTrain", ! PublicCompany_CGR.NAME, "D")); possibleActions.add(new SetDividend( operatingCompany.getLastRevenue(), true, *************** *** 462,466 **** List<PublicCompanyI> companies = new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray)); ! PublicCompanyI cgr = companyManager.getCompanyByName("CGR"); boolean cgrCanOperate = cgr.hasStarted(); --- 461,465 ---- List<PublicCompanyI> companies = new ArrayList<PublicCompanyI>(Arrays.asList(operatingCompanyArray)); ! PublicCompanyI cgr = companyManager.getCompanyByName(PublicCompany_CGR.NAME); boolean cgrCanOperate = cgr.hasStarted(); Index: PublicCompany_1856.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1856/PublicCompany_1856.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PublicCompany_1856.java 5 Aug 2009 20:55:05 -0000 1.6 --- PublicCompany_1856.java 4 Sep 2009 18:40:30 -0000 1.7 *************** *** 1,10 **** package rails.game.specific._1856; - import java.util.ArrayList; - import java.util.List; - import rails.game.*; - import rails.game.move.MoveableHolderI; - import rails.game.move.RemoveFromList; import rails.game.state.IntegerState; --- 1,5 ---- *************** *** 69,104 **** } - 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); - new RemoveFromList<PublicCertificateI>(certificates, cert, "CGR_Certs"); - } 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).setShare(); - done.add(portfolio); - } - } - } - - } - } --- 64,66 ---- --- NEW FILE: PublicCompany_CGR.java --- package rails.game.specific._1856; import java.util.ArrayList; import java.util.List; import rails.game.*; import rails.game.move.*; import rails.game.state.BooleanState; public class PublicCompany_CGR extends PublicCompany { public static final String NAME = "CGR"; /** Used for CGR */ private BooleanState hadPermanentTrain; /** Initialisation, to be called directly after instantiation (cloning) */ @Override public void init(String name, CompanyTypeI type) { super.init(name, type); hadPermanentTrain = new BooleanState (name+"_HadPermanentTrain", false); // Share price is initially fixed canSharePriceVary.set(false); } public boolean hadPermanentTrain() { return hadPermanentTrain.booleanValue(); } public void setHadPermanentTrain(boolean hadPermanentTrain) { this.hadPermanentTrain.set(hadPermanentTrain); canSharePriceVary.set(true); } @Override public boolean canRunTrains() { if (!hadPermanentTrain()) { return true; } return getNumberOfTrains() > 0; } public boolean runsWithBorrowedTrain () { return !hadPermanentTrain() && getNumberOfTrains() == 0; } /** * CGR share price does not move until a permanent train is bought. * * @param The revenue amount. */ @Override public void withhold(int amount) { if (amount > 0) new CashMove(null, this, amount); if (hasStockPrice && !runsWithBorrowedTrain()) { Game.getStockMarket().withhold(this); } } @Override public void buyTrain(TrainI train, int price) { super.buyTrain (train, price); if (train.getType().isPermanent()) setHadPermanentTrain(true); } public void setShareUnit (int percentage) { // Only allowed for CGR, the value must be 10 if (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); new RemoveFromList<PublicCertificateI>(certificates, cert, "CGR_Certs"); } else { cert.setCertificateCount(1.0f); 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).setShare(); done.add(portfolio); } } } } @Override public boolean mustOwnATrain() { if (!hadPermanentTrain()) { return false; } else { return super.mustOwnATrain(); } } } |
From: Erik V. <ev...@us...> - 2009-09-04 18:40:39
|
Update of /cvsroot/rails/18xx/data/1856 In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27615/data/1856 Modified Files: CompanyManager.xml Log Message: Renamed PublicCompany_State to PublicCompany_CGR. Centralized CGR name there. Moved player limits to GameManager. Some method renaming. Index: CompanyManager.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1856/CompanyManager.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CompanyManager.xml 31 Aug 2009 22:32:52 -0000 1.28 --- CompanyManager.xml 4 Sep 2009 18:40:30 -0000 1.29 *************** *** 17,21 **** <!-- Number of loans is undefined and handled in the code --> </CompanyType> ! <CompanyType name="State" class="rails.game.specific._1856.PublicCompany_State"> <PoolPaysOut/> <ShareUnit percentage="5"/> --- 17,21 ---- <!-- Number of loans is undefined and handled in the code --> </CompanyType> ! <CompanyType name="State" class="rails.game.specific._1856.PublicCompany_CGR"> <PoolPaysOut/> <ShareUnit percentage="5"/> *************** *** 26,29 **** --- 26,30 ---- </BaseTokens> <Trains number="0,0,0,3"/> + <Options mustTradeTrainsAtFixedPrice="yes" canClose="no"/> </CompanyType> |
From: Erik V. <ev...@us...> - 2009-09-04 18:40:39
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27615/rails/game/specific/_18EU Modified Files: StockRound_18EU.java Log Message: Renamed PublicCompany_State to PublicCompany_CGR. Centralized CGR name there. Moved player limits to GameManager. Some method renaming. Index: StockRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StockRound_18EU.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** StockRound_18EU.java 3 Sep 2009 21:36:54 -0000 1.21 --- StockRound_18EU.java 4 Sep 2009 18:40:30 -0000 1.22 *************** *** 196,205 **** cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!playerMayBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, --- 196,205 ---- cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !mayPlayerBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, *************** *** 318,322 **** numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!playerMayBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; --- 318,322 ---- numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!mayPlayerBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; |
From: Erik V. <ev...@us...> - 2009-09-04 18:40:39
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27615/rails/game Modified Files: PlayerManager.java StockRound.java GameManagerI.java GameManager.java Log Message: Renamed PublicCompany_State to PublicCompany_CGR. Centralized CGR name there. Moved player limits to GameManager. Some method renaming. Index: PlayerManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PlayerManager.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PlayerManager.java 3 Sep 2009 21:36:53 -0000 1.8 --- PlayerManager.java 4 Sep 2009 18:40:30 -0000 1.9 *************** *** 22,33 **** private int[] playerCertificateLimits = new int[Player.MAX_PLAYERS]; - private int playerCertificateLimit = 0; - public PlayerManager() { ! } public void configureFromXML(Tag tag) throws ConfigurationException { ! int number, startCash, certLimit; --- 22,31 ---- private int[] playerCertificateLimits = new int[Player.MAX_PLAYERS]; public PlayerManager() { ! } public void configureFromXML(Tag tag) throws ConfigurationException { ! int number, startCash, certLimit; *************** *** 41,52 **** certLimit = playerTag.getAttributeAsInteger("certLimit"); playerCertificateLimits[number] = certLimit; ! minPlayers = Math.min(minPlayers, number); maxPlayers = Math.max(maxPlayers, number); } } ! public void setPlayers (List<String> playerNames, int startCash) { ! Player player; --- 39,50 ---- certLimit = playerTag.getAttributeAsInteger("certLimit"); playerCertificateLimits[number] = certLimit; ! minPlayers = Math.min(minPlayers, number); maxPlayers = Math.max(maxPlayers, number); } } ! public void setPlayers (List<String> playerNames, int startCash) { ! Player player; *************** *** 70,75 **** ReportBuffer.add(LocalText.getText("BankHas", Bank.format(Bank.getInstance().getCash()))); - - playerCertificateLimit = playerCertificateLimits[numberOfPlayers]; } --- 68,71 ---- *************** *** 92,106 **** return players.get(index); } ! public int getStartCash () { return playerStartCash[numberOfPlayers]; } ! public int getPlayerCertificateLimit() { ! return playerCertificateLimit; ! } ! ! public void setPlayerCertificateLimit(int playerCertificateLimit) { ! this.playerCertificateLimit = playerCertificateLimit; } --- 88,101 ---- return players.get(index); } ! public int getStartCash () { return playerStartCash[numberOfPlayers]; } ! /** Only to be called at initialisation time. ! * Does not reflect later changes to this limit. ! */ ! public int getInitialPlayerCertificateLimit() { ! return playerCertificateLimits[numberOfPlayers]; } Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** GameManager.java 3 Sep 2009 21:36:53 -0000 1.46 --- GameManager.java 4 Sep 2009 18:40:30 -0000 1.47 *************** *** 56,59 **** --- 56,61 ---- protected int playerShareLimit = 60; protected int treasuryShareLimit = 50; // For some games + protected IntegerState playerCertificateLimit + = new IntegerState ("PlayerCertificateLimit", 0); protected int currentNumberOfOperatingRounds = 1; protected boolean skipFirstStockRound = false; *************** *** 327,330 **** --- 329,333 ---- numberOfPlayers = players.size(); priorityPlayer.setState(players.get(0)); + setPlayerCertificateLimit (playerManager.getInitialPlayerCertificateLimit()); setGameParameters(); *************** *** 853,857 **** } ! /* (non-Javadoc) * @see rails.game.GameManagerI#getAllPublicCompanies() */ --- 856,872 ---- } ! public int getPlayerCertificateLimit() { ! return playerCertificateLimit.intValue(); ! } ! ! public void setPlayerCertificateLimit(int newLimit) { ! playerCertificateLimit.set (newLimit); ! } ! ! public IntegerState getPlayerCertificateLimitModel () { ! return playerCertificateLimit; ! } ! ! /* (non-Javadoc) * @see rails.game.GameManagerI#getAllPublicCompanies() */ Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GameManagerI.java 3 Sep 2009 21:36:53 -0000 1.4 --- GameManagerI.java 4 Sep 2009 18:40:30 -0000 1.5 *************** *** 5,8 **** --- 5,9 ---- import rails.common.Defs; import rails.game.action.PossibleAction; + import rails.game.model.ModelObject; import rails.util.Tag; *************** *** 142,149 **** public abstract PhaseManager getPhaseManager(); ! public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); public abstract String getHelp(); --- 143,153 ---- public abstract PhaseManager getPhaseManager(); ! public abstract TrainManagerI getTrainManager (); public PlayerManager getPlayerManager(); + public int getPlayerCertificateLimit(); + public void setPlayerCertificateLimit(int newLimit); + public ModelObject getPlayerCertificateLimitModel (); public abstract String getHelp(); *************** *** 158,162 **** public abstract Object getCommonParameter(Defs.Parm key); ! public RoundI getInterruptedRound(); } \ No newline at end of file --- 162,166 ---- public abstract Object getCommonParameter(Defs.Parm key); ! public RoundI getInterruptedRound(); } \ No newline at end of file Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** StockRound.java 3 Sep 2009 21:36:53 -0000 1.39 --- StockRound.java 4 Sep 2009 18:40:30 -0000 1.40 *************** *** 74,78 **** sequenceRule = gameManager.getStockRoundSequenceRule(); ! } --- 74,78 ---- sequenceRule = gameManager.getStockRoundSequenceRule(); ! } *************** *** 224,232 **** number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!playerMayBuyCompanyShare(currentPlayer, comp, number)) continue; /* Would the player exceed the total certificate limit? */ if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, comp, number)) continue; } --- 224,232 ---- number = 1; /* Would the player exceed the per-company share hold limit? */ ! if (!mayPlayerBuyCompanyShare(currentPlayer, comp, number)) continue; /* Would the player exceed the total certificate limit? */ if (!stockSpace.isNoCertLimit() ! && !mayPlayerBuyCertificate(currentPlayer, comp, number)) continue; } *************** *** 252,261 **** cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!playerMayBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, --- 252,261 ---- cert = certs.get(0); if (isSaleRecorded(currentPlayer, company)) continue; ! if (!mayPlayerBuyCompanyShare(currentPlayer, company, 1)) continue; if (currentPlayer.maxAllowedNumberOfSharesToBuy(company, certs.get(0).getShare()) < 1) continue; stockSpace = company.getCurrentSpace(); if (!stockSpace.isNoCertLimit() ! && !mayPlayerBuyCertificate(currentPlayer, company, 1)) continue; if (company.getMarketPrice() <= playerCash) { possibleActions.add(new BuyCertificate(cert, *************** *** 492,496 **** numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!playerMayBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; --- 492,496 ---- numberOfCertsToBuy = shares - (cert.getShares() - 1); // Check if the player may buy that many certificates. ! if (!mayPlayerBuyCertificate(currentPlayer, company, numberOfCertsToBuy)) { errMsg = LocalText.getText("CantBuyMoreCerts"); break; *************** *** 665,673 **** // (shortcut: assume 1 cert == 1 certificate) if (!currentSpace.isNoCertLimit() ! && !playerMayBuyCertificate(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() + LocalText.getText("WouldExceedCertLimit", ! String.valueOf(playerManager.getPlayerCertificateLimit())); break; } --- 665,673 ---- // (shortcut: assume 1 cert == 1 certificate) if (!currentSpace.isNoCertLimit() ! && !mayPlayerBuyCertificate(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() + LocalText.getText("WouldExceedCertLimit", ! String.valueOf(gameManager.getPlayerCertificateLimit())); break; } *************** *** 675,679 **** // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !playerMayBuyCompanyShare(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() --- 675,679 ---- // Check if player would exceed the per-company share limit if (!currentSpace.isNoHoldLimit() ! && !mayPlayerBuyCompanyShare(currentPlayer, company, shares)) { errMsg = currentPlayer.getName() *************** *** 1169,1180 **** */ public boolean mayCurrentPlayerBuyAnything() { ! return !playerIsOverLimits(currentPlayer) && companyBoughtThisTurnWrapper.getObject() == null; } ! protected boolean playerIsOverLimits(Player player) { // Over the total certificate hold Limit? ! if (player.getPortfolio().getCertificateCount() > playerManager.getPlayerCertificateLimit()) return true; --- 1169,1180 ---- */ public boolean mayCurrentPlayerBuyAnything() { ! return !isPlayerOverLimits(currentPlayer) && companyBoughtThisTurnWrapper.getObject() == null; } ! protected boolean isPlayerOverLimits(Player player) { // Over the total certificate hold Limit? ! if (player.getPortfolio().getCertificateCount() > gameManager.getPlayerCertificateLimit()) return true; *************** *** 1182,1186 **** for (PublicCompanyI company : Game.getCompanyManager().getAllPublicCompanies()) { if (company.hasStarted() && company.hasStockPrice() ! && !playerMayBuyCompanyShare(player, company, 0)) return true; } --- 1182,1186 ---- for (PublicCompanyI company : Game.getCompanyManager().getAllPublicCompanies()) { if (company.hasStarted() && company.hasStockPrice() ! && !mayPlayerBuyCompanyShare(player, company, 0)) return true; } *************** *** 1195,1202 **** * @return True if it is allowed. */ ! public boolean playerMayBuyCertificate(Player player, PublicCompanyI comp, int number) { if (comp.hasFloated() && comp.getCurrentSpace().isNoCertLimit()) return true; ! if (player.getPortfolio().getCertificateCount() + number > playerManager.getPlayerCertificateLimit()) return false; return true; --- 1195,1202 ---- * @return True if it is allowed. */ ! public boolean mayPlayerBuyCertificate(Player player, PublicCompanyI comp, int number) { if (comp.hasFloated() && comp.getCurrentSpace().isNoCertLimit()) return true; ! if (player.getPortfolio().getCertificateCount() + number > gameManager.getPlayerCertificateLimit()) return false; return true; *************** *** 1212,1216 **** * @return True if it is allowed. */ ! public boolean playerMayBuyCompanyShare(Player player, PublicCompanyI company, int number) { // Check for per-company share limit if (player.getPortfolio().getShare(company) + number * company.getShareUnit() > Player.getShareLimit() --- 1212,1216 ---- * @return True if it is allowed. */ ! public boolean mayPlayerBuyCompanyShare(Player player, PublicCompanyI company, int number) { // Check for per-company share limit if (player.getPortfolio().getShare(company) + number * company.getShareUnit() > Player.getShareLimit() *************** *** 1219,1223 **** } ! public static void setNoSaleInFirstSR() { noSaleInFirstSR = true; --- 1219,1223 ---- } ! public static void setNoSaleInFirstSR() { noSaleInFirstSR = true; |
From: Erik V. <ev...@us...> - 2009-09-04 18:38:23
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27467/rails/game Modified Files: PublicCompanyI.java PublicCompany.java StockMarket.java Log Message: Added canClose attribute - CGR cannot close. StockMarket checks this Index: StockMarket.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockMarket.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** StockMarket.java 4 May 2009 20:29:14 -0000 1.15 --- StockMarket.java 4 Sep 2009 18:38:11 -0000 1.16 *************** *** 216,220 **** prepareMove(company, oldsquare, newsquare); } ! public void close (PublicCompanyI company) { prepareMove(company, company.getCurrentSpace(), null); --- 216,220 ---- prepareMove(company, oldsquare, newsquare); } ! public void close (PublicCompanyI company) { prepareMove(company, company.getCurrentSpace(), null); *************** *** 234,237 **** --- 234,241 ---- newrow--; + // Check if company may enter a "Closed" area + while (getStockSpace(newrow, col).closesCompany() && !company.canClose()) + newrow--; + /* * If marker landed just below a ledge, and NOT because it was bounced *************** *** 261,269 **** int col = oldsquare.getColumn(); if (col < numCols - 1 && !oldsquare.isLeftOfLedge() ! && (newsquare = getStockSpace(row, col + 1)) != null) {} else if (row > 0 ! && (newsquare = ! getStockSpace( ! row - 1, ! col)) != null) {} prepareMove(company, oldsquare, newsquare); } --- 265,272 ---- int col = oldsquare.getColumn(); if (col < numCols - 1 && !oldsquare.isLeftOfLedge() ! && (newsquare = getStockSpace(row, col + 1)) != null) {} ! else if (row > 0 ! && (newsquare = getStockSpace(row - 1, col)) != null) {} ! if (newsquare == oldsquare) return; prepareMove(company, oldsquare, newsquare); } *************** *** 274,283 **** int row = oldsquare.getRow(); int col = oldsquare.getColumn(); ! if (col > 0 && (newsquare = getStockSpace(row, col - 1)) != null) {} else if (row < numRows - 1 ! && (newsquare = ! getStockSpace( ! row + 1, ! col)) != null) {} ! if (newsquare != oldsquare && newsquare.closesCompany()) { company.setClosed(); oldsquare.removeToken(company); --- 277,286 ---- int row = oldsquare.getRow(); int col = oldsquare.getColumn(); ! if (col > 0 && (newsquare = getStockSpace(row, col - 1)) != null) {} ! else if (row < numRows - 1 && ! (newsquare = getStockSpace(row + 1, col)) != null) {} ! if (newsquare == oldsquare) return; ! if (newsquare.closesCompany()) { ! if (!company.canClose()) return; // E.g. 1856 CGR company.setClosed(); oldsquare.removeToken(company); Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** PublicCompany.java 2 Sep 2009 21:47:47 -0000 1.55 --- PublicCompany.java 4 Sep 2009 18:38:11 -0000 1.56 *************** *** 220,223 **** --- 220,228 ---- protected boolean mustTradeTrainsAtFixedPrice = false; + /** Can the company price token go down to a "Close" square? + * 1856 CGR cannot. + */ + protected boolean canClose = true; + /** Initial train at floating time */ protected String initialTrain = null; *************** *** 230,234 **** protected int maxLoansPerRound = 0; protected MoneyModel currentLoanValue = null; ! protected BooleanState canSharePriceVary = null; --- 235,239 ---- protected int maxLoansPerRound = 0; protected MoneyModel currentLoanValue = null; ! protected BooleanState canSharePriceVary = null; *************** *** 551,554 **** --- 556,566 ---- maxLoansPerRound = loansTag.getAttributeAsInteger("perRound", -1); } + + Tag optionsTag = tag.getChild("Options"); + if (optionsTag != null) { + mustTradeTrainsAtFixedPrice = optionsTag.getAttributeAsBoolean + ("mustTradeTrainsAtFixedPrice", mustTradeTrainsAtFixedPrice); + canClose = optionsTag.getAttributeAsBoolean("canClose", canClose); + } } *************** *** 772,776 **** return mustHaveOperatedToTradeShares; } ! public void start(StockSpaceI startSpace) { --- 784,788 ---- return mustHaveOperatedToTradeShares; } ! public void start(StockSpaceI startSpace) { *************** *** 1415,1419 **** return portfolio.getNumberOfTrains() > 0; } ! /** * Must be called in stead of Portfolio.buyTrain if side-effects can occur. --- 1427,1431 ---- return portfolio.getNumberOfTrains() > 0; } ! /** * Must be called in stead of Portfolio.buyTrain if side-effects can occur. *************** *** 1692,1696 **** } ! @Override public Object clone() { --- 1704,1712 ---- } ! public boolean canClose() { ! return canClose; ! } ! ! @Override public Object clone() { Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** PublicCompanyI.java 2 Sep 2009 21:47:47 -0000 1.32 --- PublicCompanyI.java 4 Sep 2009 18:38:11 -0000 1.33 *************** *** 246,252 **** public boolean hasParPrice(); ! public boolean canSharePriceVary(); ! public boolean isSplitAllowed(); --- 246,252 ---- public boolean hasParPrice(); ! public boolean canSharePriceVary(); ! public boolean isSplitAllowed(); *************** *** 267,271 **** public int getNumberOfTrains(); public boolean canRunTrains(); ! public void initTurn(); --- 267,271 ---- public int getNumberOfTrains(); public boolean canRunTrains(); ! public void initTurn(); *************** *** 337,340 **** --- 337,341 ---- public int getMaxNumberOfLoans(); public boolean canLoan(); + public boolean canClose(); public int getMaxLoansPerRound(); public int getValuePerLoan(); |
From: Erik V. <ev...@us...> - 2009-09-04 18:36:18
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27335/rails/ui/swing Modified Files: GameStatus.java Log Message: Made certificate limit variable for UI Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GameStatus.java 3 Sep 2009 21:36:54 -0000 1.25 --- GameStatus.java 4 Sep 2009 18:35:53 -0000 1.26 *************** *** 466,470 **** addField(new Caption(LocalText.getText("LIMIT")), certLimitXOffset - 1, certLimitYOffset, 1, 1, WIDE_TOP + WIDE_LEFT); ! addField(new Field("" + gameUIManager.getGameManager().getPlayerManager().getPlayerCertificateLimit()), certLimitXOffset, certLimitYOffset, 1, 1, WIDE_TOP); --- 466,470 ---- addField(new Caption(LocalText.getText("LIMIT")), certLimitXOffset - 1, certLimitYOffset, 1, 1, WIDE_TOP + WIDE_LEFT); ! addField(new Field(gameUIManager.getGameManager().getPlayerCertificateLimitModel()), certLimitXOffset, certLimitYOffset, 1, 1, WIDE_TOP); |
From: Erik V. <ev...@us...> - 2009-09-04 18:36:01
|
Update of /cvsroot/rails/18xx/rails/game/state In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27335/rails/game/state Modified Files: IntegerState.java Log Message: Made certificate limit variable for UI Index: IntegerState.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/state/IntegerState.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IntegerState.java 11 Jun 2008 19:53:27 -0000 1.3 --- IntegerState.java 4 Sep 2009 18:35:53 -0000 1.4 *************** *** 1,4 **** /* $Header$ ! * * Created on May 19, 2007 * Change Log: --- 1,4 ---- /* $Header$ ! * * Created on May 19, 2007 * Change Log: *************** *** 40,42 **** --- 40,47 ---- return ((Integer) object).intValue(); } + + @Override + public String getText() { + return ""+intValue(); + } } |