From: Stefan F. <ste...@us...> - 2012-06-15 15:46:14
|
data/1835/CompanyManager.xml | 4 +-- rails/ui/swing/ORUIManager.java | 53 ++++++++++++++++++++++++++++++++++++---- rails/util/GameFileIO.java | 16 ++++++------ readme.txt | 18 +++++++++---- version.number | 2 - 5 files changed, 73 insertions(+), 20 deletions(-) New commits: commit 90ba59260b14c2a7d5f14a37c730d7d0cc5e0baf Author: Stefan Frey <ste...@we...> Date: Fri Jun 15 17:35:37 2012 +0200 prepared for release 1.7.7 diff --git a/readme.txt b/readme.txt index a1180ee..33de310 100644 --- a/readme.txt +++ b/readme.txt @@ -1,12 +1,18 @@ -Rails release 1.7.6: +Rails release 1.7.7: A new maintenance release for Rails 1.x series -This release fixes one sole bug. +This release fixes several bugs. -Contributors: Erik Vos +Contributors: Erik Vos, Stefan Frey -Bug reported by Antonio Baracca +Bug reported by Are-Harald Brenne, John David Galt -1856: Allowing selling a share just bought by the president. -(According to Steve Thomas rule clarification). \ No newline at end of file +New: +- Added little fun variant 18Lummer + +Lists of bugs fixed: +- Errors in UI after adding a comment at game start +- Fixed failure on reloading a just started game +- 1835: Manual close of Pfalzbahn is possible (to enable closing after token lay only) +- 1835 (and others): Fixed UI issues with token relays on OO-tiles diff --git a/version.number b/version.number index cde0424..60520e3 100644 --- a/version.number +++ b/version.number @@ -1,5 +1,5 @@ #Property file that contains version number and the develop indicator -version=1.7.6 +version=1.7.7 # the following string "@DEVELOP@ is replaced by an empty string in the release version # this is done automatically by ant develop=@DEVELOP@ \ No newline at end of file commit bf16424ac310389b5b48fabfc11a86a6f2a93a29 Author: Erik Vos <eri...@xs...> Date: Fri Jun 15 13:48:48 2012 +0200 Fixed failure on reloading a null action list. GameFileIO.replayGame() was not protected against that condition. [IMO the list should have been created empty, not null; EV](cherry picked from commit ee3e580ae2efdb10c28bdfe0565566e39f17491a) diff --git a/rails/util/GameFileIO.java b/rails/util/GameFileIO.java index 16f1991..5ae75a4 100644 --- a/rails/util/GameFileIO.java +++ b/rails/util/GameFileIO.java @@ -224,13 +224,15 @@ public class GameFileIO { gameManager.setReloading(true); int count = -1; - for (PossibleAction action : gameData.actions) { - count++; - if (!gameManager.processOnReload(action)) { - log.error ("Load interrupted"); - DisplayBuffer.add(LocalText.getText("LoadInterrupted", count)); - ReportBuffer.add(LocalText.getText("LoadInterrupted", count)); - break; + if (gameData != null && gameData.actions != null) { + for (PossibleAction action : gameData.actions) { + count++; + if (!gameManager.processOnReload(action)) { + log.error ("Load interrupted"); + DisplayBuffer.add(LocalText.getText("LoadInterrupted", count)); + ReportBuffer.add(LocalText.getText("LoadInterrupted", count)); + break; + } } } commit 3892c7f2d7d9685cc3a1e5b69e4be900fe7bc4e7 Author: Erik Vos <eri...@xs...> Date: Thu Jun 14 15:44:15 2012 +0200 Fix to 1835 (etc.) token relay fix (previous commit). It failed in a typical 1830 Erie case.(cherry picked from commit ce10cb981aa82985380177433571aed4789f75ae) diff --git a/rails/ui/swing/ORUIManager.java b/rails/ui/swing/ORUIManager.java index 2252757..f3b6049 100644 --- a/rails/ui/swing/ORUIManager.java +++ b/rails/ui/swing/ORUIManager.java @@ -963,12 +963,14 @@ public class ORUIManager implements DialogOwner { if (stopsToQuery.size() == 2) { Collections.sort(stopsToQuery, new Comparator<Stop>() { public int compare (Stop s1, Stop s2) { - // Home stops on this hex go first. - boolean home1 = ((BaseToken)s1.getTokens().get(0)).getCompany().getHomeHexes().contains(hex); - boolean home2 = ((BaseToken)s2.getTokens().get(0)).getCompany().getHomeHexes().contains(hex); - if (home1 && !home2) { + List<TokenI> tokens; + boolean stop1IsHome = !((tokens = s1.getTokens()).isEmpty()) + && ((BaseToken)tokens.get(0)).getCompany().getHomeHexes().contains(hex); + boolean stop2IsHome = !((tokens = s2.getTokens()).isEmpty()) + && ((BaseToken)tokens.get(0)).getCompany().getHomeHexes().contains(hex); + if (stop1IsHome && !stop2IsHome) { return -1; - } else if (home2 && !home1) { + } else if (stop2IsHome && !stop1IsHome) { return 1; } else { return 0; // Doesn't matter commit 18b22dec3aeaa01d27250baf5b7dc0256c777d64 Author: Erik Vos <eri...@xs...> Date: Wed Jun 13 17:36:00 2012 +0200 Fixes for 1835 Pfalzbahnen. Manual closure made possible for PfB. If two tokens are laid on L6 (BA home) before the first tile, only the BA president will get asked where to put the BA home token. (cherry picked from commit f34c80df8dacc9f6381c2a0c615cec89aade704c) Conflicts: data/1835/CompanyManager.xml diff --git a/data/1835/CompanyManager.xml b/data/1835/CompanyManager.xml index 9f28099..bfdbb7f 100644 --- a/data/1835/CompanyManager.xml +++ b/data/1835/CompanyManager.xml @@ -55,7 +55,7 @@ <ClosingConditions> <Phase>5</Phase> <SpecialProperties condition="ifAllExercised"/> - <CloseManually/> <!-- If second tile is laid not via special property --> + <CloseManually/> <!-- Workaround, may be needed if one of the tiles is not laid via this special property --> </ClosingConditions> </Company> <Company name="PfB" longname="Pfalzbahnen" type="Private" basePrice="150" revenue="15"> @@ -70,7 +70,7 @@ <ClosingConditions> <Phase>5</Phase> <SpecialProperties condition="ifAllExercised"/> - <CloseManually/> <!-- If tile is laid not via special property--> + <CloseManually/> <!-- Workaround, may be needed if a tile or token is not laid via this special property --> </ClosingConditions> </Company> <Company name="LD" longname="Leipzig-Dresdner Bahn" type="Private" basePrice="190"> diff --git a/rails/ui/swing/ORUIManager.java b/rails/ui/swing/ORUIManager.java index 0224995..2252757 100644 --- a/rails/ui/swing/ORUIManager.java +++ b/rails/ui/swing/ORUIManager.java @@ -937,12 +937,53 @@ public class ORUIManager implements DialogOwner { */ protected void relayBaseTokens (LayTile action) { - MapHex hex = action.getChosenHex(); + final MapHex hex = action.getChosenHex(); TileI newTile = action.getLaidTile(); TileI oldTile = hex.getCurrentTile(); if (!action.isRelayBaseTokens() && !oldTile.relayBaseTokensOnUpgrade()) return; - for (Stop oldStop : hex.getStops()) { + + List<Stop> stopsToQuery = hex.getStops(); + + /* Check which tokens must be relaid, and in which sequence. + * Ideally, the game engine should instruct the UI what to do + * if there is more than one stop and more than one token. + * TODO LayTile does not yet allow that. + * + * For now, the only case that needs special handling is the 1835 BA home hex L6, + * where it it possible to have two tokens laid before even one tile. + * Let's generalise this case to: two stops, both tokened. + * We consider single-slot stops only. + * In fact, all we need to do is + * 1. Sort the stops so that the home company gets queried first, + * 2. Count down the number of free slots per new station, so that full stations are skipped, + * It's already taken care for, that a choice-between-one is handled automatically. + * [EV, jun2012] + */ + if (stopsToQuery.size() == 2) { + Collections.sort(stopsToQuery, new Comparator<Stop>() { + public int compare (Stop s1, Stop s2) { + // Home stops on this hex go first. + boolean home1 = ((BaseToken)s1.getTokens().get(0)).getCompany().getHomeHexes().contains(hex); + boolean home2 = ((BaseToken)s2.getTokens().get(0)).getCompany().getHomeHexes().contains(hex); + if (home1 && !home2) { + return -1; + } else if (home2 && !home1) { + return 1; + } else { + return 0; // Doesn't matter + } + } + }); + } + + // Array to enable counting down the free token slots per new station + int[] freeSlots = new int[1 + newTile.getStations().size()]; + for (Station newStation : newTile.getStations()) { + freeSlots[newStation.getNumber()] = newStation.getBaseSlots(); + } + + for (Stop oldStop : stopsToQuery) { if (oldStop.hasTokens()) { // Assume only 1 token (no exceptions known) PublicCompanyI company = ((BaseToken)oldStop.getTokens().get(0)).getCompany(); @@ -951,7 +992,7 @@ public class ORUIManager implements DialogOwner { Map<String, Integer> promptToCityMap = new HashMap<String, Integer>(); String prompt; for (Station newStation : newTile.getStations()) { - if (newStation.getBaseSlots() > 0) { + if (newStation.getBaseSlots() > 0 && freeSlots[newStation.getNumber()] > 0) { prompt = LocalText.getText("SelectStationForTokenOption", newStation.getNumber(), hex.getConnectionString( @@ -987,8 +1028,10 @@ public class ORUIManager implements DialogOwner { prompts.toArray(), prompts.get(0)); if (selected == null) return; action.addRelayBaseToken(company.getName(), promptToCityMap.get(selected)); + --freeSlots[promptToCityMap.get(selected)]; } else { - action.addRelayBaseToken(company.getName(), promptToCityMap.get(prompts.toArray() [0])); + action.addRelayBaseToken(company.getName(), promptToCityMap.get(prompts.toArray()[0])); + --freeSlots[promptToCityMap.get(prompts.toArray()[0])]; } } } |