From: Stefan F. <ste...@us...> - 2010-05-29 23:33:51
|
Update of /cvsroot/rails/18xx/rails/game/correct In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv13817/rails/game/correct Modified Files: MapCorrectionManager.java MapCorrectionAction.java Log Message: Updated and slightly restricted map correction functionality Index: MapCorrectionAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/MapCorrectionAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MapCorrectionAction.java 29 May 2010 09:38:58 -0000 1.2 --- MapCorrectionAction.java 29 May 2010 23:33:43 -0000 1.3 *************** *** 4,10 **** import java.io.ObjectInputStream; import java.util.ArrayList; - import java.util.HashMap; import java.util.List; - import java.util.Map; import rails.game.correct.MapCorrectionManager.*; --- 4,8 ---- *************** *** 15,19 **** import rails.game.TileI; import rails.game.TileManager; - import rails.game.TokenI; import rails.game.action.PossibleAction; import rails.util.Util; --- 13,16 ---- *************** *** 154,157 **** --- 151,158 ---- } + public void selectConfirmed() { + setNextStep(ActionStep.RELAY_BASETOKENS); + } + public void selectOrientation(int orientation) { setOrientation(orientation); *************** *** 192,204 **** } 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); if (step.ordinal() >= ActionStep.RELAY_BASETOKENS.ordinal()) --- 193,210 ---- } b.append(" Step=" + step); ! ActionStep executedStep; ! if (nextStep != null) { b.append(" NextStep=" + nextStep); + executedStep = nextStep; + } else { + executedStep = step; + } if (step.ordinal() > ActionStep.SELECT_HEX.ordinal()) b.append(" Hex=" + location.getName()); if (step == ActionStep.SELECT_TILE) b.append(" Possible tiles=" + tiles); ! if (executedStep.ordinal() >= ActionStep.SELECT_TILE.ordinal()) b.append(" Chosen tile=" + tiles); ! if (executedStep.ordinal() >= ActionStep.SELECT_ORIENTATION.ordinal()) b.append(" Orientation=" + orientation); if (step.ordinal() >= ActionStep.RELAY_BASETOKENS.ordinal()) *************** *** 206,210 **** if (step.ordinal() == ActionStep.RELAY_BASETOKENS.ordinal()) b.append(" Possible Stations=" + possibleStations); ! if (step.ordinal() > ActionStep.RELAY_BASETOKENS.ordinal()) b.append(" Selected stations for relay=" + stationsForRelay); return b.toString(); --- 212,216 ---- if (step.ordinal() == ActionStep.RELAY_BASETOKENS.ordinal()) b.append(" Possible Stations=" + possibleStations); ! if (executedStep.ordinal() >= ActionStep.RELAY_BASETOKENS.ordinal()) b.append(" Selected stations for relay=" + stationsForRelay); return b.toString(); Index: MapCorrectionManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/correct/MapCorrectionManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MapCorrectionManager.java 29 May 2010 09:38:58 -0000 1.2 --- MapCorrectionManager.java 29 May 2010 23:33:43 -0000 1.3 *************** *** 4,8 **** import java.util.HashMap; import java.util.List; - import java.util.Map; import rails.game.BaseToken; --- 4,7 ---- *************** *** 21,25 **** public static enum ActionStep { ! SELECT_HEX,SELECT_TILE,SELECT_ORIENTATION,RELAY_BASETOKENS,FINISHED,CANCELLED; } --- 20,24 ---- public static enum ActionStep { ! SELECT_HEX,SELECT_TILE,SELECT_ORIENTATION,CONFIRM,RELAY_BASETOKENS,FINISHED,CANCELLED; } *************** *** 56,59 **** --- 55,62 ---- // already finished, thus on reload action.setNextStep(ActionStep.FINISHED); + } else if (action.getNextStep() == ActionStep.CANCELLED) { + // cancelled => set to null and return + activeTileAction = null; + return true; } *************** *** 73,77 **** LocalText.getText("TileNotAvailable", chosenTile.getExternalId()); ! // return to step of hex selection action.selectHex(hex); break; --- 76,80 ---- LocalText.getText("TileNotAvailable", chosenTile.getExternalId()); ! // return to step of tile selection action.selectHex(hex); break; *************** *** 90,94 **** errMsg = LocalText.getText("CorrectMapNotEnoughSlots", chosenTile.getExternalId()); ! // return to step of hex selection action.selectHex(hex); break; --- 93,109 ---- errMsg = LocalText.getText("CorrectMapNotEnoughSlots", chosenTile.getExternalId()); ! // return to step of tile selection ! action.selectHex(hex); ! break; ! } ! // check if chosenTile requires relays ! // this is not implemented yet, thus error message ! if (chosenTile.getNumStations() >= 2 ! && hex.getCurrentTile().getColourNumber() >= chosenTile.getColourNumber() ! // B. or the current tile requires relays ! || hex.getCurrentTile().relayBaseTokensOnUpgrade()) { ! errMsg = ! LocalText.getText("CorrectMapRequiresRelays", chosenTile.getExternalId()); ! // return to step of tile selection action.selectHex(hex); break; *************** *** 104,109 **** errMsg )); ; - // stay at the same step - action.setNextStep(action.getStep()); } --- 119,122 ---- *************** *** 128,135 **** if (preprintedTile == chosenTile) { action.selectOrientation(hex.getPreprintedTileRotation()); ! return execute(action); } else if (chosenTile.getFixedOrientation() != -1) { action.selectOrientation(chosenTile.getFixedOrientation()); ! return execute(action); } else { break; --- 141,150 ---- if (preprintedTile == chosenTile) { action.selectOrientation(hex.getPreprintedTileRotation()); ! action.setNextStep(ActionStep.CONFIRM); ! break; } else if (chosenTile.getFixedOrientation() != -1) { action.selectOrientation(chosenTile.getFixedOrientation()); ! action.setNextStep(ActionStep.CONFIRM); ! break; } else { break; *************** *** 161,167 **** } case FINISHED: - // lays tiles gameManager.getMoveStack().start(false); int orientation = action.getOrientation(); hex.upgrade(chosenTile, orientation, new HashMap<String,Integer>()); --- 176,182 ---- } case FINISHED: gameManager.getMoveStack().start(false); + // lays tile int orientation = action.getOrientation(); hex.upgrade(chosenTile, orientation, new HashMap<String,Integer>()); *************** *** 172,179 **** --- 187,203 ---- gameManager.addToNextPlayerMessages(msg, true); + // relays tokens + // if (action.getTokensToRelay() != null) { + // for (BaseToken token:action.getTokensToRelay()) { + // int i = action.getTokensToRelay().indexOf(token); + // + // } + // } + activeTileAction = null; break; case CANCELLED: + // should be captured above activeTileAction = null; } |