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: Stefan F. <ste...@us...> - 2010-03-29 20:20:39
|
Update of /cvsroot/rails/18xx/test/data/1851/test In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1851/test Log Message: Directory /cvsroot/rails/18xx/test/data/1851/test added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:39
|
Update of /cvsroot/rails/18xx/test/data/1851 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1851 Log Message: Directory /cvsroot/rails/18xx/test/data/1851 added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:39
|
Update of /cvsroot/rails/18xx/test/data/1835/pbem In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1835/pbem Log Message: Directory /cvsroot/rails/18xx/test/data/1835/pbem added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1835 Log Message: Directory /cvsroot/rails/18xx/test/data/1835 added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data/1830/finished In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1830/finished Log Message: Directory /cvsroot/rails/18xx/test/data/1830/finished added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data/1830/pbem In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1830/pbem Log Message: Directory /cvsroot/rails/18xx/test/data/1830/pbem added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data/1835/finished In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1835/finished Log Message: Directory /cvsroot/rails/18xx/test/data/1835/finished added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data Log Message: Directory /cvsroot/rails/18xx/test/data added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:38
|
Update of /cvsroot/rails/18xx/test/data/1830/bug In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1830/bug Log Message: Directory /cvsroot/rails/18xx/test/data/1830/bug added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-29 20:20:37
|
Update of /cvsroot/rails/18xx/test/data/1830 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25568/test/data/1830 Log Message: Directory /cvsroot/rails/18xx/test/data/1830 added to the repository |
From: Stefan F. <ste...@us...> - 2010-03-28 22:14:11
|
Update of /cvsroot/rails/18xx/test In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3602/test Modified Files: TestGameBuilder.java Log Message: Replaced FileNameExtensionFilter (Java 6) with FileFilter (Java 5) Index: TestGameBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/test/TestGameBuilder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestGameBuilder.java 23 Mar 2010 18:45:23 -0000 1.1 --- TestGameBuilder.java 28 Mar 2010 22:14:01 -0000 1.2 *************** *** 2,5 **** --- 2,6 ---- import java.io.File; + import java.io.FilenameFilter; import java.io.IOException; import java.io.PrintWriter; *************** *** 10,14 **** import javax.swing.JFileChooser; import javax.swing.JPanel; ! import javax.swing.filechooser.FileNameExtensionFilter; import junit.framework.Test; --- 11,15 ---- import javax.swing.JFileChooser; import javax.swing.JPanel; ! import javax.swing.filechooser.FileFilter; import junit.framework.Test; *************** *** 201,205 **** chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setMultiSelectionEnabled(true); ! chooser.setFileFilter(new FileNameExtensionFilter("Rails save files (*.rails)", "rails")); chooser.setAcceptAllFileFilterUsed(false); chooser.showDialog(panel, "Select"); --- 202,214 ---- chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setMultiSelectionEnabled(true); ! // Java 6: chooser.setFileFilter(new FileNameExtensionFilter("Rails save files (*.rails)", "rails")); ! chooser.setFileFilter(new FileFilter() { ! public boolean accept(File f) { ! return f.isDirectory() || f.getName().endsWith("." + Config.get("save.filename.extension")); ! } ! public String getDescription() { ! return "Rails save files (*."+ Config.get("save.filename.extension") + ")" ; ! } ! }); chooser.setAcceptAllFileFilterUsed(false); chooser.showDialog(panel, "Select"); |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:29
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243 Modified Files: .classpath LocalisedText.properties Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** LocalisedText.properties 28 Mar 2010 17:06:32 -0000 1.123 --- LocalisedText.properties 28 Mar 2010 20:14:20 -0000 1.124 *************** *** 282,286 **** 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) Message=Message --- 282,286 ---- MERGE=MERGE MergeOption=Merge {0} ({1}) into {2} for a {3}% share of {2} ! MergeMinorConfirm={0}, do you want to merge minor {1} to start company {2}? MERGE_MINOR_LOG={0} merges minor {1} into {2}, with {3} cash and {4} train(s) Message=Message *************** *** 417,421 **** SelectLoansToRepay=Select number of loans of {0} to repay SelectMinorToMerge=Select the minor to merge to start company {0} ! SelectCompaniesToFold=Select any companies to fold into {0} SelectNoBid=Select, No Bid SelectTrain=Select a train and press OK, or press Done. --- 417,421 ---- SelectLoansToRepay=Select number of loans of {0} to repay SelectMinorToMerge=Select the minor to merge to start company {0} ! SelectCompaniesToFold={0}, select any companies to fold into {1} SelectNoBid=Select, No Bid SelectTrain=Select a train and press OK, or press Done. Index: .classpath =================================================================== RCS file: /cvsroot/rails/18xx/.classpath,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** .classpath 28 Feb 2010 21:38:05 -0000 1.14 --- .classpath 28 Mar 2010 20:14:20 -0000 1.15 *************** *** 31,34 **** --- 31,35 ---- <classpathentry path="lib/batik-1.6/batik-ttf2svg.jar" exported="true" kind="lib"/> <classpathentry path="lib/log4j-1.2/log4j-1.2.14.jar" exported="true" kind="lib"/> + <classpathentry path="C:/Java/eclipse521/plugins/org.junit_3.8.2.v20090203-1005/junit.jar" kind="lib"/> <classpathentry path="classes" kind="output"/> </classpath> |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/rails/game Modified Files: OperatingRound.java GameManager.java GameManagerI.java Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** OperatingRound.java 27 Mar 2010 18:44:24 -0000 1.120 --- OperatingRound.java 28 Mar 2010 20:14:20 -0000 1.121 *************** *** 1319,1323 **** */ public boolean done() { - String errMsg = null; if (operatingCompany.getPortfolio().getNumberOfTrains() == 0 --- 1319,1322 ---- *************** *** 1594,1598 **** } ! if (tm.hasPhaseChanged()) gameManager.newPhaseChecks(this); return true; --- 1593,1597 ---- } ! if (tm.hasPhaseChanged()) newPhaseChecks(); return true; *************** *** 1617,1620 **** --- 1616,1623 ---- } + /** Stub */ + protected void newPhaseChecks() { + } + @Override public void resume() { Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** GameManager.java 28 Mar 2010 17:05:55 -0000 1.96 --- GameManager.java 28 Mar 2010 20:14:20 -0000 1.97 *************** *** 55,59 **** protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = --- 55,59 ---- protected TileManager tileManager; protected Bank bank; ! // map of correctionManagers protected Map<CorrectionType, CorrectionManagerI> correctionManagers = *************** *** 656,664 **** } - /** Stub, can be overridden in subclasses with actual actions */ - public void newPhaseChecks (RoundI round) { - - } - public String getORId () { if (showCompositeORNumber) { --- 656,659 ---- *************** *** 1434,1441 **** correctionManagers.put(ct, cm); log.debug("Added CorrectionManager for " + ct); ! } return cm; } - } --- 1429,1435 ---- correctionManagers.put(ct, cm); log.debug("Added CorrectionManager for " + ct); ! } return cm; } } Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GameManagerI.java 28 Mar 2010 17:05:55 -0000 1.31 --- GameManagerI.java 28 Mar 2010 20:14:20 -0000 1.32 *************** *** 34,38 **** */ public abstract void nextRound(RoundI round); - public void newPhaseChecks (RoundI round); public String getORId (); --- 34,37 ---- *************** *** 197,201 **** public ReportBuffer getReportBuffer(); public GuiHints getUIHints(); ! public CorrectionManagerI getCorrectionManager(CorrectionType ct); } \ No newline at end of file --- 196,200 ---- public ReportBuffer getReportBuffer(); public GuiHints getUIHints(); ! public CorrectionManagerI getCorrectionManager(CorrectionType ct); } \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/rails/ui/swing/gamespecific/_1835 Modified Files: StatusWindow_1835.java Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: StatusWindow_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_1835/StatusWindow_1835.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatusWindow_1835.java 4 Mar 2010 22:08:35 -0000 1.2 --- StatusWindow_1835.java 28 Mar 2010 20:14:20 -0000 1.3 *************** *** 69,75 **** LocalText.getText("Select"), LocalText.getText("MergeMinorConfirm", ! "M2", StockRound_1835.PR_ID), "Yes", ! "No" ); } else { // Ask if any other prePrussians should be folded --- 69,76 ---- LocalText.getText("Select"), LocalText.getText("MergeMinorConfirm", ! getCurrentPlayer().getName(), ! PrussianFormationRound.M2_ID, StockRound_1835.PR_ID), "Yes", ! "No"); } else { // Ask if any other prePrussians should be folded *************** *** 87,91 **** currentDialog = new CheckBoxDialog (gameUIManager, LocalText.getText("Select"), ! LocalText.getText("SelectCompaniesToFold", prussian.getLongName()), options); } --- 88,94 ---- currentDialog = new CheckBoxDialog (gameUIManager, LocalText.getText("Select"), ! LocalText.getText("SelectCompaniesToFold", ! getCurrentPlayer().getName(), ! prussian.getLongName()), options); } |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/data/1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/data/1835 Modified Files: Game.xml Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1835/Game.xml,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Game.xml 21 Mar 2010 17:43:49 -0000 1.29 --- Game.xml 28 Mar 2010 20:14:20 -0000 1.30 *************** *** 15,18 **** --- 15,19 ---- <NoSaleIfNotOperated/> </StockRound> + <OperatingRound class="rails.game.specific._1835.OperatingRound_1835"/> </GameParameters> <GuiClasses> |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/rails/ui/swing/elements In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/rails/ui/swing/elements Modified Files: CheckBoxDialog.java Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: CheckBoxDialog.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/elements/CheckBoxDialog.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CheckBoxDialog.java 31 Jan 2010 22:22:34 -0000 1.7 --- CheckBoxDialog.java 28 Mar 2010 20:14:20 -0000 1.8 *************** *** 131,135 **** } } else if (arg0.getSource().equals(cancelButton)) { ! return; } setVisible(false); --- 131,135 ---- } } else if (arg0.getSource().equals(cancelButton)) { ! // return; } setVisible(false); |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/rails/ui/swing Modified Files: StatusWindow.java Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: StatusWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StatusWindow.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** StatusWindow.java 14 Mar 2010 13:10:15 -0000 1.40 --- StatusWindow.java 28 Mar 2010 20:14:19 -0000 1.41 *************** *** 663,666 **** --- 663,670 ---- } + public Player getCurrentPlayer () { + return gameUIManager.getCurrentPlayer(); + } + public void endOfGameReport() { |
From: Erik V. <ev...@us...> - 2010-03-28 20:14:28
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1835 In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv14243/rails/game/specific/_1835 Modified Files: GameManager_1835.java PrussianFormationRound.java Added Files: OperatingRound_1835.java Log Message: Fixes to get excess train discard before prussion formation on buying the first 4-train in 1835. And personalizing the Prussian formation prompts. Index: PrussianFormationRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/PrussianFormationRound.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PrussianFormationRound.java 27 Mar 2010 18:44:24 -0000 1.7 --- PrussianFormationRound.java 28 Mar 2010 20:14:20 -0000 1.8 *************** *** 31,35 **** Step step; ! public static String PR_ID = "Pr"; public static String M2_ID = "M2"; --- 31,35 ---- Step step; ! public static String PR_ID = StockRound_1835.PR_ID; public static String M2_ID = "M2"; *************** *** 352,355 **** --- 352,356 ---- return unissued == null || unissued.isEmpty(); } + @Override public String toString() { Index: GameManager_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1835/GameManager_1835.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GameManager_1835.java 27 Mar 2010 18:44:24 -0000 1.4 --- GameManager_1835.java 28 Mar 2010 20:14:20 -0000 1.5 *************** *** 32,36 **** if (!PrussianFormationRound.prussianIsComplete(this)) { previousRound = round; ! startPrussianFormationRound (); } } else { --- 32,36 ---- if (!PrussianFormationRound.prussianIsComplete(this)) { previousRound = round; ! startPrussianFormationRound (null); } } else { *************** *** 41,57 **** } ! public void newPhaseChecks(RoundI round) { ! PhaseI phase = getCurrentPhase(); ! if (phase.getName().equals("4") || phase.getName().equals("4+4") ! || phase.getName().equals("5")) { ! if (!PrussianFormationRound.prussianIsComplete(this)) { ! interruptedRound = round; ! startPrussianFormationRound (); ! } ! } ! } ! ! private void startPrussianFormationRound() { createRound (PrussianFormationRound.class).start (); } --- 41,47 ---- } ! public void startPrussianFormationRound(OperatingRound_1835 or) { + interruptedRound = or; createRound (PrussianFormationRound.class).start (); } --- NEW FILE: OperatingRound_1835.java --- package rails.game.specific._1835; import rails.game.GameDef; import rails.game.GameManagerI; import rails.game.OperatingRound; import rails.game.PhaseI; import rails.game.action.DiscardTrain; import rails.game.state.BooleanState; public class OperatingRound_1835 extends OperatingRound { private BooleanState needPrussianFormationCall = new BooleanState ("NeedPrussianFormationCall", false); public OperatingRound_1835 (GameManagerI gameManager) { super (gameManager); } protected void newPhaseChecks() { PhaseI phase = getCurrentPhase(); if (phase.getName().equals("4") || phase.getName().equals("4+4") || phase.getName().equals("5")) { if (!PrussianFormationRound.prussianIsComplete(gameManager)) { if (getStep() == GameDef.OrStep.DISCARD_TRAINS) { // Postpone until trains are discarded needPrussianFormationCall.set(true); } else { // Do it immediately ((GameManager_1835)gameManager).startPrussianFormationRound (this); } } } } public boolean discardTrain(DiscardTrain action) { boolean result = super.discardTrain(action); if (result && getStep() == GameDef.OrStep.BUY_TRAIN && needPrussianFormationCall.booleanValue()) { // Do the postponed formation calls ((GameManager_1835)gameManager).startPrussianFormationRound (this); needPrussianFormationCall.set(false); } return result; } } |
From: Stefan F. <ste...@us...> - 2010-03-28 17:06:40
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18230 Modified Files: LocalisedText.properties Log Message: And the changes in LocalisedText Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** LocalisedText.properties 14 Mar 2010 15:35:40 -0000 1.122 --- LocalisedText.properties 28 Mar 2010 17:06:32 -0000 1.123 *************** *** 61,64 **** --- 61,65 ---- COMPANY_DETAILS=Company details CORRECT_CASH=Cash Correction + CORRECT_MAP=Map Correction CURRENT=Current CURRENT_PRICE=<html>Current<br>Price</html> *************** *** 138,141 **** --- 139,147 ---- CorrectCashToolTip=Click here to adjust cash position CorrectCashZero=Impossible for zero amount + CorrectMap=Map correction mode is active: + CorrectMapSELECT_HEX=Select hex to lay a tile on + CorrectMapSELECT_TILE=Select a tile, select another hex, or press cancel + CorrectMapSELECT_ORIENTATION=Click tile to rotate it, or select another tile or hex, or press Lay Tile to confirm tile, or press cancel + CorrectMapLaysTileAt=CORRECTION: Lays tile #{0} at hex {1}/{2} CorrectionMainMenu=Correction CorrectionModeActivate={1} activated by {0} |
From: Stefan F. <ste...@us...> - 2010-03-28 17:06:04
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17978/rails/game Modified Files: TileI.java MapHex.java TileManager.java GameManagerI.java GameManager.java Tile.java Log Message: Added MapCorrection Mode and some refactoring on the CorrectionClasses Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Tile.java 31 Jan 2010 22:22:28 -0000 1.36 --- Tile.java 28 Mar 2010 17:05:55 -0000 1.37 *************** *** 10,14 **** import rails.util.Tag; ! public class Tile extends ModelObject implements TileI, StationHolder { /** The 'internal id', identifying the tile in the XML files */ --- 10,14 ---- import rails.util.Tag; ! public class Tile extends ModelObject implements TileI, StationHolder, Comparable<TileI> { /** The 'internal id', identifying the tile in the XML files */ *************** *** 373,376 **** --- 373,390 ---- } + /** + * Get all possible upgrades for a specific tile + * + * @return A List of valid upgrade TileI objects. + */ + + public List<TileI> getAllUpgrades() { + List<TileI> upgr = new ArrayList<TileI>(); + for (Upgrade upgrade : upgrades) { + upgr.add(upgrade.getTile()); + } + return upgr; + } + /** Get a delimited list of all possible upgrades, regardless current phase */ public String getUpgradesString(MapHex hex) { *************** *** 461,465 **** --- 475,495 ---- return quantity; } + + @Override + public String toString() { + return "Tile Id=" + externalId; + } + /** ordering of tiles based first on colour, then on external id */ + public int compareTo(TileI anotherTile) { + Integer colour = this.getColourNumber(); + int result = colour.compareTo(anotherTile.getColourNumber()); + if (result == 0) { + Integer externalId = this.getExternalId(); + result = externalId.compareTo(anotherTile.getExternalId()); + } + return result; + } + protected class Upgrade { Index: TileManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileManager.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TileManager.java 23 Mar 2010 18:44:38 -0000 1.15 --- TileManager.java 28 Mar 2010 17:05:55 -0000 1.16 *************** *** 1 **** ! /* $Header$ */ package rails.game; import java.util.*; import rails.util.LocalText; import rails.util.Tag; public class TileManager implements ConfigurableComponentI { protected Map<Integer, TileI> tileMap = new HashMap<Integer, TileI>(); protected List<Integer> tileIds = new ArrayList<Integer>(); // private static List<String> directories = new ArrayList<String>(); private List<String> directories = new ArrayList<String>(); /** * No-args constructor. */ public TileManager() { } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tileSetTop) throws ConfigurationException { /* * Note: prefix se is used for elements from TileSet.xml, prefix te for * elements from Tiles.xml. */ String tileDefFileName = tileSetTop.getAttributeAsString("tiles"); if (tileDefFileName == null) throw new ConfigurationException(LocalText.getText("NoTilesXML")); //directories.add("data/" + ComponentManager.getGameName()); directories.add("data/" + GameManager.getInstance().getGameName()); Tag tileDefTop = Tag.findTopTagInFile(tileDefFileName, directories, "Tiles"); if (tileDefTop == null) throw new ConfigurationException(LocalText.getText("NoTilesTag")); List<Tag> tileSetList = tileSetTop.getChildren("Tile"); List<Tag> tileDefList = tileDefTop.getChildren("Tile"); /* * The XML files TileSet.xml and Tiles.xml are read side by side, as * each one configures different tile aspects. The reason for having two * XML files is, that Tiles.xml defines per-tile aspects that are the * same for all games (such as the colour, tracks and stations; this * file is an automatically generated subset of the generic file * tiles/Tiles.xml), whereas TileSet.xml specifies the aspects that are * (or can be) specific to each rails.game (such as the possible * upgrades). <p>TileSet.xml is leading. */ int tileId; TileI tile; // Creates maps to the tile definitions in both files. Map<Integer, Tag> tileSetMap = new HashMap<Integer, Tag>(); Map<Integer, Tag> tileDefMap = new HashMap<Integer, Tag>(); for (Tag tileSetTag : tileSetList) { tileId = tileSetTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTilesetID", String.valueOf(tileId))); } tileSetMap.put(tileId, tileSetTag); tileIds.add(tileId); } for (Tag tileDefTag : tileDefList) { tileId = tileDefTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileDefMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTileID", String.valueOf(tileId))); } else if (!tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "TileMissingInTileSet", String.valueOf(tileId))); } tileDefMap.put(tileId, tileDefTag); } // Create the Tile objects (must be done before further parsing) for (Integer id : tileSetMap.keySet()) { tile = new Tile(id); tileMap.put(id, tile); } // Finally, parse the <Tile> subtags for (Integer id : tileMap.keySet()) { tile = tileMap.get(id); tile.configureFromXML(tileSetMap.get(id), tileDefMap.get(id)); } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (TileI tile : tileMap.values()) { tile.finishConfiguration(this); } } public TileI getTile(int id) { return tileMap.get(id); } /** Get the tile IDs in the XML definition sequence */ public List<Integer> getTileIds() { return tileIds; } } \ No newline at end of file --- 1 ---- ! /* $Header$ */ package rails.game; import java.util.*; import rails.util.LocalText; import rails.util.Tag; public class TileManager implements ConfigurableComponentI { protected Map<Integer, TileI> tileMap = new HashMap<Integer, TileI>(); protected List<Integer> tileIds = new ArrayList<Integer>(); // private static List<String> directories = new ArrayList<String>(); private List<String> directories = new ArrayList<String>(); /** * No-args constructor. */ public TileManager() { } /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public void configureFromXML(Tag tileSetTop) throws ConfigurationException { /* * Note: prefix se is used for elements from TileSet.xml, prefix te for * elements from Tiles.xml. */ String tileDefFileName = tileSetTop.getAttributeAsString("tiles"); if (tileDefFileName == null) throw new ConfigurationException(LocalText.getText("NoTilesXML")); //directories.add("data/" + ComponentManager.getGameName()); directories.add("data/" + GameManager.getInstance().getGameName()); Tag tileDefTop = Tag.findTopTagInFile(tileDefFileName, directories, "Tiles"); if (tileDefTop == null) throw new ConfigurationException(LocalText.getText("NoTilesTag")); List<Tag> tileSetList = tileSetTop.getChildren("Tile"); List<Tag> tileDefList = tileDefTop.getChildren("Tile"); /* * The XML files TileSet.xml and Tiles.xml are read side by side, as * each one configures different tile aspects. The reason for having two * XML files is, that Tiles.xml defines per-tile aspects that are the * same for all games (such as the colour, tracks and stations; this * file is an automatically generated subset of the generic file * tiles/Tiles.xml), whereas TileSet.xml specifies the aspects that are * (or can be) specific to each rails.game (such as the possible * upgrades). <p>TileSet.xml is leading. */ int tileId; TileI tile; // Creates maps to the tile definitions in both files. Map<Integer, Tag> tileSetMap = new HashMap<Integer, Tag>(); Map<Integer, Tag> tileDefMap = new HashMap<Integer, Tag>(); for (Tag tileSetTag : tileSetList) { tileId = tileSetTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTilesetID", String.valueOf(tileId))); } tileSetMap.put(tileId, tileSetTag); tileIds.add(tileId); } for (Tag tileDefTag : tileDefList) { tileId = tileDefTag.getAttributeAsInteger("id"); /* * Check for duplicates (this also covers missing tile ids, as this * returns 0, and we always have a tile numbered 0! */ if (tileDefMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "DuplicateTileID", String.valueOf(tileId))); } else if (!tileSetMap.containsKey(tileId)) { throw new ConfigurationException(LocalText.getText( "TileMissingInTileSet", String.valueOf(tileId))); } tileDefMap.put(tileId, tileDefTag); } // Create the Tile objects (must be done before further parsing) for (Integer id : tileSetMap.keySet()) { tile = new Tile(id); tileMap.put(id, tile); } // Finally, parse the <Tile> subtags for (Integer id : tileMap.keySet()) { tile = tileMap.get(id); tile.configureFromXML(tileSetMap.get(id), tileDefMap.get(id)); } } public void finishConfiguration (GameManagerI gameManager) throws ConfigurationException { for (TileI tile : tileMap.values()) { tile.finishConfiguration(this); } } public TileI getTile(int id) { return tileMap.get(id); } /** Get the tile IDs in the XML definition sequence */ public List<Integer> getTileIds() { return tileIds; } /** returns the set of all possible upgrade tiles */ public List<TileI> getAllUpgrades(TileI tile) { TreeSet<TileI> tileSet = new TreeSet<TileI>(); return new ArrayList<TileI>(recursiveUpgrades(tile, tileSet)); } private TreeSet<TileI> recursiveUpgrades(TileI tile, TreeSet<TileI> tileSet) { tileSet.add(tile); List<TileI> directUpgrades = tile.getAllUpgrades(); for (TileI upgrade:directUpgrades) if (!tileSet.contains(upgrade)) tileSet = recursiveUpgrades(upgrade, tileSet); return tileSet; } } \ No newline at end of file Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** GameManager.java 27 Mar 2010 18:44:24 -0000 1.95 --- GameManager.java 28 Mar 2010 17:05:55 -0000 1.96 *************** *** 55,58 **** --- 55,62 ---- protected TileManager tileManager; protected Bank bank; + + // map of correctionManagers + protected Map<CorrectionType, CorrectionManagerI> correctionManagers = + new HashMap<CorrectionType, CorrectionManagerI>(); protected String gameName; *************** *** 779,783 **** } ! if (result && !(action instanceof GameAction)) { new AddToList<PossibleAction>(executedActions, action, "ExecutedActions"); --- 783,787 ---- } ! if (result && !(action instanceof GameAction) && action.hasActed()) { new AddToList<PossibleAction>(executedActions, action, "ExecutedActions"); *************** *** 792,796 **** // when setting possible actions if (action != null) { ! if (result && !(action instanceof GameAction)) { if (moveStack.isOpen()) moveStack.finish(); } else { --- 796,800 ---- // when setting possible actions if (action != null) { ! if (result && !(action instanceof GameAction) && action.hasActed()) { if (moveStack.isOpen()) moveStack.finish(); } else { *************** *** 831,835 **** // If any Correction is active for (CorrectionType ct:EnumSet.allOf(CorrectionType.class)) { ! CorrectionManager cm = ct.getManager(this); if (cm.isActive()) { possibleActions.clear(); --- 835,839 ---- // If any Correction is active for (CorrectionType ct:EnumSet.allOf(CorrectionType.class)) { ! CorrectionManagerI cm = getCorrectionManager(ct); if (cm.isActive()) { possibleActions.clear(); *************** *** 837,855 **** } - // 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:EnumSet.allOf(CorrectionType.class)) { ! CorrectionManager cm = ct.getManager(this); possibleActions.addAll(cm.createCorrections()); } --- 841,848 ---- } // Correction Actions for (CorrectionType ct:EnumSet.allOf(CorrectionType.class)) { ! CorrectionManagerI cm = getCorrectionManager(ct); possibleActions.addAll(cm.createCorrections()); } *************** *** 860,890 **** 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); } --- 853,860 ---- boolean result = false; if (a instanceof CorrectionAction) { CorrectionAction ca= (CorrectionAction)a; CorrectionType ct = ca.getCorrectionType(); ! CorrectionManagerI cm = getCorrectionManager(ct); result = cm.executeCorrection(ca); } *************** *** 1457,1459 **** --- 1427,1441 ---- return guiHints; } + + public CorrectionManagerI getCorrectionManager(CorrectionType ct) { + CorrectionManagerI cm = correctionManagers.get(ct); + if (cm == null) { + cm=ct.newCorrectionManager(this); + correctionManagers.put(ct, cm); + log.debug("Added CorrectionManager for " + ct); + } + return cm; + } + } + Index: MapHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/MapHex.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** MapHex.java 24 Feb 2010 22:10:45 -0000 1.39 --- MapHex.java 28 Mar 2010 17:05:55 -0000 1.40 *************** *** 62,65 **** --- 62,66 ---- protected TileI currentTile; protected int currentTileRotation; + protected int preprintedTileRotation; protected int[] tileCost; protected String cityName; *************** *** 163,167 **** preprintedTileId = tag.getAttributeAsInteger("tile", -999); ! currentTileRotation = tag.getAttributeAsInteger("orientation", 0); impassable = tag.getAttributeAsString("impassable"); --- 164,169 ---- preprintedTileId = tag.getAttributeAsInteger("tile", -999); ! preprintedTileRotation = tag.getAttributeAsInteger("orientation", 0); ! currentTileRotation = preprintedTileRotation; impassable = tag.getAttributeAsString("impassable"); *************** *** 289,292 **** --- 291,298 ---- return preprintedTileId; } + + public int getPreprintedTileRotation() { + return preprintedTileRotation; + } /** *************** *** 346,355 **** /** ! * Prepare a tile upgrade. The actual tile replacement is done in ! * replaceTile(), via a TileMove object. */ public void upgrade(LayTile action) { TileI newTile = action.getLaidTile(); int newRotation = action.getOrientation(); City newCity; --- 352,372 ---- /** ! * new wrapper function for the LayTile action that calls the actual ! * upgrade mehod ! * @param action executed LayTile action */ public void upgrade(LayTile action) { TileI newTile = action.getLaidTile(); int newRotation = action.getOrientation(); + Map<String, Integer> relaidTokens = action.getRelaidBaseTokens(); + + upgrade(newTile, newRotation, relaidTokens); + } + + /** + * Prepare a tile upgrade. The actual tile replacement is done in + * replaceTile(), via a TileMove object. + */ + public void upgrade(TileI newTile, int newRotation, Map<String, Integer> relaidTokens) { City newCity; *************** *** 357,361 **** List<City> newCities; - Map<String, Integer> relaidTokens = action.getRelaidBaseTokens(); if (relaidTokens == null) relaidTokens = new HashMap<String, Integer>(); --- 374,377 ---- Index: TileI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileI.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TileI.java 30 Oct 2009 21:53:03 -0000 1.16 --- TileI.java 28 Mar 2010 17:05:55 -0000 1.17 *************** *** 46,49 **** --- 46,51 ---- public List<TileI> getUpgrades(MapHex hex, PhaseI phase); + public List<TileI> getAllUpgrades(); + public List<TileI> getValidUpgrades(MapHex hex, PhaseI phase); Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** GameManagerI.java 27 Mar 2010 18:44:24 -0000 1.30 --- GameManagerI.java 28 Mar 2010 17:05:55 -0000 1.31 *************** *** 7,10 **** --- 7,12 ---- import rails.common.GuiHints; import rails.game.action.PossibleAction; + import rails.game.correct.CorrectionManagerI; + import rails.game.correct.CorrectionType; import rails.game.model.ModelObject; import rails.game.move.AddToList; *************** *** 195,198 **** public ReportBuffer getReportBuffer(); public GuiHints getUIHints(); ! } \ No newline at end of file --- 197,201 ---- public ReportBuffer getReportBuffer(); public GuiHints getUIHints(); ! ! public CorrectionManagerI getCorrectionManager(CorrectionType ct); } \ No newline at end of file |
From: Stefan F. <ste...@us...> - 2010-03-28 17:06:04
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17978/rails/ui/swing Modified Files: UpgradesPanel.java ORUIManager.java Log Message: Added MapCorrection Mode and some refactoring on the CorrectionClasses Index: UpgradesPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/UpgradesPanel.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** UpgradesPanel.java 28 Feb 2010 21:38:04 -0000 1.24 --- UpgradesPanel.java 28 Mar 2010 17:05:56 -0000 1.25 *************** *** 16,19 **** --- 16,21 ---- import rails.game.*; import rails.game.action.*; + import rails.game.correct.CorrectionAction; + import rails.game.correct.MapCorrectionAction; import rails.ui.swing.elements.ActionLabel; import rails.ui.swing.hexmap.GUIHex; *************** *** 23,26 **** --- 25,29 ---- public class UpgradesPanel extends Box implements MouseListener, ActionListener { private static final long serialVersionUID = 1L; + private ORUIManager orUIManager; private List<ActionLabel> tokenLabels; *************** *** 30,34 **** static private Color defaultLabelBgColour = new JLabel("").getBackground(); static private Color selectedLabelBgColour = new Color(255, 220, 150); ! private JPanel upgradePanel; private JScrollPane scrollPane; --- 33,38 ---- static private Color defaultLabelBgColour = new JLabel("").getBackground(); static private Color selectedLabelBgColour = new Color(255, 220, 150); ! private static final int defaultNbPanelElements = 15; ! private JPanel upgradePanel; private JScrollPane scrollPane; *************** *** 59,63 **** upgradePanel.setBackground(Color.DARK_GRAY); upgradePanel.setBorder(border); ! upgradePanel.setLayout(new GridLayout(15, 1)); scrollPane = new JScrollPane(upgradePanel); --- 63,67 ---- upgradePanel.setBackground(Color.DARK_GRAY); upgradePanel.setBorder(border); ! upgradePanel.setLayout(new GridLayout(defaultNbPanelElements, 1)); scrollPane = new JScrollPane(upgradePanel); *************** *** 100,106 **** } } ! public void showUpgrades() { upgradePanel.removeAll(); if (tokenMode && possibleTokenLays != null && possibleTokenLays.size() > 0) { --- 104,115 ---- } } ! public void showUpgrades() { upgradePanel.removeAll(); + + // reset to the number of elements + GridLayout panelLayout = (GridLayout)upgradePanel.getLayout(); + panelLayout.setRows(defaultNbPanelElements); + if (tokenMode && possibleTokenLays != null && possibleTokenLays.size() > 0) { *************** *** 181,184 **** --- 190,241 ---- } + // populate version for corrections + public void showCorrectionUpgrades() { + upgradePanel.removeAll(); + GridLayout panelLayout = (GridLayout)upgradePanel.getLayout(); + List<TileI> tiles = orUIManager.tileUpgrades; + + if (tiles == null || tiles.size() == 0) { + // reset to the number of elements + panelLayout.setRows(defaultNbPanelElements); + // set to position 0 + scrollPane.getVerticalScrollBar().setValue(0); + } else { + // set to the max of available or the default number of elements + panelLayout.setRows(Math.max(tiles.size() + 2, defaultNbPanelElements)); + for (TileI tile : tiles) { + + BufferedImage hexImage = getHexImage(tile.getId()); + ImageIcon hexIcon = new ImageIcon(hexImage); + + // Cheap n' Easy rescaling. + hexIcon.setImage(hexIcon.getImage().getScaledInstance( + (int) (hexIcon.getIconWidth() * GUIHex.NORMAL_SCALE * 0.8), + (int) (hexIcon.getIconHeight() * GUIHex.NORMAL_SCALE * 0.8), + Image.SCALE_SMOOTH)); + + HexLabel hexLabel = new HexLabel(hexIcon, tile.getId()); + hexLabel.setName(tile.getName()); + if (tile.getExternalId() > 0) + hexLabel.setText("" + tile.getExternalId()); + else + hexLabel.setText(""); + hexLabel.setOpaque(true); + hexLabel.setVisible(true); + hexLabel.setBorder(border); + hexLabel.addMouseListener(this); + + upgradePanel.add(hexLabel); + } + } + + upgradePanel.add(doneButton); + upgradePanel.add(cancelButton); + + // repaint(); + revalidate(); + } + + public void clear() { upgradePanel.removeAll(); Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** ORUIManager.java 5 Mar 2010 20:51:15 -0000 1.61 --- ORUIManager.java 28 Mar 2010 17:05:56 -0000 1.62 *************** *** 52,55 **** --- 52,59 ---- private LayToken selectedTokenAllowance; + // map corrections + private boolean mapCorrectionEnabled = false; + private MapCorrectionAction mapCorrectionAction = null; + /** * Will be set true if a cancelled action does not need to be reported to *************** *** 69,72 **** --- 73,77 ---- public static final int SET_REVENUE = 7; public static final int SELECT_PAYOUT = 8; + public static final int MAP_CORRECTION = 9; /* Message key per substep */ *************** *** 74,78 **** new String[] { "Inactive", "SelectAHexForTile", "SelectATile", "RotateTile", "SelectAHexForToken", "SelectAToken", ! "ConfirmToken", "SetRevenue", "SelectPayout" }; protected static Logger log = --- 79,84 ---- new String[] { "Inactive", "SelectAHexForTile", "SelectATile", "RotateTile", "SelectAHexForToken", "SelectAToken", ! "ConfirmToken", "SetRevenue", "SelectPayout", ! "CorrectMap" }; protected static Logger log = *************** *** 114,118 **** } } ! public <T extends PossibleAction> void setMapRelatedActions(List<T> actions) { --- 120,124 ---- } } ! public <T extends PossibleAction> void setMapRelatedActions(List<T> actions) { *************** *** 122,125 **** --- 128,132 ---- allowedTileLays.clear(); allowedTokenLays.clear(); + for (T action : actions) { if (action instanceof LayTile) { *************** *** 159,163 **** } } ! setLocalStep(nextSubStep); tileLayingEnabled = allowedTileLays.size() > 0; --- 166,170 ---- } } ! setLocalStep(nextSubStep); tileLayingEnabled = allowedTileLays.size() > 0; *************** *** 184,187 **** --- 191,200 ---- /* Add any extra messages */ String extraMessage = ""; + + if (localStep == ORUIManager.MAP_CORRECTION) { + if (mapCorrectionAction != null) + extraMessage = LocalText.getText("CorrectMap" + mapCorrectionAction.getStep().name()); + } + if (localStep == ORUIManager.SELECT_HEX_FOR_TILE) { /* Compose prompt for tile laying */ *************** *** 467,471 **** public void hexClicked(GUIHex clickedHex, GUIHex selectedHex) { ! if (tokenLayingEnabled) { List<LayToken> allowances = map.getTokenAllowanceForHex(clickedHex.getHexModel()); --- 480,504 ---- public void hexClicked(GUIHex clickedHex, GUIHex selectedHex) { ! if (mapCorrectionEnabled) { ! boolean checkClickedHex = false; ! switch (mapCorrectionAction.getStep()) { ! case SELECT_HEX: ! case SELECT_TILE: // if tile is selected see ! checkClickedHex = true; ! break; ! case SELECT_ORIENTATION: ! if (clickedHex == selectedHex) { ! selectedHex.forcedRotateTile(); ! map.repaint(selectedHex.getBounds()); ! } else ! checkClickedHex = true; ! break; ! } ! if (checkClickedHex && clickedHex !=null && clickedHex != selectedHex) { ! map.selectHex(clickedHex); ! mapCorrectionAction.selectHex(clickedHex.getHexModel()); ! orWindow.process(mapCorrectionAction); ! } ! } else if (tokenLayingEnabled) { List<LayToken> allowances = map.getTokenAllowanceForHex(clickedHex.getHexModel()); *************** *** 520,525 **** public void tileSelected(int tileId) { - GUIHex hex = map.getSelectedHex(); TileI tile = gameUIManager.getGameManager().getTileManager().getTile(tileId); // Check if the new tile must be connected to some other track --- 553,569 ---- public void tileSelected(int tileId) { TileI tile = gameUIManager.getGameManager().getTileManager().getTile(tileId); + GUIHex hex = map.getSelectedHex(); + + // map correction override + if (mapCorrectionEnabled) { + // paint tile + hex.forcedDropTile(tileId, 0); + map.repaint(hex.getBounds()); + // inform map correction manager + mapCorrectionAction.selectTile(tile); + orWindow.process(mapCorrectionAction); + return; + } // Check if the new tile must be connected to some other track *************** *** 543,547 **** upgradePanel.showUpgrades(); } - } --- 587,590 ---- *************** *** 1049,1053 **** --- 1092,1112 ---- public void executeUpgrade() { + GUIHex selectedHex = map.getSelectedHex(); + + // map correction override + if (mapCorrectionEnabled) { + if (selectedHex != null && selectedHex.getProvisionalTile() != null) { + mapCorrectionAction.selectOrientation(selectedHex.getProvisionalTileRotation()); + if (orWindow.process(mapCorrectionAction)) { + selectedHex.fixTile(); + } else { + selectedHex.removeTile(); + } + map.selectHex(null); + } + return; + } + if (tileLayingEnabled) { if (selectedHex == null) { *************** *** 1074,1077 **** --- 1133,1145 ---- GUIHex selectedHex = mapPanel.getMap().getSelectedHex(); + // map correction override + if (mapCorrectionEnabled) { + if (selectedHex != null) selectedHex.removeTile(); + mapCorrectionAction.selectCancel(); + orWindow.process(mapCorrectionAction); + map.selectHex(null); + return; + } + if (tokenLayingEnabled) { if (selectedHex != null) selectedHex.removeToken(); *************** *** 1201,1206 **** orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! //if (possibleActions.contains(LayTile.class)) { ! if (orStep == GameDef.OrStep.LAY_TRACK) { orPanel.initTileLayingStep(); --- 1269,1287 ---- orPanel.initOperatingCosts(possibleActions.contains(OperatingCost.class)); ! // MapTileCorrection Actions ! mapCorrectionEnabled = false; ! mapCorrectionAction = null; ! if (possibleActions.contains(MapCorrectionAction.class)) { ! orPanel.initTileLayingStep(); ! orWindow.requestFocus(); ! ! MapCorrectionAction action = (MapCorrectionAction) ! (possibleActions.getType(MapCorrectionAction.class)).get(0); ! ! mapCorrectionEnabled = true; ! mapCorrectionAction = action; ! updateUpgradesPanel(action); ! } else if (orStep == GameDef.OrStep.LAY_TRACK) { ! //if (possibleActions.contains(LayTile.class)) { orPanel.initTileLayingStep(); *************** *** 1296,1300 **** } ! setMapRelatedActions(mapRelatedActions); GameAction undoAction = null; --- 1377,1382 ---- } ! if (!mapCorrectionEnabled) ! setMapRelatedActions(mapRelatedActions); GameAction undoAction = null; *************** *** 1394,1400 **** } - // Correction Actions - - checkForGameSpecificActions(); --- 1476,1479 ---- *************** *** 1481,1484 **** --- 1560,1565 ---- upgradePanel.setDoneEnabled(true); break; + case MAP_CORRECTION: + return; // this is done in their own initialization default: upgradePanel.setDoneEnabled(false); *************** *** 1492,1495 **** --- 1573,1621 ---- } + + public void updateUpgradesPanel(MapCorrectionAction action) { + setLocalStep(MAP_CORRECTION); + + switch (action.getStep()) { + case SELECT_HEX: + // done text will be used by token lay + upgradePanel.setDoneText("LayTile"); + upgradePanel.setDoneEnabled(false); + upgradePanel.setCancelText("Cancel"); + upgradePanel.setCancelEnabled(false); + tileUpgrades = new ArrayList<TileI>(); + break; + case SELECT_TILE: + upgradePanel.setDoneText("LayTile"); + upgradePanel.setDoneEnabled(false); + upgradePanel.setCancelText("Cancel"); + upgradePanel.setCancelEnabled(true); + tileUpgrades = action.getTiles(); + break; + case SELECT_ORIENTATION: + upgradePanel.setDoneText("LayTile"); + upgradePanel.setDoneEnabled(true); + upgradePanel.setCancelText("Cancel"); + upgradePanel.setCancelEnabled(true); + + // next step already set to finished => preprinted tile with fixed orientation + if (action.getNextStep() == MapCorrectionManager.ActionStep.FINISHED) { + GUIHex selectedHex = map.getSelectedHex(); + selectedHex.setTileOrientation(action.getOrientation()); + map.repaint(selectedHex.getBounds()); + if (orWindow.process(mapCorrectionAction)) { + selectedHex.fixTile(); + } else { + selectedHex.removeTile(); + } + map.selectHex(null); + return; + } + break; + } + + log.debug("Active map tile correction"); + upgradePanel.showCorrectionUpgrades(); + } public void setMessage(String message) { |
From: Stefan F. <ste...@us...> - 2010-03-28 17:06:04
|
Update of /cvsroot/rails/18xx/rails/ui/swing/hexmap In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17978/rails/ui/swing/hexmap Modified Files: GUIHex.java Log Message: Added MapCorrection Mode and some refactoring on the CorrectionClasses Index: GUIHex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/hexmap/GUIHex.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** GUIHex.java 16 Feb 2010 20:21:59 -0000 1.38 --- GUIHex.java 28 Mar 2010 17:05:55 -0000 1.39 *************** *** 505,508 **** --- 505,512 ---- } } + + public void forcedRotateTile() { + provisionalGUITile.setRotation(provisionalGUITile.getRotation() + 1); + } private Point getTokenCenter(int numTokens, int currentToken, *************** *** 675,678 **** --- 679,690 ---- } + + /** forces the tile to drop */ + public void forcedDropTile(int tileId, int orientation) { + provisionalGUITile = new GUITile(tileId, this); + provisionalGUITile.setRotation(orientation); + provisionalGUITile.setScale(SELECTED_SCALE); + toolTip = "Click to rotate"; + } public void removeTile() { |
From: Stefan F. <ste...@us...> - 2010-03-28 17:06:04
|
Update of /cvsroot/rails/18xx/rails/game/correct In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17978/rails/game/correct Modified Files: CorrectionModeAction.java CashCorrectionAction.java CorrectionManager.java CorrectionType.java CashCorrectionManager.java Added Files: CorrectionManagerI.java MapCorrectionAction.java MapCorrectionManager.java Log Message: Added MapCorrection Mode and some refactoring on the CorrectionClasses --- NEW FILE: MapCorrectionAction.java --- package rails.game.correct; import java.io.IOException; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.List; import rails.game.correct.MapCorrectionManager.*; import rails.game.MapHex; import rails.game.MapManager; import rails.game.TileI; import rails.game.TileManager; import rails.game.action.PossibleAction; import rails.util.Util; public class MapCorrectionAction extends CorrectionAction { /** The Constant serialVersionUID. */ public static final long serialVersionUID = 1L; /** Sequence: Indicates the enrichment of the action */ transient private ActionStep step = null; private String stepName; transient private ActionStep nextStep = null; private String nextStepName; /* Conditions */ /** Location: where to lay the tile */ transient private MapHex location = null; private String locationCoordinates; /** Tiles: which tile(s) to lay */ transient private List<TileI> tiles = null; private int[] tileIds; /** Orientation: how to lay the tile */ private int orientation; /** * Instantiates a new map tile correction action. * start with select hex */ public MapCorrectionAction() { setStep(ActionStep.SELECT_HEX); setNextStep(null); setCorrectionType(CorrectionType.CORRECT_MAP); } public MapHex getLocation() { return location; } private void setLocation(MapHex location) { this.location = location; locationCoordinates = location.getName(); } public List<TileI> getTiles() { return tiles; } public TileI getChosenTile() { if (step.ordinal() > ActionStep.SELECT_TILE.ordinal()) return tiles.get(0); else return null; } public void setTiles(List<TileI> tiles) { this.tiles = tiles; this.tileIds = new int[tiles.size()]; for (int i = 0; i < tiles.size(); i++) tileIds[i] = tiles.get(i).getId(); } public int getOrientation(){ return orientation; } private void setOrientation(int orientation) { this.orientation = orientation; } public ActionStep getNextStep() { return nextStep; } private void setNextStep(ActionStep step) { this.nextStep = step; if (step == null) nextStepName = null; else nextStepName = step.name(); } public ActionStep getStep() { return step; } private void setStep(ActionStep step) { this.step = step; stepName = step.name(); } public void selectHex(MapHex chosenHex) { setLocation(chosenHex); setNextStep(ActionStep.SELECT_TILE); } public void selectTile(TileI chosenTile) { List<TileI> tiles = new ArrayList<TileI>(); tiles.add(chosenTile); setTiles(tiles); setNextStep(ActionStep.SELECT_ORIENTATION); } public void selectOrientation(int orientation) { setOrientation(orientation); setNextStep(ActionStep.FINISHED); } public void selectCancel() { setNextStep(ActionStep.CANCELLED); } public ActionStep moveToNextStep() { setStep(nextStep); setNextStep(null); if (step != ActionStep.FINISHED) this.acted = false; return step; } @Override public boolean equals(PossibleAction action) { if (!(action instanceof MapCorrectionAction)) return false; MapCorrectionAction a = (MapCorrectionAction) action; return (a.step == this.step); } @Override public String toString(){ StringBuffer b = new StringBuffer("MapCorrectionAction"); if (acted) { b.append(" (acted)"); } else { b.append(" (not acted)"); } b.append(" Step=" + step); if (nextStep != null) b.append(" NextStep=" + nextStep); if (step.ordinal() > ActionStep.SELECT_HEX.ordinal()) b.append(" Hex=" + location.getName()); if (step == ActionStep.SELECT_TILE) b.append(" Possible tiles=" + tiles); if (step.ordinal() > ActionStep.SELECT_TILE.ordinal()) b.append(" Chosen tile=" + tiles); if (step.ordinal() > ActionStep.SELECT_ORIENTATION.ordinal()) b.append(" Orientation=" + orientation); return b.toString(); } /** Deserialize */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (Util.hasValue(correctionName)) correctionType = CorrectionType.valueOf(correctionName); if (Util.hasValue(stepName)) step = ActionStep.valueOf(stepName); if (Util.hasValue(nextStepName)) nextStep = ActionStep.valueOf(nextStepName); MapManager mmgr = gameManager.getMapManager(); if (Util.hasValue(locationCoordinates)) location = mmgr.getHex(locationCoordinates); TileManager tmgr = gameManager.getTileManager(); if (tileIds != null && tileIds.length > 0) { tiles = new ArrayList<TileI>(); for (int i = 0; i < tileIds.length; i++) { tiles.add(tmgr.getTile(tileIds[i])); } } } } Index: CorrectionModeAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CorrectionModeAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CorrectionModeAction.java 8 Mar 2010 20:33:17 -0000 1.2 --- CorrectionModeAction.java 28 Mar 2010 17:05:56 -0000 1.3 *************** *** 44,48 **** if (!(action instanceof CorrectionModeAction)) return false; CorrectionModeAction a = (CorrectionModeAction) action; ! return (a.correctionType == this.correctionType && a.active == this.active); } --- 44,49 ---- if (!(action instanceof CorrectionModeAction)) return false; CorrectionModeAction a = (CorrectionModeAction) action; ! return (a.correctionType.equals(this.correctionType) && ! a.isActive() == this.isActive()); } Index: CorrectionManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CorrectionManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CorrectionManager.java 8 Mar 2010 20:33:21 -0000 1.2 --- CorrectionManager.java 28 Mar 2010 17:05:56 -0000 1.3 *************** *** 1,21 **** 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 boolean isActive(); ! public List<CorrectionAction> createCorrections(); ! public boolean executeCorrection(CorrectionAction action); } --- 1,92 ---- package rails.game.correct; ! import java.util.ArrayList; import java.util.List; ! import org.apache.log4j.Logger; ! import rails.game.DisplayBuffer; ! import rails.game.GameManager; ! import rails.game.ReportBuffer; ! import rails.game.move.StateChange; ! import rails.game.state.BooleanState; ! import rails.util.LocalText; ! ! public abstract class CorrectionManager implements CorrectionManagerI { ! protected GameManager gameManager; ! private CorrectionType correctionType; ! ! private BooleanState active; ! protected static Logger log = ! Logger.getLogger(CorrectionManager.class.getPackage().getName()); ! ! ! protected CorrectionManager(GameManager gm, CorrectionType ct) { ! gameManager = gm; ! correctionType = ct; ! active = new BooleanState(ct.name()); ! } + public CorrectionType getCorrectionType() { + return correctionType; + } + + public boolean isActive(){ + return active.booleanValue(); + } + + public List<CorrectionAction> createCorrections() { + + List<CorrectionAction> actions = new ArrayList<CorrectionAction>(); + actions.add(new CorrectionModeAction(getCorrectionType(), isActive())); + + return actions; + } + + /** calls all executeAction */ + public boolean executeCorrection(CorrectionAction action){ + if (action instanceof CorrectionModeAction) + return execute((CorrectionModeAction) action); + else { + log.debug("This correction action is not registered."); + return false; + } + } + + private boolean execute(CorrectionModeAction action) { + + gameManager.getMoveStack().start(false); + if (!isActive()) { + String text = LocalText.getText("CorrectionModeActivate", + gameManager.getCurrentPlayer().getName(), + LocalText.getText(getCorrectionType().name()) + ); + ReportBuffer.add(text); + DisplayBuffer.add(text); + } + else { + ReportBuffer.add(LocalText.getText("CorrectionModeDeactivate", + gameManager.getCurrentPlayer().getName(), + LocalText.getText(getCorrectionType().name()) + )); + } + new StateChange(active, !isActive()); + + return true; + } + + /* dummy to capture the non-supported actions */ + protected boolean execute(CorrectionAction action) { + log.debug("The chosen action is not implemented in the registered manager"); + return false; + } + + + public boolean equals(CorrectionManager cm) { + return (this.gameManager == cm.gameManager + && this.correctionType == cm.correctionType); + } } --- NEW FILE: CorrectionManagerI.java --- package rails.game.correct; import java.util.List; /** * CorrectionManagerI is the interface for the specific CorrectionManagers * Corrections use the (abstract) factory pattern. * @author freystef * */ public interface CorrectionManagerI { public CorrectionType getCorrectionType(); public boolean isActive(); public List<CorrectionAction> createCorrections(); public boolean executeCorrection(CorrectionAction action); } Index: CorrectionType.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CorrectionType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CorrectionType.java 3 Mar 2010 00:44:32 -0000 1.1 --- CorrectionType.java 28 Mar 2010 17:05:56 -0000 1.2 *************** *** 8,20 **** 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); } --- 8,20 ---- public enum CorrectionType { CORRECT_CASH { ! public CorrectionManagerI newCorrectionManager(GameManager gm) ! {return new CashCorrectionManager(gm);} ! }, ! CORRECT_MAP { ! public CorrectionManagerI newCorrectionManager(GameManager gm) ! {return new MapCorrectionManager(gm);} ! } ! ; ! public abstract CorrectionManagerI newCorrectionManager(GameManager gm); } Index: CashCorrectionAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CashCorrectionAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CashCorrectionAction.java 8 Mar 2010 20:33:21 -0000 1.2 --- CashCorrectionAction.java 28 Mar 2010 17:05:56 -0000 1.3 *************** *** 93,102 **** 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); --- 93,102 ---- 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); Index: CashCorrectionManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/CashCorrectionManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CashCorrectionManager.java 23 Mar 2010 18:45:40 -0000 1.4 --- CashCorrectionManager.java 28 Mar 2010 17:05:56 -0000 1.5 *************** *** 3,38 **** import rails.game.*; import rails.game.move.CashMove; - import rails.game.move.StateChange; - import rails.game.state.BooleanState; import rails.util.*; import java.util.*; ! public final class CashCorrectionManager implements CorrectionManager { ! ! private static CashCorrectionManager ccm; ! ! private GameManager gameManager; ! ! private BooleanState active; ! ! private CashCorrectionManager() { ! } ! ! public static CorrectionManager getInstance(GameManager gm) { ! if (ccm == null || ccm.gameManager != gm) { ! ccm = new CashCorrectionManager(); ! ccm.gameManager = gm; ! ccm.active = new BooleanState("CASH_CORRECT", false); ! } ! return ccm; ! } ! public boolean isActive(){ ! return active.booleanValue(); } ! public List<CorrectionAction> createCorrections() { ! List<CorrectionAction> actions = new ArrayList<CorrectionAction>(); if (isActive()) { --- 3,18 ---- import rails.game.*; import rails.game.move.CashMove; import rails.util.*; import java.util.*; ! public final class CashCorrectionManager extends CorrectionManager { ! protected CashCorrectionManager(GameManager gm) { ! super(gm, CorrectionType.CORRECT_CASH); } ! @Override public List<CorrectionAction> createCorrections() { ! List<CorrectionAction> actions = super.createCorrections(); if (isActive()) { *************** *** 48,93 **** } } - actions.add(new CorrectionModeAction(CorrectionType.CORRECT_CASH, isActive())); return actions; } ! public boolean executeCorrection(CorrectionAction action) { boolean result = false; - - if (action instanceof CorrectionModeAction) { - gameManager.getMoveStack().start(false); - if (!isActive()) { - String text = LocalText.getText("CorrectionModeActivate", - gameManager.getCurrentPlayer().getName(), - LocalText.getText("CORRECT_CASH") - ); - ReportBuffer.add(text); - DisplayBuffer.add(text); - } - else { - ReportBuffer.add(LocalText.getText("CorrectionModeDeactivate", - gameManager.getCurrentPlayer().getName(), - LocalText.getText("CORRECT_CASH")) - ); - } - new StateChange(active, !isActive()); - - result = true; - } else if (action instanceof CashCorrectionAction) { - CashCorrectionAction cashAction=(CashCorrectionAction)action; ! CashHolder ch = cashAction.getCashHolder(); ! int amount = cashAction.getAmount(); ! ! String errMsg = null; ! while (true) { ! if (amount == 0 ) { ! errMsg = ! LocalText.getText("CorrectCashZero"); ! break; ! } if ((amount + ch.getCash()) < 0) { errMsg = --- 28,58 ---- } } return actions; } + + @Override + public boolean executeCorrection(CorrectionAction action){ + if (action instanceof CashCorrectionAction) + return execute((CashCorrectionAction) action); + else + return super.executeCorrection(action); + } ! private boolean execute(CashCorrectionAction cashAction) { boolean result = false; ! CashHolder ch = cashAction.getCashHolder(); ! int amount = cashAction.getAmount(); ! String errMsg = null; ! ! while (true) { ! if (amount == 0 ) { ! errMsg = ! LocalText.getText("CorrectCashZero"); ! break; ! } if ((amount + ch.getCash()) < 0) { errMsg = *************** *** 99,135 **** break; } ! break; ! } ! 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(); ! String msg; ! if (amount < 0) { ! // negative amounts: remove cash from cashholder ! new CashMove(ch, bank , -amount); ! ! msg = LocalText.getText("CorrectCashSubstractMoney", ! ch.getName(), ! Bank.format(-amount) ); ! } else { ! // positive amounts: add cash to cashholder ! new CashMove(bank, ch, amount); ! msg = LocalText.getText("CorrectCashAddMoney", ! ch.getName(), ! Bank.format(amount)); ! } ! ReportBuffer.add(msg); ! gameManager.addToNextPlayerMessages(msg, true); ! result = true; } } --- 64,99 ---- break; } ! break; ! } ! 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(); ! String msg; ! if (amount < 0) { ! // negative amounts: remove cash from cashholder ! new CashMove(ch, bank , -amount); ! ! msg = LocalText.getText("CorrectCashSubstractMoney", ! ch.getName(), ! Bank.format(-amount) ); ! } else { ! // positive amounts: add cash to cashholder ! new CashMove(bank, ch, amount); ! msg = LocalText.getText("CorrectCashAddMoney", ! ch.getName(), ! Bank.format(amount)); } + ReportBuffer.add(msg); + gameManager.addToNextPlayerMessages(msg, true); + result = true; } --- NEW FILE: MapCorrectionManager.java --- package rails.game.correct; import java.util.HashMap; import java.util.List; import rails.game.correct.MapCorrectionAction.*; import rails.game.GameManager; import rails.game.MapHex; import rails.game.ReportBuffer; import rails.game.TileI; import rails.game.TileManager; import rails.util.LocalText; public class MapCorrectionManager extends CorrectionManager { public static enum ActionStep { SELECT_HEX,SELECT_TILE,SELECT_ORIENTATION,FINISHED,CANCELLED; } private MapCorrectionAction activeTileAction = null; protected MapCorrectionManager(GameManager gm) { super(gm, CorrectionType.CORRECT_MAP); } @Override public List<CorrectionAction> createCorrections() { List<CorrectionAction> actions = super.createCorrections(); if (isActive()) { if (activeTileAction == null) activeTileAction = new MapCorrectionAction(); actions.add(activeTileAction); } return actions; } @Override public boolean executeCorrection(CorrectionAction action){ if (action instanceof MapCorrectionAction) return execute((MapCorrectionAction) action); else return super.executeCorrection(action); } private boolean execute(MapCorrectionAction action){ MapHex hex = action.getLocation(); TileI chosenTile = action.getChosenTile(); TileManager tmgr = gameManager.getTileManager(); TileI preprintedTile = tmgr.getTile(hex.getPreprintedTileId()); // already finished, thus on reload ActionStep executeStep = action.getStep(); if (executeStep != ActionStep.FINISHED) executeStep = action.moveToNextStep(); switch (executeStep) { case SELECT_TILE: // create list of possible up and downgrades List<TileI> possibleTiles = tmgr.getAllUpgrades(preprintedTile); if (preprintedTile == hex.getCurrentTile()) possibleTiles.remove(hex.getCurrentTile()); // remove preprinted tile if still laid action.setTiles(possibleTiles); break; case SELECT_ORIENTATION: // default orientation for preprinted files if (preprintedTile == chosenTile) action.selectOrientation(hex.getPreprintedTileRotation()); break; case FINISHED: // lays tiles gameManager.getMoveStack().start(false); int orientation = action.getOrientation(); hex.upgrade(chosenTile, orientation, new HashMap<String,Integer>()); String msg = LocalText.getText("CorrectMapLaysTileAt", chosenTile.getExternalId(), hex.getName(), hex.getOrientationName(orientation)); ReportBuffer.add(msg); gameManager.addToNextPlayerMessages(msg, true); activeTileAction = null; break; case CANCELLED: activeTileAction = null; } return true; } } |
From: Erik V. <ev...@us...> - 2010-03-27 18:44:32
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11490/rails/game Modified Files: OperatingRound.java GameManager.java GameManagerI.java Log Message: Prussian formation Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** OperatingRound.java 23 Mar 2010 18:44:44 -0000 1.119 --- OperatingRound.java 27 Mar 2010 18:44:24 -0000 1.120 *************** *** 1586,1590 **** // Check if the phase has changed. ! gameManager.getTrainManager().checkTrainAvailability(train, oldHolder); // Check if any companies must discard trains --- 1586,1591 ---- // Check if the phase has changed. ! TrainManager tm = gameManager.getTrainManager(); ! tm.checkTrainAvailability(train, oldHolder); // Check if any companies must discard trains *************** *** 1593,1596 **** --- 1594,1599 ---- } + if (tm.hasPhaseChanged()) gameManager.newPhaseChecks(this); + return true; } *************** *** 1623,1629 **** --- 1626,1638 ---- } else if (savedAction instanceof RepayLoans) { executeRepayLoans ((RepayLoans) savedAction); + } else if (savedAction == null) { + //nextStep(); } savedAction = null; wasInterrupted.set(true); + + guiHints.setVisibilityHint(GuiDef.Panel.STOCK_MARKET, false); + guiHints.setVisibilityHint(GuiDef.Panel.STATUS, true); + guiHints.setActivePanel(GuiDef.Panel.MAP); } Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** GameManager.java 23 Mar 2010 18:44:55 -0000 1.94 --- GameManager.java 27 Mar 2010 18:44:24 -0000 1.95 *************** *** 652,655 **** --- 652,660 ---- } + /** Stub, can be overridden in subclasses with actual actions */ + public void newPhaseChecks (RoundI round) { + + } + public String getORId () { if (showCompositeORNumber) { Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** GameManagerI.java 14 Mar 2010 13:10:14 -0000 1.29 --- GameManagerI.java 27 Mar 2010 18:44:24 -0000 1.30 *************** *** 32,35 **** --- 32,36 ---- */ public abstract void nextRound(RoundI round); + public void newPhaseChecks (RoundI round); public String getORId (); |
From: Erik V. <ev...@us...> - 2010-03-27 18:44:32
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11490/rails/ui/swing Modified Files: ORPanel.java Log Message: Prussian formation Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ORPanel.java 21 Mar 2010 17:43:50 -0000 1.49 --- ORPanel.java 27 Mar 2010 18:44:24 -0000 1.50 *************** *** 829,833 **** public void finishORCompanyTurn(int orCompIndex) { ! president[orCompIndex].setHighlight(false); button1.setEnabled(false); --- 829,835 ---- public void finishORCompanyTurn(int orCompIndex) { ! for (Field field : president) { ! field.setHighlight(false); ! } button1.setEnabled(false); |