From: Stefan F. <ste...@us...> - 2010-03-08 20:34:23
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2993/rails/game Modified Files: GameManager.java Log Message: Improved GUI support for cash corrections and some refactoring of the corrections package. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** GameManager.java 6 Mar 2010 18:28:41 -0000 1.86 --- GameManager.java 8 Mar 2010 20:33:27 -0000 1.87 *************** *** 81,86 **** = new EnumMap<GameDef.Parm, Object>(GameDef.Parm.class); ! protected EnumSet<CorrectionType> activeCorrections ! = EnumSet.noneOf(CorrectionType.class); /** --- 81,86 ---- = new EnumMap<GameDef.Parm, Object>(GameDef.Parm.class); ! // protected EnumSet<CorrectionType> activeCorrections ! // = EnumSet.noneOf(CorrectionType.class); /** *************** *** 817,836 **** // 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()); } } --- 817,843 ---- // If any Correction is active ! for (CorrectionType ct:EnumSet.allOf(CorrectionType.class)) { ! CorrectionManager cm = ct.getManager(this); ! if (cm.isActive()) { ! possibleActions.clear(); ! } ! } + // 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()); } } *************** *** 840,865 **** 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) { --- 847,872 ---- 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) { |