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...> - 2010-03-05 20:50:43
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3051/rails/ui/swing Modified Files: GameStatus.java Log Message: Reinstated full train cost list Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** GameStatus.java 4 Mar 2010 22:08:24 -0000 1.41 --- GameStatus.java 5 Mar 2010 20:50:35 -0000 1.42 *************** *** 510,519 **** futureTrainsWidth, 1, 0, true); ! // Train cost overview - removed, now added to Info menu ! /* String text = gameUIManager.getGameManager().getTrainManager().getTrainCostOverview(); addField (new Caption(text), poolTrainsXOffset, newTrainsYOffset + 1, futureTrainsWidth + 2, 1, 0, true); - */ dummyButton = new ClickField("", "", "", this, buySellGroup); --- 510,517 ---- futureTrainsWidth, 1, 0, true); ! // Train cost overview String text = gameUIManager.getGameManager().getTrainManager().getTrainCostOverview(); addField (new Caption(text), poolTrainsXOffset, newTrainsYOffset + 1, futureTrainsWidth + 2, 1, 0, true); dummyButton = new ClickField("", "", "", this, buySellGroup); |
From: Erik V. <ev...@us...> - 2010-03-05 20:49:53
|
Update of /cvsroot/rails/18xx/rails/game/action In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2824/rails/game/action Modified Files: BuyTrain.java Log Message: Suppress forced train buy message for minors Index: BuyTrain.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/BuyTrain.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** BuyTrain.java 28 Feb 2010 21:38:06 -0000 1.18 --- BuyTrain.java 5 Mar 2010 20:49:41 -0000 1.19 *************** *** 27,31 **** private String fromName; private int fixedCost = 0; ! private boolean hasNoTrains = false; // TODO Remove once route checking exists transient private List<TrainI> trainsForExchange = null; private String[] trainsForExchangeUniqueIds; --- 27,31 ---- private String fromName; private int fixedCost = 0; ! private boolean forcedBuyIfNoRoute = false; // TODO Remove once route checking exists transient private List<TrainI> trainsForExchange = null; private String[] trainsForExchangeUniqueIds; *************** *** 86,91 **** } ! public void setHasNoTrains(boolean hasNoTrains) { ! this.hasNoTrains = hasNoTrains; } --- 86,91 ---- } ! public void setForcedBuyIfNoRoute(boolean hasNoTrains) { ! this.forcedBuyIfNoRoute = hasNoTrains; } *************** *** 164,169 **** } ! public boolean hasNoTrains() { ! return hasNoTrains; } --- 164,169 ---- } ! public boolean isForcedBuyIfNoRoute() { ! return forcedBuyIfNoRoute; } *************** *** 249,253 **** fromName = (String) fields.get("fromName", fromName); fixedCost = fields.get("fixedCost", fixedCost); ! hasNoTrains = fields.get("hasNoTrains", hasNoTrains);//TEMPORARY trainsForExchangeUniqueIds = (String[]) fields.get("trainsForExchangeUniqueIds", trainsForExchangeUniqueIds); forcedExchange = fields.get("forcedExchange", forcedExchange); --- 249,253 ---- fromName = (String) fields.get("fromName", fromName); fixedCost = fields.get("fixedCost", fixedCost); ! forcedBuyIfNoRoute = fields.get("forcedBuyIfNoRoute", forcedBuyIfNoRoute);//TEMPORARY trainsForExchangeUniqueIds = (String[]) fields.get("trainsForExchangeUniqueIds", trainsForExchangeUniqueIds); forcedExchange = fields.get("forcedExchange", forcedExchange); |
From: Erik V. <ev...@us...> - 2010-03-05 20:49:49
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2824/rails/game Modified Files: OperatingRound.java Log Message: Suppress forced train buy message for minors Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** OperatingRound.java 3 Mar 2010 21:34:11 -0000 1.112 --- OperatingRound.java 5 Mar 2010 20:49:41 -0000 1.113 *************** *** 49,53 **** protected Map<String, Integer> tileLaysPerColour = new HashMap<String, Integer>(); - // protected GenericState<Map<String,Integer>> tileLaysPerColourState = null; protected List<LayBaseToken> currentNormalTokenLays = --- 49,52 ---- *************** *** 2344,2348 **** if (canBuyTrainNow) { BuyTrain action = new BuyTrain(train, ipo, cost); ! action.setHasNoTrains(!hasTrains); // TEMPORARY possibleActions.add(action); } --- 2343,2347 ---- if (canBuyTrainNow) { BuyTrain action = new BuyTrain(train, ipo, cost); ! action.setForcedBuyIfNoRoute(presidentMayHelp); // TEMPORARY possibleActions.add(action); } *************** *** 2377,2381 **** BuyTrain bt = new BuyTrain(train, ipo, reducedPrice); bt.setSpecialProperty(stb); ! bt.setHasNoTrains(!hasTrains); // TEMPORARY possibleActions.add(bt); } --- 2376,2380 ---- BuyTrain bt = new BuyTrain(train, ipo, reducedPrice); bt.setSpecialProperty(stb); ! bt.setForcedBuyIfNoRoute(presidentMayHelp); // TEMPORARY possibleActions.add(bt); } *************** *** 2394,2398 **** if (cost <= cash) { BuyTrain bt = new BuyTrain(train, pool, cost); ! bt.setHasNoTrains(!hasTrains); // TEMPORARY possibleActions.add(bt); } else if (costOfCheapestTrain == 0 --- 2393,2397 ---- if (cost <= cash) { BuyTrain bt = new BuyTrain(train, pool, cost); ! bt.setForcedBuyIfNoRoute(presidentMayHelp); // TEMPORARY possibleActions.add(bt); } else if (costOfCheapestTrain == 0 *************** *** 2407,2411 **** cheapestTrain.getHolder(), costOfCheapestTrain); bt.setPresidentMustAddCash(costOfCheapestTrain - cash); ! bt.setHasNoTrains(!hasTrains); // TODO TEMPORARY possibleActions.add(bt); } --- 2406,2410 ---- cheapestTrain.getHolder(), costOfCheapestTrain); bt.setPresidentMustAddCash(costOfCheapestTrain - cash); ! bt.setForcedBuyIfNoRoute(presidentMayHelp); // TODO TEMPORARY possibleActions.add(bt); } |
From: Erik V. <ev...@us...> - 2010-03-05 20:33:26
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29299/data/1835 Modified Files: TileSet.xml Log Message: Added missing tile upgrades Index: TileSet.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/TileSet.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TileSet.xml 31 Jan 2010 22:15:58 -0000 1.12 --- TileSet.xml 5 Mar 2010 20:33:18 -0000 1.13 *************** *** 44,51 **** <!-- yellow tiles --> ! <Tile id="1" quantity="1" /> ! <Tile id="2" quantity="1" /> ! <Tile id="3" quantity="2" /> ! <Tile id="4" quantity="3" /> <Tile id="5" quantity="3" > <Upgrade id="12,14,15,205,206" /> --- 44,59 ---- <!-- yellow tiles --> ! <Tile id="1" quantity="1"> ! <Upgrade id="88"/> ! </Tile> ! <Tile id="2" quantity="1"> ! <Upgrade id="87"/> ! </Tile> ! <Tile id="3" quantity="2"> ! <Upgrade id="87,88,204"/> ! </Tile> ! <Tile id="4" quantity="3"> ! <Upgrade id="87,88,204"/> ! </Tile> <Tile id="5" quantity="3" > <Upgrade id="12,14,15,205,206" /> *************** *** 63,73 **** <Upgrade id="18,19,20,23,24,26,27" /> </Tile> ! <Tile id="55" quantity="1" /> ! <Tile id="56" quantity="1" /> <Tile id="57" quantity="2"> <Upgrade id="14,15,205,206" /> </Tile> ! <Tile id="58" quantity="4" /> ! <Tile id="69" quantity="2" /> <Tile id="201" quantity="2"> <Upgrade id="207,208" /> --- 71,89 ---- <Upgrade id="18,19,20,23,24,26,27" /> </Tile> ! <Tile id="55" quantity="1"> ! <Upgrade id="88"/> ! </Tile> ! <Tile id="56" quantity="1"> ! <Upgrade id="87"/> ! </Tile> <Tile id="57" quantity="2"> <Upgrade id="14,15,205,206" /> </Tile> ! <Tile id="58" quantity="4"> ! <Upgrade id="87,88,203,204"/> ! </Tile> ! <Tile id="69" quantity="2"> ! <Upgrade id="204"/> ! </Tile> <Tile id="201" quantity="2"> <Upgrade id="207,208" /> *************** *** 84,93 **** <Upgrade id="63" /> </Tile> ! <Tile id="14" quantity="2"> ! <Upgrade id="63" /> ! </Tile> ! <Tile id="15" quantity="2"> ! <Upgrade id="63" /> ! </Tile> <Tile id="16" quantity="2"> <Upgrade id="43,70" /> --- 100,105 ---- <Upgrade id="63" /> </Tile> ! <Tile id="14" quantity="2"/> ! <Tile id="15" quantity="2"/> <Tile id="16" quantity="2"> <Upgrade id="43,70" /> *************** *** 109,113 **** </Tile> <Tile id="25" quantity="3"> ! <Upgrade id="40" /> </Tile> <Tile id="26" quantity="2"> --- 121,125 ---- </Tile> <Tile id="25" quantity="3"> ! <Upgrade id="40,45,46"/> </Tile> <Tile id="26" quantity="2"> *************** *** 142,151 **** <Upgrade id="220" /> </Tile> ! <Tile id="210" quantity="1" /> ! <Tile id="211" quantity="1" /> ! <Tile id="212" quantity="1" /> ! <Tile id="213" quantity="1" /> ! <Tile id="214" quantity="1" /> ! <Tile id="215" quantity="1" /> <!-- Brown tiles --> --- 154,175 ---- <Upgrade id="220" /> </Tile> ! <Tile id="210" quantity="1"> ! <Upgrade id="217"/> ! </Tile> ! <Tile id="211" quantity="1"> ! <Upgrade id="217"/> ! </Tile> ! <Tile id="212" quantity="1"> ! <Upgrade id="218"/> ! </Tile> ! <Tile id="213" quantity="1"> ! <Upgrade id="218"/> ! </Tile> ! <Tile id="214" quantity="1"> ! <Upgrade id="219"/> ! </Tile> ! <Tile id="215" quantity="1"> ! <Upgrade id="218"/> ! </Tile> <!-- Brown tiles --> |
From: Erik V. <ev...@us...> - 2010-03-05 20:22:56
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25120/data/1835 Modified Files: CompanyManager.xml Log Message: Fixed PfB special property location (L6, not J6) Index: CompanyManager.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/CompanyManager.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CompanyManager.xml 4 Mar 2010 22:07:55 -0000 1.29 --- CompanyManager.xml 5 Mar 2010 20:22:48 -0000 1.30 *************** *** 55,62 **** <SpecialProperties> <SpecialProperty condition="ifOwnedByPlayer" when="tileLayingStep" class="rails.game.special.SpecialTileLay"> ! <SpecialTileLay location="J6" extra="yes" free="yes" /> </SpecialProperty> <SpecialProperty condition="ifOwnedByPlayer" when="orTurn" class="rails.game.special.SpecialTokenLay"> ! <SpecialTokenLay location="J6" extra="yes" free="yes"/> </SpecialProperty> </SpecialProperties> --- 55,62 ---- <SpecialProperties> <SpecialProperty condition="ifOwnedByPlayer" when="tileLayingStep" class="rails.game.special.SpecialTileLay"> ! <SpecialTileLay location="L6" extra="yes" free="yes" /> </SpecialProperty> <SpecialProperty condition="ifOwnedByPlayer" when="orTurn" class="rails.game.special.SpecialTokenLay"> ! <SpecialTokenLay location="L6" extra="yes" free="yes"/> </SpecialProperty> </SpecialProperties> |
From: Erik V. <ev...@us...> - 2010-03-05 20:17:49
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20806/rails/game Modified Files: MapManager.java PublicCompany.java Log Message: Fixed 1835 token cost algorithm Index: MapManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapManager.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MapManager.java 20 Feb 2010 12:42:54 -0000 1.19 --- MapManager.java 5 Mar 2010 20:17:30 -0000 1.20 *************** *** 24,28 **** protected Map<String, MapHex> mHexes = new HashMap<String, MapHex>(); protected int maxX, maxY; ! // upgrade costs on the map for noMapMode protected SortedSet<Integer> possibleTileCosts; --- 24,28 ---- protected Map<String, MapHex> mHexes = new HashMap<String, MapHex>(); protected int maxX, maxY; ! // upgrade costs on the map for noMapMode protected SortedSet<Integer> possibleTileCosts; *************** *** 96,100 **** } log.debug("Possible tileCosts on map are "+possibleTileCosts); ! hexes = new MapHex[1 + maxX][1 + maxY]; --- 96,100 ---- } log.debug("Possible tileCosts on map are "+possibleTileCosts); ! hexes = new MapHex[1 + maxX][1 + maxY]; *************** *** 235,260 **** */ public int getHexDistance (MapHex hex1, MapHex hex2) { ! Map<MapHex, Integer> passed = new HashMap<MapHex, Integer>(); ! return calculateHexDistance (hex1, hex2, 1, passed); } ! ! /** Cache to hold distances between tokenable cities */ ! private Map<MapHex, int[]> distanceMap; ! ! /** * Calculate the distances between a given tokenable city hex ! * and all other tokenable city hexes. * <p> The array is cached, so it need be calculated only once. * @param hex Start hex ! * @return Sorted int array containing all occurring distances only once. */ public int[] getCityDistances (MapHex hex) { if (!hex.getCurrentTile().hasStations()) return new int[0]; ! if (distanceMap == null) distanceMap = new HashMap<MapHex, int[]> (); ! if (distanceMap.containsKey(hex)) return distanceMap.get(hex); ! int distance; ! Set<Integer> distancesSet = new TreeSet<Integer> (); for (MapHex hex2 : mHexes.values()) { if (!hex2.getCurrentTile().hasStations()) continue; --- 235,286 ---- */ public int getHexDistance (MapHex hex1, MapHex hex2) { ! ! if (distances == null) distances = new HashMap<MapHex, Map<MapHex, Integer>> (); ! if (distances.get(hex1) == null) { ! distances.put(hex1, new HashMap<MapHex, Integer>()); ! calculateHexDistances(hex1, hex1, 0); ! } ! return distances.get(hex1).get(hex2); } ! ! private void calculateHexDistances (MapHex hex1, MapHex hex2, int depth) { ! ! if (distances.get(hex1).get(hex2) == null) { ! distances.get(hex1).put(hex2, depth); ! } else { ! if (distances.get(hex1).get(hex2) <= depth) return; ! distances.get(hex1).put(hex2, depth); ! } ! ! for (MapHex hex3 : hex2.getNeighbors()) { ! if (hex3 == null) continue; ! if (distances.get(hex1).get(hex3) == null) { ! calculateHexDistances (hex1, hex3, depth+1); ! } else if (distances.get(hex1).get(hex3) > depth+1) { ! calculateHexDistances (hex1, hex3, depth+1); ! } ! } ! } ! ! /** Cache to hold all unique distance values of tokenable cities from a given hex */ ! private Map<MapHex, int[]> uniqueCityDistances; ! /** Cache to hold all minimal hex distances from given hexes */ ! private Map<MapHex, Map<MapHex, Integer>> distances; ! ! /** * Calculate the distances between a given tokenable city hex ! * and all other tokenable city hexes. * <p> The array is cached, so it need be calculated only once. * @param hex Start hex ! * @return Sorted int array containing all occurring distances only once. */ public int[] getCityDistances (MapHex hex) { if (!hex.getCurrentTile().hasStations()) return new int[0]; ! if (uniqueCityDistances == null) uniqueCityDistances = new HashMap<MapHex, int[]> (); ! if (uniqueCityDistances.containsKey(hex)) return uniqueCityDistances.get(hex); ! int distance; ! Set<Integer> distancesSet = new TreeSet<Integer> (); for (MapHex hex2 : mHexes.values()) { if (!hex2.getCurrentTile().hasStations()) continue; *************** *** 267,314 **** distances[i++] = distance2; } ! distanceMap.put(hex, distances); return distances; } - /** Helper method to calculate the distance between two hexes. - * Called recursively. */ - private int calculateHexDistance (MapHex hex1, MapHex hex2, int depth, - Map<MapHex, Integer> passed) { - - /* Map to sort the neighbours (roughly) into decreasing distance */ - SortedMap<Integer, MapHex> neighbours = new TreeMap<Integer, MapHex>(); - - for (MapHex hex3 : hex1.getNeighbors()) { - - if (hex3 == null) continue; - - // Are we finished? - if (hex3 == hex2) { - return 1; - } - - if (passed.containsKey(hex3) && passed.get(hex3) < depth - 1) { - // Backtrack - return -1; - } - - // Sort neighbours on decreasing (rough) distance - int distance = Math.abs(hex2.getX() - hex3.getX()) - + Math.abs(hex2.getY() - hex3.getY()); - neighbours.put(distance, hex3); - } - passed.put (hex1, depth); - for (MapHex neighbour : neighbours.values()) { - if (passed.containsKey(neighbour)) continue; - int result = calculateHexDistance (neighbour, hex2, depth+1, passed); - if (result < 0) { - return 0; // Continue backtracking - } else if (result > 0) { - return result + 1; - } - // Continue loop if result == 0 - } - // Should never get here - return 0; - } } --- 293,299 ---- distances[i++] = distance2; } ! uniqueCityDistances.put(hex, distances); return distances; } } Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** PublicCompany.java 4 Mar 2010 22:08:09 -0000 1.90 --- PublicCompany.java 5 Mar 2010 20:17:32 -0000 1.91 *************** *** 1692,1696 **** return baseTokenLayCost[0]; } else { ! return mapManager.getHexDistance(hex, homeHex) * baseTokenLayCost[0]; } } else { --- 1692,1696 ---- return baseTokenLayCost[0]; } else { ! return mapManager.getHexDistance(homeHex, hex) * baseTokenLayCost[0]; } } else { |
From: Erik V. <ev...@us...> - 2010-03-04 22:15:57
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18865/rails/game Modified Files: StockRound.java Log Message: Various changes for 1835 Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** StockRound.java 4 Mar 2010 21:16:56 -0000 1.66 --- StockRound.java 4 Mar 2010 22:15:49 -0000 1.67 *************** *** 97,101 **** // fix of the forced undo bug currentPlayer = getCurrentPlayer(); ! boolean passAllowed = false; --- 97,101 ---- // fix of the forced undo bug currentPlayer = getCurrentPlayer(); ! boolean passAllowed = false; *************** *** 151,154 **** --- 151,155 ---- int price; int number; + int unitsForPrice; int playerCash = currentPlayer.getCash(); *************** *** 170,173 **** --- 171,175 ---- cert = certs.get(0); comp = cert.getCompany(); + unitsForPrice = comp.getShareUnitsForSharePrice(); if (isSaleRecorded(currentPlayer, comp)) continue; if (maxAllowedNumberOfSharesToBuy(currentPlayer, comp, *************** *** 176,180 **** if (!cert.isPresidentShare()) { ! price = comp.getIPOPrice(); if (price <= playerCash) { possibleActions.add(new BuyCertificate(cert, from, --- 178,182 ---- if (!cert.isPresidentShare()) { ! price = comp.getIPOPrice() / unitsForPrice; if (price <= playerCash) { possibleActions.add(new BuyCertificate(cert, from, *************** *** 183,187 **** } else if (!comp.hasStarted()) { if (comp.getIPOPrice() != 0) { ! price = comp.getIPOPrice() * cert.getShares(); if (price <= playerCash) { possibleActions.add(new StartCompany(cert, price)); --- 185,189 ---- } else if (!comp.hasStarted()) { if (comp.getIPOPrice() != 0) { ! price = comp.getIPOPrice() * cert.getShares() / unitsForPrice; if (price <= playerCash) { possibleActions.add(new StartCompany(cert, price)); *************** *** 225,232 **** comp = certs.get(0).getCompany(); stockSpace = comp.getCurrentSpace(); ! price = stockSpace.getPrice(); shareUnit = comp.getShareUnit(); maxNumberOfSharesToBuy ! = maxAllowedNumberOfSharesToBuy(currentPlayer, comp, shareUnit); /* Checks if the player can buy any shares of this company */ --- 227,235 ---- comp = certs.get(0).getCompany(); stockSpace = comp.getCurrentSpace(); ! unitsForPrice = comp.getShareUnitsForSharePrice(); ! price = stockSpace.getPrice() / unitsForPrice; shareUnit = comp.getShareUnit(); maxNumberOfSharesToBuy ! = maxAllowedNumberOfSharesToBuy(currentPlayer, comp, shareUnit); /* Checks if the player can buy any shares of this company */ *************** *** 246,283 **** numberOfCerts = new int[5]; for (PublicCertificateI cert2 : certs) { ! shares = cert2.getShares(); if (maxNumberOfSharesToBuy < shares) continue; ! numberOfCerts[shares]++; ! if (uniqueCerts[shares] != null) continue; ! uniqueCerts[shares] = cert2; } /* Create a BuyCertificate action per share size */ for (shares = 1; shares < 5; shares++) { ! /* Only certs in the brown zone may be bought all at once */ ! number = numberOfCerts[shares]; ! if (number == 0) continue; ! if (!stockSpace.isNoBuyLimit()) { ! 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; ! } ! // Does the player have enough cash? ! while (number > 0 && playerCash < number * price * shares) { ! number--; ! } ! if (number > 0) { ! possibleActions.add(new BuyCertificate(uniqueCerts[shares], ! from, price, ! number)); ! } } } --- 249,286 ---- numberOfCerts = new int[5]; for (PublicCertificateI cert2 : certs) { ! shares = cert2.getShares(); if (maxNumberOfSharesToBuy < shares) continue; ! numberOfCerts[shares]++; ! if (uniqueCerts[shares] != null) continue; ! uniqueCerts[shares] = cert2; } /* Create a BuyCertificate action per share size */ for (shares = 1; shares < 5; shares++) { ! /* Only certs in the brown zone may be bought all at once */ ! number = numberOfCerts[shares]; ! if (number == 0) continue; ! if (!stockSpace.isNoBuyLimit()) { ! 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; ! } ! // Does the player have enough cash? ! while (number > 0 && playerCash < number * price * shares) { ! number--; ! } ! if (number > 0) { ! possibleActions.add(new BuyCertificate(uniqueCerts[shares], ! from, price, ! number)); ! } } } *************** *** 396,399 **** --- 399,403 ---- price = company.getMarketPrice(); } + price /= company.getShareUnitsForSharePrice(); for (int i = 1; i <= 4; i++) { *************** *** 737,741 **** price = currentSpace.getPrice(); ! cost = shares * price; // Check if the Player has the money. --- 741,745 ---- price = currentSpace.getPrice(); ! cost = shares * price / company.getShareUnitsForSharePrice(); // Check if the Player has the money. *************** *** 948,972 **** && numberToSell <= presCert.getShares()) { // More to sell and we are President: see if we can dump it. ! // search for the player with the most shares (fix of bug 2962977) ! int requiredShares = presCert.getShare(); ! Player potentialDirector = null; for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { ! Player otherPlayer = gameManager.getPlayerByIndex(i); ! int otherPlayerShares = otherPlayer.getPortfolio().getShare(company); ! if (otherPlayerShares >= requiredShares) { // Check if he has the right kind of share if (numberToSell > 1 || otherPlayer.getPortfolio().ownsCertificates( company, 1, false) >= 1) { ! potentialDirector = otherPlayer; ! requiredShares = otherPlayerShares + 1; } } } - // The poor sod. - dumpedPlayer = potentialDirector; - presSharesToSell = numberToSell; - numberToSell = 0; } // Check if we could sell them all --- 952,972 ---- && numberToSell <= presCert.getShares()) { // More to sell and we are President: see if we can dump it. ! Player otherPlayer; for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { ! otherPlayer = gameManager.getPlayerByIndex(i); ! if (otherPlayer.getPortfolio().getShare(company) >= presCert.getShare()) { // Check if he has the right kind of share if (numberToSell > 1 || otherPlayer.getPortfolio().ownsCertificates( company, 1, false) >= 1) { ! // The poor sod. ! dumpedPlayer = otherPlayer; ! presSharesToSell = numberToSell; ! numberToSell = 0; ! break; } } } } // Check if we could sell them all *************** *** 1003,1007 **** } else { sellPrice = company.getCurrentSpace(); ! price = sellPrice.getPrice(); sellPrices.put(companyName, sellPrice); } --- 1003,1007 ---- } else { sellPrice = company.getCurrentSpace(); ! price = sellPrice.getPrice() / company.getShareUnitsForSharePrice(); sellPrices.put(companyName, sellPrice); } *************** *** 1075,1079 **** return true; } ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { company.adjustSharePrice (SOLD, numberSold, gameManager.getStockMarket()); --- 1075,1079 ---- return true; } ! protected void adjustSharePrice (PublicCompanyI company, int numberSold, boolean soldBefore) { company.adjustSharePrice (SOLD, numberSold, gameManager.getStockMarket()); |
From: Erik V. <ev...@us...> - 2010-03-04 22:12:49
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18090/rails/game/specific/_1835 Modified Files: GameManager_1835.java Log Message: |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:56
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17119 Modified Files: LocalisedText.properties Log Message: Various changes for 1835 Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** LocalisedText.properties 3 Mar 2010 00:45:17 -0000 1.115 --- LocalisedText.properties 4 Mar 2010 22:08:48 -0000 1.116 *************** *** 267,270 **** --- 267,271 ---- MayNotYetOperate={0} may not yet operate: {1}% sold whereas {2}% required MERGE=MERGE + MergeOption=Merge {0} ({1}) into {2} for a {3}% share of {2} MergeMinorConfirm=Do you want to merge minor {0} to start company {1}? MERGE_MINOR_LOG={0} merges minor {1} into {2}, with {3} cash and {4} train(s) *************** *** 489,492 **** --- 490,494 ---- TokenLayingHexMismatch=Token laid in {0} but special property is for {1}: mismatch TRADE_TREASURY_SHARES_TITLE=Rails: Game Status - TRADING TREASURY SHARES OF COMPANY {0} + TrainInfo={0}-train, price: {1}, quantity: {2} TrainsAvailable={0}-trains are now available. TrainsRusted=All {0}-trains have rusted and have been removed. |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:43
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17094/rails/ui/swing/gamespecific/_1835 Modified Files: StatusWindow_1835.java Log Message: Various changes for 1835 Index: StatusWindow_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StatusWindow_1835.java 28 Feb 2010 21:38:06 -0000 1.1 --- StatusWindow_1835.java 4 Mar 2010 22:08:35 -0000 1.2 *************** *** 6,12 **** import rails.game.*; ! import rails.game.specific._1835.FoldIntoPrussian; ! import rails.game.specific._1835.PrussianFormationRound; ! import rails.game.specific._1835.StockRound_1835; import rails.ui.swing.GameUIManager; import rails.ui.swing.StatusWindow; --- 6,11 ---- import rails.game.*; ! import rails.game.special.ExchangeForShare; ! import rails.game.specific._1835.*; import rails.ui.swing.GameUIManager; import rails.ui.swing.StatusWindow; *************** *** 16,20 **** public class StatusWindow_1835 extends StatusWindow { ! PublicCompanyI prussian; --- 15,19 ---- public class StatusWindow_1835 extends StatusWindow { ! PublicCompanyI prussian; *************** *** 24,29 **** super(); } ! ! public void init (GameUIManager gameUIManager) { super.init(gameUIManager); prussian = gameUIManager.getGameManager().getCompanyManager().getCompanyByName(StockRound_1835.PR_ID); --- 23,29 ---- super(); } ! ! @Override ! public void init (GameUIManager gameUIManager) { super.init(gameUIManager); prussian = gameUIManager.getGameManager().getCompanyManager().getCompanyByName(StockRound_1835.PR_ID); *************** *** 63,72 **** List<CompanyI> foldables = action.getFoldableCompanies(); JDialog currentDialog; ! if (foldables.get(0).getName().equals("M2")) { // Ask if the Prussian should be started currentDialog = new ConfirmationDialog (gameUIManager, LocalText.getText("Select"), ! LocalText.getText("MergeMinorConfirm", "M2", StockRound_1835.PR_ID), "Yes", --- 63,72 ---- List<CompanyI> foldables = action.getFoldableCompanies(); JDialog currentDialog; ! if (foldables.get(0).getName().equals("M2")) { // Ask if the Prussian should be started currentDialog = new ConfirmationDialog (gameUIManager, LocalText.getText("Select"), ! LocalText.getText("MergeMinorConfirm", "M2", StockRound_1835.PR_ID), "Yes", *************** *** 75,80 **** // Ask if any other prePrussians should be folded String[] options = new String[foldables.size()]; ! for (int i=0; i<=options.length; i++) { ! options[i] = foldables.get(i).getName(); } currentDialog = new CheckBoxDialog (gameUIManager, --- 75,87 ---- // Ask if any other prePrussians should be folded String[] options = new String[foldables.size()]; ! CompanyI company; ! for (int i=0; i<options.length; i++) { ! company = foldables.get(i); ! options[i] = LocalText.getText("MergeOption", ! company.getName(), ! company.getLongName(), ! prussian.getName(), ! ((ExchangeForShare)(company.getSpecialProperties().get(0))).getShare() ! ); } currentDialog = new CheckBoxDialog (gameUIManager, |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:34
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17059/rails/game/specific/_1835 Modified Files: GameManager_1835.java PrussianFormationRound.java Log Message: Various changes for 1835 Index: PrussianFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/PrussianFormationRound.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrussianFormationRound.java 2 Mar 2010 22:15:33 -0000 1.3 --- PrussianFormationRound.java 4 Mar 2010 22:08:24 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- package rails.game.specific._1835; + import java.util.ArrayList; import java.util.List; *************** *** 11,15 **** public class PrussianFormationRound extends StockRound { ! private PublicCompanyI prussian; private PhaseI phase; --- 12,16 ---- public class PrussianFormationRound extends StockRound { ! private PublicCompanyI prussian; private PhaseI phase; *************** *** 19,28 **** private boolean mergePr; private boolean forcedMerge; ! private enum Step { START, MERGE }; ! Step step; --- 20,29 ---- private boolean mergePr; private boolean forcedMerge; ! private enum Step { START, MERGE }; ! Step step; *************** *** 38,42 **** } ! public void start() { prussian = companyManager.getCompanyByName(PR_ID); --- 39,44 ---- } ! @Override ! public void start() { prussian = companyManager.getCompanyByName(PR_ID); *************** *** 50,100 **** log.debug("StartPr="+startPr+" forcedStart="+forcedStart +" mergePr="+mergePr+" forcedMerge="+forcedMerge); - - step = startPr ? Step.START : Step.MERGE; } ! public boolean setPossibleActions() { ! if (step == Step.START) { PublicCompanyI m2 = companyManager.getCompanyByName(M2_ID); Player m2Owner = m2.getPresident(); setCurrentPlayer(m2Owner); ! ReportBuffer.add(LocalText.getText("StartingPlayer", getCurrentPlayer().getName())); possibleActions.add(new FoldIntoPrussian(m2)); ! } else if (step == Step.MERGE) { ! SpecialPropertyI sp; ! for (PrivateCompanyI company : currentPlayer.getPortfolio().getPrivateCompanies()) { ! sp = company.getSpecialProperties().get(0); ! if (sp instanceof ExchangeForShare) { ! possibleActions.add(new FoldIntoPrussian(company)); ! } ! } ! PublicCompanyI company; ! List<SpecialPropertyI> sps; ! for (PublicCertificateI cert : currentPlayer.getPortfolio().getCertificates()) { ! if (!cert.isPresidentShare()) continue; ! company = cert.getCompany(); ! sps = company.getSpecialProperties(); ! if (sps != null && !sps.isEmpty() && sps.get(0) instanceof ExchangeForShare) { ! possibleActions.add(new FoldIntoPrussian(company)); ! } ! } } - return true; ! } ! ! protected boolean processGameSpecificAction(PossibleAction action) { if (action instanceof FoldIntoPrussian) { ! FoldIntoPrussian a = (FoldIntoPrussian) action; List<CompanyI> folded = a.getFoldedCompanies(); ! if (step == Step.START) { if (folded.isEmpty() || !startPrussian(a)) { --- 52,125 ---- log.debug("StartPr="+startPr+" forcedStart="+forcedStart +" mergePr="+mergePr+" forcedMerge="+forcedMerge); + step = startPr ? Step.START : Step.MERGE; + if (step == Step.MERGE) { + startingPlayer + = ((GameManager_1835)gameManager).getPrussianFormationStartingPlayer(); + setCurrentPlayer(startingPlayer); + } } ! @Override ! public boolean setPossibleActions() { ! if (step == Step.START) { PublicCompanyI m2 = companyManager.getCompanyByName(M2_ID); Player m2Owner = m2.getPresident(); + startingPlayer = m2Owner; setCurrentPlayer(m2Owner); ! ReportBuffer.add(LocalText.getText("StartingPlayer", getCurrentPlayer().getName())); possibleActions.add(new FoldIntoPrussian(m2)); ! } else if (step == Step.MERGE) { ! ! while (true) { ! List<CompanyI> foldables = new ArrayList<CompanyI> (); ! SpecialPropertyI sp; ! for (PrivateCompanyI company : currentPlayer.getPortfolio().getPrivateCompanies()) { ! sp = company.getSpecialProperties().get(0); ! if (sp instanceof ExchangeForShare) { ! foldables.add(company); ! } ! } ! PublicCompanyI company; ! List<SpecialPropertyI> sps; ! for (PublicCertificateI cert : currentPlayer.getPortfolio().getCertificates()) { ! if (!cert.isPresidentShare()) continue; ! company = cert.getCompany(); ! sps = company.getSpecialProperties(); ! if (sps != null && !sps.isEmpty() && sps.get(0) instanceof ExchangeForShare) { ! foldables.add(company); ! } ! } ! if (foldables.isEmpty()) { ! // No merge options for the current player, try the next one ! setNextPlayer(); ! if (getCurrentPlayer() == startingPlayer) { ! finishRound(); ! break; ! } else { ! continue; ! } ! } else { ! possibleActions.add(new FoldIntoPrussian(foldables)); ! break; ! } ! } } return true; ! } ! ! @Override ! protected boolean processGameSpecificAction(PossibleAction action) { if (action instanceof FoldIntoPrussian) { ! FoldIntoPrussian a = (FoldIntoPrussian) action; List<CompanyI> folded = a.getFoldedCompanies(); ! if (step == Step.START) { if (folded.isEmpty() || !startPrussian(a)) { *************** *** 106,110 **** if (!folded.isEmpty()) mergeIntoPrussian (a); } ! return true; } else { --- 131,141 ---- if (!folded.isEmpty()) mergeIntoPrussian (a); } ! ! // No merge options for the current player, try the next one ! setNextPlayer(); ! if (getCurrentPlayer() == startingPlayer) { ! finishRound(); ! } ! return true; } else { *************** *** 114,124 **** private boolean startPrussian (FoldIntoPrussian action) { ! // Validate String errMsg = null; ! while (true) { if (!(M2_ID.equals(action.getFoldedCompanyNames()))) { ! errMsg = LocalText.getText("WrongCompany", action.getFoldedCompanyNames(), M2_ID); --- 145,155 ---- private boolean startPrussian (FoldIntoPrussian action) { ! // Validate String errMsg = null; ! while (true) { if (!(M2_ID.equals(action.getFoldedCompanyNames()))) { ! errMsg = LocalText.getText("WrongCompany", action.getFoldedCompanyNames(), M2_ID); *************** *** 127,131 **** break; } ! if (errMsg != null) { DisplayBuffer.add(LocalText.getText("CannotMerge", --- 158,162 ---- break; } ! if (errMsg != null) { DisplayBuffer.add(LocalText.getText("CannotMerge", *************** *** 135,143 **** return false; } ! moveStack.start(false); ! // Execute prussian.start(); String message = LocalText.getText("START_MERGED_COMPANY", PR_ID, --- 166,176 ---- return false; } ! moveStack.start(false); ! // Execute prussian.start(); + prussian.setFloated(); + ((GameManager_1835)gameManager).setPrussianFormationStartingPlayer(currentPlayer); String message = LocalText.getText("START_MERGED_COMPANY", PR_ID, *************** *** 145,163 **** prussian.getStartSpace()); ReportBuffer.add(message); ! executeExchange (action.getFoldedCompanies(), true); ! return true; } ! private boolean mergeIntoPrussian (FoldIntoPrussian action) { ! // Validate String errMsg = null; ! while (true) { break; } ! if (errMsg != null) { DisplayBuffer.add(LocalText.getText("CannotMerge", --- 178,196 ---- prussian.getStartSpace()); ReportBuffer.add(message); ! executeExchange (action.getFoldedCompanies(), true); ! return true; } ! private boolean mergeIntoPrussian (FoldIntoPrussian action) { ! // Validate String errMsg = null; ! while (true) { break; } ! if (errMsg != null) { DisplayBuffer.add(LocalText.getText("CannotMerge", *************** *** 167,181 **** return false; } ! moveStack.start(false); ! // Execute ! executeExchange (action.getFoldedCompanies(), true); ! return true; } private void executeExchange (List<CompanyI> companies, boolean president) { ! ExchangeForShare efs; PublicCertificateI cert; --- 200,214 ---- return false; } ! moveStack.start(false); ! // Execute ! executeExchange (action.getFoldedCompanies(), false); ! return true; } private void executeExchange (List<CompanyI> companies, boolean president) { ! ExchangeForShare efs; PublicCertificateI cert; *************** *** 183,187 **** // Shortcut, sp should be checked efs = (ExchangeForShare) company.getSpecialProperties().get(0); ! cert = unavailable.findCertificate(prussian, efs.getShare(), president); cert.moveTo(currentPlayer.getPortfolio()); company.setClosed(); --- 216,221 ---- // Shortcut, sp should be checked efs = (ExchangeForShare) company.getSpecialProperties().get(0); ! cert = unavailable.findCertificate(prussian, efs.getShare()/prussian.getShareUnit(), ! president); cert.moveTo(currentPlayer.getPortfolio()); company.setClosed(); *************** *** 190,196 **** company.getName(), PR_ID, ! company instanceof PrivateCompanyI ? "no" : Bank.format(((PublicCompanyI)company).getCash()), ! company instanceof PrivateCompanyI ? "no" : ((PublicCompanyI)company).getPortfolio().getTrainList().size())); ReportBuffer.add(LocalText.getText("GetShareForMinor", --- 224,230 ---- company.getName(), PR_ID, ! company instanceof PrivateCompanyI ? "no" : Bank.format(((PublicCompanyI)company).getCash()), ! company instanceof PrivateCompanyI ? "no" : ((PublicCompanyI)company).getPortfolio().getTrainList().size())); ReportBuffer.add(LocalText.getText("GetShareForMinor", *************** *** 202,208 **** } } ! public static boolean prussianIsComplete(GameManagerI gameManager) { ! List<PublicCertificateI> unissued = gameManager.getBank().getUnavailable().getCertificatesPerCompany(PR_ID); return unissued == null || unissued.isEmpty(); --- 236,242 ---- } } ! public static boolean prussianIsComplete(GameManagerI gameManager) { ! List<PublicCertificateI> unissued = gameManager.getBank().getUnavailable().getCertificatesPerCompany(PR_ID); return unissued == null || unissued.isEmpty(); Index: GameManager_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/GameManager_1835.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameManager_1835.java 16 Feb 2010 20:25:38 -0000 1.1 --- GameManager_1835.java 4 Mar 2010 22:08:23 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- public static String PR_NAME = PrussianFormationRound.PR_ID; private RoundI previousRound; + private Player prFormStartingPlayer = null; public GameManager_1835() { *************** *** 15,20 **** @Override public void nextRound(RoundI round) { ! ! if (!(round instanceof PrussianFormationRound)) { PhaseI phase = getCurrentPhase(); if (phase.getName().equals("4") || phase.getName().equals("4+4") --- 16,23 ---- @Override public void nextRound(RoundI round) { ! ! if (round instanceof PrussianFormationRound) { ! super.nextRound(previousRound); ! } else { PhaseI phase = getCurrentPhase(); if (phase.getName().equals("4") || phase.getName().equals("4+4") *************** *** 23,31 **** previousRound = round; startPrussianFormationRound (); - return; } } } - super.nextRound(round); } --- 26,34 ---- previousRound = round; startPrussianFormationRound (); } + } else { + super.nextRound(round); } } } *************** *** 35,37 **** --- 38,48 ---- createRound (PrussianFormationRound.class).start (); } + + public void setPrussianFormationStartingPlayer(Player prFormStartingPlayer) { + this.prFormStartingPlayer = prFormStartingPlayer; + } + + public Player getPrussianFormationStartingPlayer() { + return prFormStartingPlayer; + } } |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:34
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17059/rails/ui/swing Modified Files: GameStatus.java ORPanel.java Log Message: Various changes for 1835 Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** GameStatus.java 3 Mar 2010 00:44:33 -0000 1.40 --- GameStatus.java 4 Mar 2010 22:08:24 -0000 1.41 *************** *** 510,517 **** futureTrainsWidth, 1, 0, true); ! // Train cost overview String text = gameUIManager.getGameManager().getTrainManager().getTrainCostOverview(); addField (new Caption(text), poolTrainsXOffset, newTrainsYOffset + 1, futureTrainsWidth + 2, 1, 0, true); dummyButton = new ClickField("", "", "", this, buySellGroup); --- 510,519 ---- futureTrainsWidth, 1, 0, true); ! // Train cost overview - removed, now added to Info menu ! /* String text = gameUIManager.getGameManager().getTrainManager().getTrainCostOverview(); addField (new Caption(text), poolTrainsXOffset, newTrainsYOffset + 1, futureTrainsWidth + 2, 1, 0, true); + */ dummyButton = new ClickField("", "", "", this, buySellGroup); *************** *** 672,676 **** index = options.indexOf(sp); } ! } else if (options.size() == 1) { int result = JOptionPane.showConfirmDialog(this, options.get(0), --- 674,678 ---- index = options.indexOf(sp); } ! } else if (options.size() == 1) { int result = JOptionPane.showConfirmDialog(this, options.get(0), *************** *** 704,708 **** cca.setAmount(amount); chosenAction = cca; ! } else { chosenAction = processGameSpecificActions(actor, actions.get(0)); --- 706,711 ---- cca.setAmount(amount); chosenAction = cca; ! } else { ! chosenAction = processGameSpecificActions(actor, actions.get(0)); *************** *** 953,957 **** certInTreasuryButton[i].setVisible(clickable); } ! private void setCompanyCashButton(int i, boolean clickable, PossibleAction action){ boolean visible = rowVisibilityObservers[i].lastValue(); --- 956,960 ---- certInTreasuryButton[i].setVisible(clickable); } ! private void setCompanyCashButton(int i, boolean clickable, PossibleAction action){ boolean visible = rowVisibilityObservers[i].lastValue(); *************** *** 961,968 **** } else { compCashButton[i].clearPossibleActions(); ! } compCash[i].setVisible(visible && !clickable); compCashButton[i].setVisible(visible && clickable); - if (action != null) compCashButton[i].addPossibleAction(action); --- 964,970 ---- } else { compCashButton[i].clearPossibleActions(); ! } compCash[i].setVisible(visible && !clickable); compCashButton[i].setVisible(visible && clickable); if (action != null) compCashButton[i].addPossibleAction(action); Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ORPanel.java 2 Mar 2010 22:15:40 -0000 1.47 --- ORPanel.java 4 Mar 2010 22:08:24 -0000 1.48 *************** *** 93,98 **** private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, privatesCaption, loansCaption; ! ! private ActionButton buttonOC; // sfy: button for operating costs private ActionButton button1; private ActionButton button2; --- 93,98 ---- private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, privatesCaption, loansCaption; ! ! private ActionButton buttonOC; // sfy: button for operating costs private ActionButton button1; private ActionButton button2; *************** *** 484,488 **** List<CompanyTypeI> comps = cm.getCompanyTypes(); JMenu compMenu, menu, item; ! compMenu = new JMenu(LocalText.getText("Companies")); compMenu.setEnabled(true); --- 484,488 ---- List<CompanyTypeI> comps = cm.getCompanyTypes(); JMenu compMenu, menu, item; ! compMenu = new JMenu(LocalText.getText("Companies")); compMenu.setEnabled(true); *************** *** 508,512 **** List<TrainTypeI> types = tm.getTrainTypes(); JMenu item; - StringBuffer b = new StringBuffer("<html>"); trainsInfoMenu = new JMenu(LocalText.getText("TRAINS")); --- 508,511 ---- *************** *** 515,533 **** for (TrainTypeI type : types) { - b.setLength(6); - if (Util.hasValue(type.getStartedPhaseName())) { - appendInfoText(b, LocalText.getText("StartsPhase", type.getStartedPhaseName())); - } - if (type.getRustedTrainType() != null) { - appendInfoText(b, LocalText.getText("RustsTrains", type.getRustedTrainType().getName())); - } - if (type.getReleasedTrainType() != null) { - appendInfoText(b, LocalText.getText("ReleasesTrains", type.getReleasedTrainType().getName())); - } - if (b.length() == 6) b.append(LocalText.getText("None")); - item = new JMenu (LocalText.getText("N_Train", type.getName())); item.setEnabled(true); ! item.add(new JMenuItem(b.toString())); trainsInfoMenu.add(item); } --- 514,520 ---- for (TrainTypeI type : types) { item = new JMenu (LocalText.getText("N_Train", type.getName())); item.setEnabled(true); ! item.add(new JMenuItem(type.getInfo())); trainsInfoMenu.add(item); } *************** *** 695,699 **** button1.setVisible(true); } ! public void initPayoutStep(int orCompIndex, SetDividend action, boolean withhold, boolean split, boolean payout) { --- 682,686 ---- button1.setVisible(true); } ! public void initPayoutStep(int orCompIndex, SetDividend action, boolean withhold, boolean split, boolean payout) { *************** *** 755,759 **** // operating costs sfy public void initOperatingCosts(boolean enabled) { ! buttonOC.setEnabled(enabled); buttonOC.setVisible(enabled); --- 742,746 ---- // operating costs sfy public void initOperatingCosts(boolean enabled) { ! buttonOC.setEnabled(enabled); buttonOC.setVisible(enabled); *************** *** 761,765 **** tokenCaption.setHighlight(enabled); } ! public void initPrivateBuying(boolean enabled) { --- 748,752 ---- tokenCaption.setHighlight(enabled); } ! public void initPrivateBuying(boolean enabled) { |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:17
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17033/rails/game Modified Files: TrainTypeI.java PublicCompanyI.java PublicCompany.java TrainType.java Log Message: Various changes for 1835 Index: TrainTypeI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainTypeI.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TrainTypeI.java 4 Feb 2010 22:22:59 -0000 1.13 --- TrainTypeI.java 4 Mar 2010 22:08:09 -0000 1.14 *************** *** 109,111 **** --- 109,113 ---- public TrainManager getTrainManager(); + public String getInfo(); + } Index: TrainType.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainType.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** TrainType.java 4 Feb 2010 22:23:01 -0000 1.30 --- TrainType.java 4 Mar 2010 22:08:09 -0000 1.31 *************** *** 9,14 **** import rails.game.state.BooleanState; import rails.game.state.IntegerState; ! import rails.util.LocalText; ! import rails.util.Tag; public class TrainType --- 9,13 ---- import rails.game.state.BooleanState; import rails.game.state.IntegerState; ! import rails.util.*; public class TrainType *************** *** 476,478 **** --- 475,499 ---- } + public String getInfo() { + StringBuilder b = new StringBuilder ("<html>"); + b.append(LocalText.getText("TrainInfo", name, Bank.format(cost), amount)); + if (Util.hasValue(startedPhaseName)) { + appendInfoText(b, LocalText.getText("StartsPhase", startedPhaseName)); + } + if (rustedTrainTypeName != null) { + appendInfoText(b, LocalText.getText("RustsTrains", rustedTrainTypeName)); + } + if (releasedTrainTypeName != null) { + appendInfoText(b, LocalText.getText("ReleasesTrains", releasedTrainTypeName)); + } + if (b.length() == 6) b.append(LocalText.getText("None")); + + return b.toString(); + } + + private void appendInfoText (StringBuilder b, String text) { + if (text == null || text.length() == 0) return; + if (b.length() > 6) b.append("<br>"); + b.append(text); + } } Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** PublicCompany.java 1 Mar 2010 22:27:31 -0000 1.89 --- PublicCompany.java 4 Mar 2010 22:08:09 -0000 1.90 *************** *** 31,35 **** protected static final int WHEN_FLOATED = 1; protected static final int START_OF_FIRST_OR = 2; ! // Base token lay cost calculation methods public static final String BASE_COST_SEQUENCE = "sequence"; --- 31,35 ---- protected static final int WHEN_FLOATED = 1; protected static final int START_OF_FIRST_OR = 2; ! // Base token lay cost calculation methods public static final String BASE_COST_SEQUENCE = "sequence"; *************** *** 192,195 **** --- 192,200 ---- protected IntegerState shareUnit; + /** What number of share units relates to the share price + * (normally 1, but 2 for 1835 Prussian) + */ + protected int shareUnitsForSharePrice = 1; + /** At what percentage sold does the company float */ protected int floatPerc = 0; *************** *** 268,272 **** * element */ ! public void configureFromXML(Tag tag) throws ConfigurationException { longName = tag.getAttributeAsString("longname", name); --- 273,278 ---- * element */ ! @Override ! public void configureFromXML(Tag tag) throws ConfigurationException { longName = tag.getAttributeAsString("longname", name); *************** *** 297,300 **** --- 303,308 ---- shareUnit = new IntegerState (name+"_ShareUnit", shareUnitTag.getAttributeAsInteger("percentage", DEFAULT_SHARE_UNIT)); + shareUnitsForSharePrice + = shareUnitTag.getAttributeAsInteger("sharePriceUnits", shareUnitsForSharePrice); } *************** *** 342,346 **** // Special properties (as in the 1835 black minors) super.configureFromXML(tag); ! // TODO Normally set in the default train type. May be wrong place. // Ridiculous to reparse with each train type. --- 350,354 ---- // Special properties (as in the 1835 black minors) super.configureFromXML(tag); ! // TODO Normally set in the default train type. May be wrong place. // Ridiculous to reparse with each train type. *************** *** 1381,1385 **** } ! @Override public String toString() { return name; --- 1389,1397 ---- } ! public int getShareUnitsForSharePrice() { ! return shareUnitsForSharePrice; ! } ! ! @Override public String toString() { return name; *************** *** 1636,1640 **** tilesLaidThisTurn.appendWithDelimiter(Bank.format(cost), ","); } ! public ModelObject getTilesLaidThisTurnModel() { return tilesLaidThisTurn; --- 1648,1652 ---- tilesLaidThisTurn.appendWithDelimiter(Bank.format(cost), ","); } ! public ModelObject getTilesLaidThisTurnModel() { return tilesLaidThisTurn; *************** *** 1658,1664 **** /** ! * Calculate the cost of laying a token, given the hex where * the token is laid. This only makes a diofference for de "distance" method. ! * @param hex The hex where the token is to be laid. * @return The cost of laying that token. */ --- 1670,1676 ---- /** ! * Calculate the cost of laying a token, given the hex where * the token is laid. This only makes a diofference for de "distance" method. ! * @param hex The hex where the token is to be laid. * @return The cost of laying that token. */ *************** *** 1669,1673 **** if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { int index = getNumberOfLaidBaseTokens(); ! if (index >= baseTokenLayCost.length) { index = baseTokenLayCost.length - 1; --- 1681,1685 ---- if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { int index = getNumberOfLaidBaseTokens(); ! if (index >= baseTokenLayCost.length) { index = baseTokenLayCost.length - 1; *************** *** 1686,1690 **** } } ! /** Return all possible token lay costs to be incurred for the * company's next token lay. In the "distance" method, this will be an array. --- 1698,1702 ---- } } ! /** Return all possible token lay costs to be incurred for the * company's next token lay. In the "distance" method, this will be an array. *************** *** 1692,1696 **** */ public int[] getBaseTokenLayCosts () { ! if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { return new int[] {getBaseTokenLayCost(null)}; --- 1704,1708 ---- */ public int[] getBaseTokenLayCosts () { ! if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { return new int[] {getBaseTokenLayCost(null)}; *************** *** 1706,1710 **** return new int[] {0}; } ! } --- 1718,1722 ---- return new int[] {0}; } ! } Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PublicCompanyI.java 28 Feb 2010 21:38:05 -0000 1.49 --- PublicCompanyI.java 4 Mar 2010 22:08:09 -0000 1.50 *************** *** 232,235 **** --- 232,236 ---- */ public int getShareUnit(); + public int getShareUnitsForSharePrice(); /** *************** *** 292,296 **** public void layTileInNoMapMode(int cost); ! public ModelObject getTilesLaidThisTurnModel(); --- 293,297 ---- public void layTileInNoMapMode(int cost); ! public ModelObject getTilesLaidThisTurnModel(); *************** *** 300,304 **** public void layBaseTokenInNoMapMode(int cost); ! public ModelObject getTokensLaidThisTurnModel(); --- 301,305 ---- public void layBaseTokenInNoMapMode(int cost); ! public ModelObject getTokensLaidThisTurnModel(); |
From: Erik V. <ev...@us...> - 2010-03-04 22:08:06
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16969/data/1835 Modified Files: CompanyManager.xml Log Message: Various changes for 1835 Index: CompanyManager.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/CompanyManager.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CompanyManager.xml 1 Mar 2010 22:27:08 -0000 1.28 --- CompanyManager.xml 4 Mar 2010 22:07:55 -0000 1.29 *************** *** 178,182 **** </Company> <Company name="Pr" longname="Preußische Eisenbahn" type="Major" startspace="I4" available="no" tokens="7" fgColour="FFFFFF" bgColour="000000"> ! <ShareUnit percentage="5"/> <Float percentage="10"/> <Certificate type="President" shares="2"/> --- 178,182 ---- </Company> <Company name="Pr" longname="Preußische Eisenbahn" type="Major" startspace="I4" available="no" tokens="7" fgColour="FFFFFF" bgColour="000000"> ! <ShareUnit percentage="5" sharePriceUnits="2"/> <Float percentage="10"/> <Certificate type="President" shares="2"/> |
From: Stefan F. <ste...@us...> - 2010-03-04 21:17:06
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10478/rails/game Modified Files: StockRound.java Log Message: Fix of incorrect change of director if several candidates are available (bug 2962977) Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** StockRound.java 28 Feb 2010 21:38:05 -0000 1.65 --- StockRound.java 4 Mar 2010 21:16:56 -0000 1.66 *************** *** 948,968 **** && numberToSell <= presCert.getShares()) { // More to sell and we are President: see if we can dump it. ! Player otherPlayer; for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { ! otherPlayer = gameManager.getPlayerByIndex(i); ! if (otherPlayer.getPortfolio().getShare(company) >= presCert.getShare()) { // Check if he has the right kind of share if (numberToSell > 1 || otherPlayer.getPortfolio().ownsCertificates( company, 1, false) >= 1) { ! // The poor sod. ! dumpedPlayer = otherPlayer; ! presSharesToSell = numberToSell; ! numberToSell = 0; ! break; } } } } // Check if we could sell them all --- 948,972 ---- && numberToSell <= presCert.getShares()) { // More to sell and we are President: see if we can dump it. ! // search for the player with the most shares (fix of bug 2962977) ! int requiredShares = presCert.getShare(); ! Player potentialDirector = null; for (int i = currentIndex + 1; i < currentIndex + numberOfPlayers; i++) { ! Player otherPlayer = gameManager.getPlayerByIndex(i); ! int otherPlayerShares = otherPlayer.getPortfolio().getShare(company); ! if (otherPlayerShares >= requiredShares) { // Check if he has the right kind of share if (numberToSell > 1 || otherPlayer.getPortfolio().ownsCertificates( company, 1, false) >= 1) { ! potentialDirector = otherPlayer; ! requiredShares = otherPlayerShares + 1; } } } + // The poor sod. + dumpedPlayer = potentialDirector; + presSharesToSell = numberToSell; + numberToSell = 0; } // Check if we could sell them all |
From: Stefan F. <ste...@us...> - 2010-03-03 21:34:22
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9005/rails/game Modified Files: OperatingRound.java Log Message: Changed tileLaysPerColour state support from GenericState to MapChange. Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** OperatingRound.java 3 Mar 2010 00:44:51 -0000 1.111 --- OperatingRound.java 3 Mar 2010 21:34:11 -0000 1.112 *************** *** 12,16 **** import rails.game.state.EnumState; import rails.game.state.IntegerState; ! import rails.game.state.GenericState; import rails.util.LocalText; --- 12,16 ---- import rails.game.state.EnumState; import rails.game.state.IntegerState; ! //import rails.game.state.GenericState; import rails.util.LocalText; *************** *** 47,53 **** protected List<LayTile> currentNormalTileLays = new ArrayList<LayTile>(); ! // protected Map<String, Integer> tileLaysPerColour = ! // new HashMap<String, Integer>(); ! protected GenericState<Map<String,Integer>> tileLaysPerColourState = null; protected List<LayBaseToken> currentNormalTokenLays = --- 47,53 ---- protected List<LayTile> currentNormalTileLays = new ArrayList<LayTile>(); ! protected Map<String, Integer> tileLaysPerColour = ! new HashMap<String, Integer>(); ! // protected GenericState<Map<String,Integer>> tileLaysPerColourState = null; protected List<LayBaseToken> currentNormalTokenLays = *************** *** 448,458 **** protected boolean checkNormalTileLay(TileI tile, boolean update) { ! Map<String,Integer> tileLaysPerColour = tileLaysPerColourState.getObject(); ! if (tileLaysPerColour.isEmpty()) return false; ! String colour = tile.getColourName(); Integer oldAllowedNumberObject = tileLaysPerColour.get(colour); if (oldAllowedNumberObject == null) return false; int oldAllowedNumber = oldAllowedNumberObject.intValue(); if (oldAllowedNumber <= 0) return false; --- 448,460 ---- protected boolean checkNormalTileLay(TileI tile, boolean update) { ! // Map<String,Integer> tileLaysPerColour = tileLaysPerColourState.getObject(); ! // if (tileLaysPerColour.isEmpty()) return false; + String colour = tile.getColourName(); Integer oldAllowedNumberObject = tileLaysPerColour.get(colour); + if (oldAllowedNumberObject == null) return false; + int oldAllowedNumber = oldAllowedNumberObject.intValue(); if (oldAllowedNumber <= 0) return false; *************** *** 467,484 **** */ ! Map<String,Integer> tileLaysPerColourUpdated = new HashMap<String, Integer>(); // new (empty) map if (oldAllowedNumber <= 1) { ! // tileLaysPerColour.clear(); log.debug("No more normal tile lays allowed"); currentNormalTileLays.clear(); } else { ! // tileLaysPerColour.clear(); // Remove all other colours ! tileLaysPerColourUpdated.put(colour, new Integer(oldAllowedNumber - 1)); ! log.debug((oldAllowedNumber - 1) + " more " + colour + " tile lays allowed"); } ! tileLaysPerColourState.set(tileLaysPerColourUpdated); return true; --- 469,493 ---- */ ! // Map<String,Integer> tileLaysPerColourUpdated = new HashMap<String, Integer>(); // new (empty) map if (oldAllowedNumber <= 1) { ! for (String key:tileLaysPerColour.keySet()) ! new MapChange<String,Integer>(tileLaysPerColour, key, new Integer(0)); log.debug("No more normal tile lays allowed"); currentNormalTileLays.clear(); } else { ! // tileLaysPerColourUpdated.put(colour, new Integer(oldAllowedNumber - 1)); ! for (String key:tileLaysPerColour.keySet()) ! if (colour.equals(key)) ! new MapChange<String,Integer> ! (tileLaysPerColour, colour, new Integer(oldAllowedNumber-1)); ! else ! new MapChange<String,Integer>(tileLaysPerColour, key, new Integer(0)); ! ! log.debug((oldAllowedNumber - 1) + " more " + colour + " tile lays allowed"); } ! // tileLaysPerColourState.set(tileLaysPerColourUpdated); return true; *************** *** 1178,1182 **** protected void getNormalTileLays() { ! Map<String,Integer> tileLaysPerColour = new HashMap<String, Integer>(getCurrentPhase().getTileColours()); // Clone --- 1187,1192 ---- protected void getNormalTileLays() { ! // Map<String,Integer> ! tileLaysPerColour = new HashMap<String, Integer>(getCurrentPhase().getTileColours()); // Clone *************** *** 1189,1193 **** // store state ! tileLaysPerColourState = new GenericState<Map<String,Integer>>("tileLaysPerColour", tileLaysPerColour); } --- 1199,1203 ---- // store state ! // tileLaysPerColourState = new GenericState<Map<String,Integer>>("tileLaysPerColour", tileLaysPerColour); } *************** *** 1197,1203 **** currentNormalTileLays.clear(); ! Map<String,Integer> tileLaysPerColour = (Map<String,Integer>)(tileLaysPerColourState.getObject()); ! ! if (!tileLaysPerColour.isEmpty()) { currentNormalTileLays.add(new LayTile(tileLaysPerColour)); } --- 1207,1217 ---- currentNormalTileLays.clear(); ! // Map<String,Integer> tileLaysPerColour = (Map<String,Integer>)(tileLaysPerColourState.getObject()); ! ! int sumLays = 0; ! for (Integer i: tileLaysPerColour.values()) ! sumLays = sumLays + i; ! if (sumLays != 0) { ! // if (!tileLaysPerColour.isEmpty()) { currentNormalTileLays.add(new LayTile(tileLaysPerColour)); } |
From: Stefan F. <ste...@us...> - 2010-03-03 00:46:17
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705/rails/game Modified Files: OperatingRound.java GameManager.java Log Message: Added CorrectionMode - first part Cash Correction Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** OperatingRound.java 28 Feb 2010 21:38:05 -0000 1.110 --- OperatingRound.java 3 Mar 2010 00:44:51 -0000 1.111 *************** *** 1047,1136 **** return true; } - - // protected boolean executeCorrectCash(CorrectCashI action){ - // - // CashHolder ch = action.getCashHolder(); - // int amount = action.getAmount(); - // int cost = -amount; // costs are minus of CashCorrectamount - // - // // operating costs related stuff - // boolean flagOC = false; - // OperatingCost actionOC = null; - // OperatingCost.OCType typeOC = null; - // PublicCompanyI pc = null; - // String textError = "CCExecutionError"; - // - // if (action instanceof OperatingCost) { - // flagOC = true; - // actionOC = (OperatingCost) action; - // typeOC = actionOC.getOCType(); - // pc = (PublicCompanyI) ch; - // textError = "OCExecutionError"; - // } - // - // String errMsg = null; - // - // while (true) { - // if ((amount + ch.getCash()) < 0) { - // errMsg = - // LocalText.getText("NotEnoughMoney", - // ch.getName(), - // Bank.format(ch.getCash()), - // Bank.format(cost) - // ); - // break; - // } - // if (flagOC && (typeOC == OperatingCost.OCType.LAY_BASE_TOKEN) && (pc.getNumberOfFreeBaseTokens() == 0)) { - // errMsg = - // LocalText.getText("HasNoTokensLeft", ch.getName()); - // break; - // } - // break; - // } - // - // if (errMsg != null) { - // DisplayBuffer.add(LocalText.getText(textError, - // ch.getName(), - // errMsg)); - // return false; - // } - // - // moveStack.start(true); - // - // if (amount < 0) { - // // negative amounts: remove cash from cashholder - // new CashMove(ch, bank, cost); - // } else if (amount > 0) { - // // positive amounts: add cash to cashholder - // new CashMove(bank, ch, amount); - // } - // - // if (flagOC) { - // - // if (typeOC == OperatingCost.OCType.LAY_TILE) { - // pc.layTileInNoMapMode(cost); - // ReportBuffer.add(LocalText.getText("OCLayTileExecuted", - // pc.getName(), - // Bank.format(cost) )); - // } - // if (typeOC == OperatingCost.OCType.LAY_BASE_TOKEN) { - // // move token to Bank - // BaseToken token = pc.getFreeToken(); - // if (token == null) { - // log.error("Company " + pc.getName() + " has no free token"); - // return false; - // } else { - // token.moveTo(bank.getUnavailable()); - // } - // pc.layBaseTokenInNoMapMode(cost); - // ReportBuffer.add(LocalText.getText("OCLayBaseTokenExecuted", - // pc.getName(), - // Bank.format(cost) )); - // } - // } - // - // return true; - // } - /** --- 1047,1050 ---- Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** GameManager.java 23 Feb 2010 22:21:39 -0000 1.84 --- GameManager.java 3 Mar 2010 00:45:06 -0000 1.85 *************** *** 13,16 **** --- 13,17 ---- import rails.common.GuiHints; import rails.game.action.*; + import rails.game.correct.*; import rails.game.move.*; import rails.game.special.SpecialPropertyI; *************** *** 79,82 **** --- 80,86 ---- protected EnumMap<GameDef.Parm, Object> gameParameters = new EnumMap<GameDef.Parm, Object>(GameDef.Parm.class); + + protected EnumSet<CorrectionType> activeCorrections + = EnumSet.noneOf(CorrectionType.class); /** *************** *** 758,762 **** // All other actions: process per round ! result = getCurrentRound().process(action); break; } --- 762,766 ---- // All other actions: process per round ! result = processCorrectionActions(action) || getCurrentRound().process(action); break; } *************** *** 782,789 **** } ! for (PossibleAction pa : possibleActions.getList()) { ! log.debug(((Player) currentPlayer.getObject()).getName() + " may: " ! + pa.toString()); ! } // Add the Undo/Redo possibleActions here. --- 786,790 ---- } ! setCorrectionActions(); // Add the Undo/Redo possibleActions here. *************** *** 798,804 **** --- 799,875 ---- } + + // logging of game actions activated + for (PossibleAction pa : possibleActions.getList()) { + log.debug(((Player) currentPlayer.getObject()).getName() + " may: " + + pa.toString()); + } + return result; } + + /** + * Adds all Game actions + * Examples are: undo/redo/corrections + */ + private void setCorrectionActions(){ + + // If any Correction is active + if (!activeCorrections.isEmpty()) { + // remove all other actions + possibleActions.clear(); + // and set GuiHints for corrections - removed + } + + // CorrectionMode Actions + EnumSet<CorrectionType> possibleCorrections = EnumSet.allOf(CorrectionType.class); + for (CorrectionType ct:possibleCorrections) + possibleActions.add( + new CorrectionModeAction(ct, activeCorrections.contains(ct))); + + // Correction Actions + for (CorrectionType ct:activeCorrections) { + CorrectionManager cm = ct.getManager(this); + possibleActions.addAll(cm.createCorrections()); + } + } + + private boolean processCorrectionActions(PossibleAction a){ + + boolean result = false; + + if (a instanceof CorrectionModeAction) { + CorrectionModeAction cma = (CorrectionModeAction)a; + CorrectionType ct = cma.getCorrection(); + moveStack.start(false); + new SetChange<CorrectionType> + (activeCorrections, ct, !cma.isActive()); + if (!cma.isActive()) { + String text = LocalText.getText("CorrectionModeActivate", + getCurrentPlayer().getName(), + LocalText.getText(ct.name()) + ); + ReportBuffer.add(text); + DisplayBuffer.add(text); + } + else { + ReportBuffer.add(LocalText.getText("CorrectionModeDeactivate", + getCurrentPlayer().getName(), + LocalText.getText(ct.name()) + )); + } + result = true; + } + + if (a instanceof CorrectionAction) { + CorrectionAction ca= (CorrectionAction)a; + CorrectionType ct = ca.getCorrectionType(); + CorrectionManager cm = ct.getManager(this); + result = cm.executeCorrection(ca); + } + + return result; + } /* (non-Javadoc) *************** *** 817,825 **** getCurrentRound().process(new NullAction (NullAction.DONE)); getCurrentRound().setPossibleActions(); } try { log.debug("Action: " + action); ! if (!getCurrentRound().process(action)) { String msg = "Player "+action.getPlayerName()+"\'s action \"" +action.toString()+"\"\n in "+getCurrentRound().getRoundName() --- 888,897 ---- getCurrentRound().process(new NullAction (NullAction.DONE)); getCurrentRound().setPossibleActions(); + setCorrectionActions(); } try { log.debug("Action: " + action); ! if (!processCorrectionActions(action) && !getCurrentRound().process(action)) { String msg = "Player "+action.getPlayerName()+"\'s action \"" +action.toString()+"\"\n in "+getCurrentRound().getRoundName() *************** *** 831,834 **** --- 903,908 ---- } getCurrentRound().setPossibleActions(); + setCorrectionActions(); + } catch (Exception e) { log.debug("Error while reprocessing " + action.toString(), e); |
From: Stefan F. <ste...@us...> - 2010-03-03 00:46:15
|
Update of /cvsroot/rails/18xx/rails/game/correct In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705/rails/game/correct Modified Files: CorrectionAction.java Added Files: CorrectionModeAction.java CashCorrectionAction.java CorrectionManager.java CorrectionType.java CashCorrectionManager.java Removed Files: CorrectCash.java CorrectCashI.java Log Message: Added CorrectionMode - first part Cash Correction --- NEW FILE: CorrectionModeAction.java --- package rails.game.correct; import rails.game.action.PossibleAction; import rails.util.*; import java.io.IOException; import java.io.ObjectInputStream; /** * Action class to request specific correction actions * @author freystef * */ public class CorrectionModeAction extends PossibleAction { public static final long serialVersionUID = 1L; // pre-conditions: type and state transient protected CorrectionType correction; protected String correctionName; protected boolean active; // post-conditions: none (except isActed!) /** * Initializes with all possible correction types */ public CorrectionModeAction(CorrectionType correction, boolean active) { this.correction = correction; correctionName = correction.name(); this.active = active; } public CorrectionType getCorrection() { return correction; } public String getCorrectionName() { return correctionName; } public boolean isActive() { return active; } public String getInfo(){ return (LocalText.getText(correctionName)); } @Override public boolean equals(PossibleAction action) { if (!(action instanceof CorrectionModeAction)) return false; CorrectionModeAction a = (CorrectionModeAction) action; return (a.correction == this.correction && a.active == this.active); } @Override public String toString() { StringBuffer b = new StringBuffer("CorrectionModeAction"); if (!acted) { b.append(" (not acted)"); if (correction != null) b.append(", correction="+correction); b.append(", current state="+active); } else { b.append(" (acted)"); if (correction != null) b.append(", correction="+correction); b.append(", previous state="+active); } return b.toString(); } /** Deserialize */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (Util.hasValue(correctionName)) correction = CorrectionType.valueOf(correctionName); } // a version with enumsets: // // pre-conditions // transient protected EnumSet<CorrectionType> possibleCorrections; // // // post-conditions // transient protected CorrectionType selectedCorrection; // // /** // * Initializes with all possible correction types // */ // public RequestCorrectionAction() { // possibleCorrections = EnumSet.allOf(CorrectionType.class); // } // // /** // * Initializes with a specific set of correction types // */ // public RequestCorrectionAction(EnumSet<CorrectionType> possibleCorrections) { // this.possibleCorrections = possibleCorrections; // } // // public EnumSet<CorrectionType> getPossibleCorrections() { // return possibleCorrections; // } // // public CorrectionType getSelectedCorrection() { // return selectedCorrection; // } // // public void setSelectedCorrection(CorrectionType selectedCorrection) { // this.selectedCorrection = selectedCorrection; // } } --- CorrectCashI.java DELETED --- Index: CorrectionAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CorrectionAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CorrectionAction.java 22 Feb 2010 22:48:18 -0000 1.3 --- CorrectionAction.java 3 Mar 2010 00:44:28 -0000 1.4 *************** *** 3,8 **** import rails.game.action.PossibleAction;; /** ! * Base class for all actions that correct the state of the game ! * that violate the ruleset. * * @author freystef --- 3,7 ---- import rails.game.action.PossibleAction;; /** ! * Base class for all actions that correct the state of the game. * * @author freystef *************** *** 12,26 **** public abstract class CorrectionAction extends PossibleAction { ! /** shows in correction menu */ ! protected boolean inCorrectionMenu; ! ! public boolean isInCorrectionMenu(){ ! return inCorrectionMenu; } ! ! public void setCorrectionMenu(boolean menu){ ! inCorrectionMenu = menu; } - } --- 11,21 ---- public abstract class CorrectionAction extends PossibleAction { ! private CorrectionType correctionType; ! public CorrectionType getCorrectionType() { ! return correctionType; } ! public void setCorrectionType(CorrectionType correctionType) { ! this.correctionType = correctionType; } } --- CorrectCash.java DELETED --- --- NEW FILE: CorrectionType.java --- package rails.game.correct; import rails.game.GameManager; /** * Enumerates the possible Corrections */ public enum CorrectionType { CORRECT_CASH { public CorrectionManager getManager(GameManager gm) {return CashCorrectionManager.getInstance(gm);} }; // CORRECT_MAP ("CorrectName") { // CorrectionManager getManager(GameManager gm) // {return MapCorrectionManager.getInstance(gm);} // }; public abstract CorrectionManager getManager(GameManager gm); } --- NEW FILE: CashCorrectionAction.java --- package rails.game.correct; import rails.game.*; import rails.game.action.PossibleAction; import rails.util.Util; import java.io.IOException; import java.io.ObjectInputStream; /** * Correction action that changes the cash position of a cashholder. * * @author Stefan Frey */ public class CashCorrectionAction extends CorrectionAction { /** The Constant serialVersionUID. */ public static final long serialVersionUID = 1L; /* Preconditions */ /** cash holder */ transient private CashHolder correctCashHolder; /** converted to name */ private String cashHolderName; private String cashHolderType; /** maximum Amount to deduct */ private int maximumNegative; /* Postconditions */ /** selected cash amount */ private int correctAmount; /** * Instantiates a new correct cash * * @param pl Player */ public CashCorrectionAction(Player pl) { correctCashHolder = pl; cashHolderName = pl.getName(); cashHolderType = "Player"; maximumNegative = pl.getCash(); setCorrectionType(CorrectionType.CORRECT_CASH); } /** * Instantiates a new correct cash * * @param pc Public Company */ public CashCorrectionAction(PublicCompanyI pc) { correctCashHolder = pc; cashHolderName = pc.getName(); cashHolderType = "PublicCompany"; maximumNegative = pc.getCash(); setCorrectionType(CorrectionType.CORRECT_CASH); } public CashHolder getCashHolder() { return correctCashHolder; } public String getCashHolderName() { return cashHolderName; } public int getMaximumNegative(){ return maximumNegative; } public int getAmount() { return correctAmount; } public void setAmount(int amount) { correctAmount = amount; } @Override public boolean equals(PossibleAction action) { if (!(action instanceof CashCorrectionAction)) return false; CashCorrectionAction a = (CashCorrectionAction) action; return (a.correctCashHolder == this.correctCashHolder && a.maximumNegative == this.maximumNegative ); } @Override public String toString() { StringBuffer b = new StringBuffer("CashCorrectionAction "); if (acted) { b.append("(Acted)"); if (correctCashHolder != null) b.append(", correctCashHolder="+correctCashHolder); b.append(", correctAmount="+correctAmount); } else { b.append("(Not Acted)"); if (correctCashHolder != null) b.append(", correctCashHolder="+correctCashHolder); b.append(", maximumNegative="+maximumNegative); } return b.toString(); } /** Deserialize */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (Util.hasValue(cashHolderType) && Util.hasValue(cashHolderName)) { if (cashHolderType.equals("Player")) correctCashHolder = getGameManager().getPlayerManager().getPlayerByName(cashHolderName); else if (cashHolderType.equals("PublicCompany")) correctCashHolder = getCompanyManager().getCompanyByName(cashHolderName); } } } --- NEW FILE: CorrectionManager.java --- package rails.game.correct; import rails.game.GameManager; import java.util.List; /** * CorrectionManager is the interface for the specific CorrectionManagers * Corrections use the (abstract) factory pattern. * @author freystef * */ public interface CorrectionManager { public List<CorrectionAction> createCorrections(); public boolean executeCorrection(CorrectionAction action); } --- NEW FILE: CashCorrectionManager.java --- package rails.game.correct; import rails.game.*; import rails.game.move.CashMove; import rails.util.*; import java.util.*; public final class CashCorrectionManager implements CorrectionManager { private GameManager gameManager; private CashCorrectionManager() { } public static CorrectionManager getInstance(GameManager gm) { CashCorrectionManager manager = new CashCorrectionManager(); manager.gameManager = gm; return manager; } public List<CorrectionAction> createCorrections() { List<CorrectionAction> actions = new ArrayList<CorrectionAction>(); List<Player> players = gameManager.getPlayers(); for(Player pl:players){ actions.add(new CashCorrectionAction(pl)); } List<PublicCompanyI> publicCompanies = gameManager.getAllPublicCompanies(); for(PublicCompanyI pc:publicCompanies){ if (pc.hasFloated()) actions.add(new CashCorrectionAction(pc)); } return actions; } public boolean executeCorrection(CorrectionAction action) { boolean result = false; if (action instanceof CashCorrectionAction) { CashCorrectionAction cashAction=(CashCorrectionAction)action; CashHolder ch = cashAction.getCashHolder(); int amount = cashAction.getAmount(); String errMsg = null; if ((amount + ch.getCash()) < 0) { errMsg = LocalText.getText("NotEnoughMoney", ch.getName(), Bank.format(ch.getCash()), Bank.format(-amount) ); } if (errMsg != null) { DisplayBuffer.add(LocalText.getText("CorrectCashError", ch.getName(), errMsg)); result = true; } else { // no error occured gameManager.getMoveStack().start(false); Bank bank = gameManager.getBank(); if (amount < 0) { // negative amounts: remove cash from cashholder new CashMove(ch, bank , -amount); ReportBuffer.add(LocalText.getText("CorrectCashSubstractMoney", ch.getName(), Bank.format(-amount) )); } else if (amount > 0) { // positive amounts: add cash to cashholder new CashMove(bank, ch, amount); ReportBuffer.add(LocalText.getText("CorrectCashAddMoney", ch.getName(), Bank.format(amount) )); } result = true; } } return result; } } |
From: Stefan F. <ste...@us...> - 2010-03-03 00:46:15
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705 Modified Files: LocalisedText.properties Log Message: Added CorrectionMode - first part Cash Correction Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** LocalisedText.properties 2 Mar 2010 21:14:19 -0000 1.114 --- LocalisedText.properties 3 Mar 2010 00:45:17 -0000 1.115 *************** *** 57,60 **** --- 57,61 ---- COMPANY=Company COMPANY_DETAILS=Company details + CORRECT_CASH=Cash Correction CURRENT=Current CURRENT_PRICE=<html>Current<br>Price</html> *************** *** 127,130 **** --- 128,140 ---- ConfirmToken=Press Lay Token to confirm token, click another city hex, or press the No Token button. connected=connected + CorrectCashAddMoney=CORRECTION: {0} receives {1} from the bank + CorrectCashSubstractMoney=CORRECTION: {0} pays {1} to the bank + CorrectCashDialogTitle=Cash Correction + CorrectCashDialogMessage=Adjust the cash position for {0} + CorrectCashError=Cash correction not possible for {0}: {1} + CorrectCashToolTip=Click here to adjust cash position + CorrectionMainMenu=Correction + CorrectionModeActivate={1} activated by {0} + CorrectionModeDeactivate={1} deactivated by {0} CREDITS=Credits DestinationReachedByToken={0} gains {1} by laying a token on its destination {2} |
From: Stefan F. <ste...@us...> - 2010-03-03 00:46:00
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705/rails/ui/swing Modified Files: GameStatus.java StatusWindow.java GameUIManager.java Log Message: Added CorrectionMode - first part Cash Correction Index: StatusWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StatusWindow.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** StatusWindow.java 31 Jan 2010 22:22:34 -0000 1.37 --- StatusWindow.java 3 Mar 2010 00:44:38 -0000 1.38 *************** *** 15,20 **** --- 15,22 ---- import rails.game.*; import rails.game.action.*; + import rails.game.correct.*; import rails.ui.swing.elements.ActionButton; import rails.ui.swing.elements.ActionMenuItem; + import rails.ui.swing.elements.ActionCheckBoxMenuItem; import rails.util.Config; import rails.util.LocalText; *************** *** 72,76 **** private static JMenu fileMenu, optMenu, moveMenu, moderatorMenu, ! specialMenu; private JMenuItem menuItem; --- 74,78 ---- private static JMenu fileMenu, optMenu, moveMenu, moderatorMenu, ! specialMenu, correctionMenu; private JMenuItem menuItem; *************** *** 193,196 **** --- 195,204 ---- moderatorMenu.add(redoItem2); + correctionMenu = new JMenu(LocalText.getText("CorrectionMainMenu")); + correctionMenu.setName(LocalText.getText("CorrectionMainMenu")); + correctionMenu.setMnemonic(KeyEvent.VK_C); + correctionMenu.setEnabled(false); + moderatorMenu.add(correctionMenu); + menuBar.add(moderatorMenu); *************** *** 313,317 **** --- 321,347 ---- } } + + public void setCorrectionMenu() { + // Update the menu + correctionMenu.removeAll(); + correctionMenu.setEnabled(false); + + List<CorrectionModeAction> corrections = + possibleActions.getType(CorrectionModeAction.class); + if (corrections != null) { + for (CorrectionModeAction a : corrections) { + ActionCheckBoxMenuItem item = new ActionCheckBoxMenuItem ( + LocalText.getText(a.getCorrectionName())); + item.addActionListener(this); + item.addPossibleAction(a); + item.setEnabled(true); + item.setSelected(a.isActive()); + correctionMenu.add(item); + } + correctionMenu.setEnabled(true); + } + } + public void setupFor(RoundI round) { *************** *** 331,334 **** --- 361,368 ---- public void updateStatus() { + + // correction actions always possible + gameStatus.initCashCorrectionActions(); + if (!(currentRound instanceof StockRound)) { return; Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** GameStatus.java 9 Feb 2010 20:03:24 -0000 1.39 --- GameStatus.java 3 Mar 2010 00:44:33 -0000 1.40 *************** *** 14,17 **** --- 14,18 ---- import rails.game.*; import rails.game.action.*; + import rails.game.correct.CashCorrectionAction; import rails.ui.swing.elements.*; import rails.util.LocalText; *************** *** 27,30 **** --- 28,32 ---- private static final String BUY_FROM_POOL_CMD = "BuyFromPool"; private static final String SELL_CMD = "Sell"; + private static final String CASH_CORRECT_CMD = "CorrectCash"; protected StatusWindow parent; *************** *** 48,51 **** --- 50,54 ---- protected int currPriceXOffset, currPriceYOffset; protected Field compCash[]; + protected ClickField compCashButton[]; protected int compCashXOffset, compCashYOffset; protected Field compRevenue[]; *************** *** 60,63 **** --- 63,67 ---- protected int compLoansXOffset, compLoansYOffset; protected Field playerCash[]; + protected ClickField playerCashButton[]; protected int playerCashXOffset, playerCashYOffset; protected Field playerPrivates[]; *************** *** 159,162 **** --- 163,167 ---- currPrice = new Field[nc]; compCash = new Field[nc]; + compCashButton = new ClickField[nc]; compRevenue = new Field[nc]; compTrains = new Field[nc]; *************** *** 166,169 **** --- 171,175 ---- playerCash = new Field[np]; + playerCashButton = new ClickField[np]; playerPrivates = new Field[np]; playerWorth = new Field[np]; *************** *** 371,374 **** --- 377,389 ---- f = compCash[i] = new Field(c.getCashModel()); addField(f, compCashXOffset, compCashYOffset + i, 1, 1, 0, visible); + f = + compCashButton[i] = + new ClickField( + compCash[i].getText(), + CASH_CORRECT_CMD, + LocalText.getText("CorrectCashToolTip"), + this, buySellGroup); + addField(f, compCashXOffset, compCashYOffset + i, 1, 1, + WIDE_RIGHT, false); f = compRevenue[i] = new Field(c.getLastRevenueModel()); *************** *** 412,419 **** addField(f, playerCashXOffset + i, playerCashYOffset, 1, 1, WIDE_TOP, true); } addField(new Caption("Privates"), 0, playerPrivatesYOffset, 1, 1, ! WIDE_RIGHT, true); for (int i = 0; i < np; i++) { f = --- 427,443 ---- addField(f, playerCashXOffset + i, playerCashYOffset, 1, 1, WIDE_TOP, true); + f = + playerCashButton[i] = + new ClickField( + playerCash[i].getText(), + CASH_CORRECT_CMD, + LocalText.getText("CorrectCashToolTip"), + this, buySellGroup); + addField(f, playerCashXOffset + i, playerCashYOffset, 1, 1, + WIDE_TOP, false); } addField(new Caption("Privates"), 0, playerPrivatesYOffset, 1, 1, ! WIDE_RIGHT, false); for (int i = 0; i < np; i++) { f = *************** *** 648,652 **** index = options.indexOf(sp); } ! } else if (options.size() == 1) { int result = JOptionPane.showConfirmDialog(this, options.get(0), --- 672,676 ---- index = options.indexOf(sp); } ! } else if (options.size() == 1) { int result = JOptionPane.showConfirmDialog(this, options.get(0), *************** *** 666,671 **** ((BuyCertificate) chosenAction).setNumberBought(buyAmounts.get(index)); } ! } else { ! chosenAction = processGameSpecificActions(actor, actions.get(0)); --- 690,708 ---- ((BuyCertificate) chosenAction).setNumberBought(buyAmounts.get(index)); } ! } else if (actions.get(0) instanceof CashCorrectionAction) { ! CashCorrectionAction cca = (CashCorrectionAction)actions.get(0); ! String amountString = (String) JOptionPane.showInputDialog(this, ! LocalText.getText("CorrectCashDialogMessage", cca.getCashHolderName()), ! LocalText.getText("CorrectCashDialogTitle"), ! JOptionPane.QUESTION_MESSAGE, null, null, 0); ! int amount; ! try { ! amount = Integer.parseInt(amountString); ! } catch (NumberFormatException e) { ! amount = 0; ! } ! cca.setAmount(amount); ! chosenAction = cca; ! } else { chosenAction = processGameSpecificActions(actor, actions.get(0)); *************** *** 785,788 **** --- 822,859 ---- } + /** + * Initializes the CashCorrectionActions + */ + public void initCashCorrectionActions() { + + // Clear all buttons + for (int i = 0; i < nc; i++) { + setCompanyCashButton(i, false, null); + } + for (int j = 0; j < np; j++) { + setPlayerCashButton(j, false, null); + } + + List<CashCorrectionAction> actions = + possibleActions.getType(CashCorrectionAction.class); + + if (actions != null) { + for (CashCorrectionAction a : actions) { + CashHolder ch = a.getCashHolder(); + if (ch instanceof PublicCompanyI) { + PublicCompanyI pc = (PublicCompanyI)ch; + int i = pc.getPublicNumber(); + setCompanyCashButton(i, true, a); + } + if (ch instanceof Player) { + Player p = (Player)ch; + int i = playerIndex.get(p); + setPlayerCashButton(i, true, a); + } + } + } + + } + public void setPriorityPlayer(int index) { *************** *** 882,885 **** --- 953,984 ---- certInTreasuryButton[i].setVisible(clickable); } + + private void setCompanyCashButton(int i, boolean clickable, PossibleAction action){ + boolean visible = rowVisibilityObservers[i].lastValue(); + + if (clickable) { + compCashButton[i].setText(compCash[i].getText()); + } else { + compCashButton[i].clearPossibleActions(); + } + compCash[i].setVisible(visible && !clickable); + compCashButton[i].setVisible(visible && clickable); + + if (action != null) + compCashButton[i].addPossibleAction(action); + } + private void setPlayerCashButton(int i, boolean clickable, PossibleAction action){ + + if (clickable) { + playerCashButton[i].setText(playerCash[i].getText()); + } else { + playerCashButton[i].clearPossibleActions(); + } + playerCash[i].setVisible(!clickable); + playerCashButton[i].setVisible(clickable); + + if (action != null) + playerCashButton[i].addPossibleAction(action); + } } Index: GameUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameUIManager.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** GameUIManager.java 28 Feb 2010 21:38:04 -0000 1.40 --- GameUIManager.java 3 Mar 2010 00:44:50 -0000 1.41 *************** *** 196,199 **** --- 196,200 ---- statusWindow.setGameActions(); + statusWindow.setCorrectionMenu(); // Is this perhaps the right place to display messages...? |
From: Stefan F. <ste...@us...> - 2010-03-03 00:45:52
|
Update of /cvsroot/rails/18xx/rails/ui/swing/elements In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705/rails/ui/swing/elements Added Files: ActionCheckBoxMenuItem.java Log Message: Added CorrectionMode - first part Cash Correction --- NEW FILE: ActionCheckBoxMenuItem.java --- /* $Header: /cvsroot/rails/18xx/rails/ui/swing/elements/ActionCheckBoxMenuItem.java,v 1.1 2010/03/03 00:45:39 stefanfrey Exp $*/ package rails.ui.swing.elements; import java.util.ArrayList; import java.util.List; import javax.swing.JCheckBoxMenuItem; import rails.game.action.ActionTaker; import rails.game.action.PossibleAction; /** * A subclass of JButton that allows linking "PossibleAction" objects to it. * * @see ClickField */ public class ActionCheckBoxMenuItem extends JCheckBoxMenuItem implements ActionTaker { private static final long serialVersionUID = 1L; private List<PossibleAction> actions = new ArrayList<PossibleAction>(1); public ActionCheckBoxMenuItem(String text) { super(text); } public void addPossibleAction(PossibleAction o) { actions.add(o); } public List<PossibleAction> getPossibleActions() { return actions; } public void clearPossibleActions() { actions.clear(); } public void setPossibleAction(PossibleAction action) { clearPossibleActions(); addPossibleAction(action); } } |
From: Stefan F. <ste...@us...> - 2010-03-03 00:45:26
|
Update of /cvsroot/rails/18xx/rails/game/move In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3705/rails/game/move Added Files: SetChange.java Log Message: Added CorrectionMode - first part Cash Correction --- NEW FILE: SetChange.java --- /* $Header: /cvsroot/rails/18xx/rails/game/move/SetChange.java,v 1.1 2010/03/03 00:45:09 stefanfrey Exp $ * * Created on 19-Jul-2006 * Change Log: */ package rails.game.move; import java.util.Set; /** * This Move class handles the addition or removal of set elements * * @author Stefan Frey */ public class SetChange<E> extends Move { protected Set<E> set; protected E element; protected boolean addToSet; // false = remove protected boolean noChange; // if move did not change anything public SetChange(Set<E> set, E element, boolean addToSet) { this.set = set; this.element = element; this.addToSet = addToSet; noChange = !(set.contains(element) ^ addToSet); // xor MoveSet.add(this); } @Override public boolean execute() { if (noChange) return true; if (addToSet) set.add(element); else set.remove(element); return true; } @Override public boolean undo() { if (noChange) return true; if (addToSet) set.remove(element); else set.add(element); return true; } public String toString() { StringBuffer s = new StringBuffer("Set Change: "); if (noChange) s.append("No Change for element "+element); else if (addToSet) s.append("Added element "+element); else s.append("Removed element "+element); return s.toString(); } } |
From: Erik V. <ev...@us...> - 2010-03-02 22:16:29
|
Update of /cvsroot/rails/18xx/rails/game/correct In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10261/rails/game/correct Modified Files: OperatingCost.java CorrectCash.java Log Message: Cleanups Index: OperatingCost.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/OperatingCost.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OperatingCost.java 24 Feb 2010 21:09:19 -0000 1.5 --- OperatingCost.java 2 Mar 2010 22:15:07 -0000 1.6 *************** *** 1,5 **** package rails.game.correct; - import rails.game.*; import rails.game.action.PossibleAction; import rails.game.action.PossibleORAction; --- 1,4 ---- Index: CorrectCash.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CorrectCash.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CorrectCash.java 22 Feb 2010 22:48:18 -0000 1.3 --- CorrectCash.java 2 Mar 2010 22:15:08 -0000 1.4 *************** *** 7,11 **** import java.io.IOException; import java.io.ObjectInputStream; - import java.util.*; /** --- 7,10 ---- |
From: Erik V. <ev...@us...> - 2010-03-02 22:16:17
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10261/rails/game/specific/_1835 Modified Files: PrussianFormationRound.java Log Message: Cleanups Index: PrussianFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/PrussianFormationRound.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PrussianFormationRound.java 28 Feb 2010 21:38:06 -0000 1.2 --- PrussianFormationRound.java 2 Mar 2010 22:15:33 -0000 1.3 *************** *** 5,14 **** import rails.common.GuiDef; import rails.game.*; - import rails.game.action.NullAction; import rails.game.action.PossibleAction; - import rails.game.move.MoveSet; import rails.game.special.ExchangeForShare; import rails.game.special.SpecialPropertyI; - import rails.game.specific._1856.PublicCompany_CGR; import rails.util.LocalText; --- 5,11 ---- |
From: Erik V. <ev...@us...> - 2010-03-02 22:16:13
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10261/rails/ui/swing/gamespecific/_1835 Modified Files: GameUIManager_1835.java Log Message: Cleanups Index: GameUIManager_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835/GameUIManager_1835.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GameUIManager_1835.java 28 Feb 2010 21:38:06 -0000 1.1 --- GameUIManager_1835.java 2 Mar 2010 22:15:32 -0000 1.2 *************** *** 5,9 **** import rails.game.CompanyI; - import rails.game.action.ExchangeTokens; import rails.game.specific._1835.FoldIntoPrussian; import rails.ui.swing.GameUIManager; --- 5,8 ---- |