From: Stefan F. <ste...@us...> - 2010-03-14 13:10:25
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv27643/rails/game Modified Files: GameManagerI.java GameManager.java ShareSellingRound.java Log Message: Updated EndOfGame Handling (undo possible, ranking display step by step, updated forced share selling message display, LocalText) Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** GameManager.java 14 Mar 2010 08:06:41 -0000 1.91 --- GameManager.java 14 Mar 2010 13:10:15 -0000 1.92 *************** *** 104,107 **** --- 104,108 ---- protected BooleanState gameOver = new BooleanState("GameOver" ,false); + protected Boolean gameOverReportedUI = false; protected BooleanState endedByBankruptcy = new BooleanState("EndedByBankruptcy", false); *************** *** 793,797 **** } ! setCorrectionActions(); // Add the Undo/Redo possibleActions here. --- 794,798 ---- } ! if (!isGameOver()) setCorrectionActions(); // Add the Undo/Redo possibleActions here. *************** *** 902,906 **** getCurrentRound().process(new NullAction (NullAction.DONE)); getCurrentRound().setPossibleActions(); ! setCorrectionActions(); } --- 903,907 ---- getCurrentRound().process(new NullAction (NullAction.DONE)); getCurrentRound().setPossibleActions(); ! if (!isGameOver()) setCorrectionActions(); } *************** *** 917,921 **** } getCurrentRound().setPossibleActions(); ! setCorrectionActions(); } catch (Exception e) { --- 918,922 ---- } getCurrentRound().setPossibleActions(); ! if (!isGameOver()) setCorrectionActions(); } catch (Exception e) { *************** *** 1013,1020 **** private void finishGame() { gameOver.set(true); - ReportBuffer.add(LocalText.getText("GameOver")); - createRound(EndOfGameRound.class); ! logGameReport(); } --- 1014,1032 ---- private void finishGame() { gameOver.set(true); ! String message = LocalText.getText("GameOver"); ! ReportBuffer.add(message); ! DisplayBuffer.add(message); ! ! List<String> gameReport = getGameReport(); ! StringBuilder report = new StringBuilder(); ! for (String s:gameReport) ! report.append(s); ! ReportBuffer.add(report.toString()); ! ! // activate gameReport for UI ! setGameOverReportedUI(false); ! ! createRound(EndOfGameRound.class); } *************** *** 1025,1043 **** return gameOver.booleanValue(); } ! ! /* (non-Javadoc) ! * @see rails.game.GameManagerI#logGameReport() ! */ ! public void logGameReport() { ! ! ReportBuffer.add(getGameReport()); } /* (non-Javadoc) * @see rails.game.GameManagerI#getGameReport() */ ! public String getGameReport() { ! StringBuffer b = new StringBuffer(); /* Sort players by total worth */ --- 1037,1055 ---- return gameOver.booleanValue(); } ! ! public void setGameOverReportedUI(boolean b){ ! gameOverReportedUI = b; } + public boolean getGameOverReportedUI(){ + return(gameOverReportedUI); + } + /* (non-Javadoc) * @see rails.game.GameManagerI#getGameReport() */ ! public List<String> getGameReport() { ! List<String> b = new ArrayList<String>(); /* Sort players by total worth */ *************** *** 1050,1064 **** /* Report winner */ Player winner = rankedPlayers.get(0); ! b.append("The winner is " + winner.getName() + "!"); /* Report final ranking */ - b.append("\n\nThe final ranking is:"); int i = 0; for (Player p : rankedPlayers) { ! b.append("\n" + (++i) + ". " + Bank.format(p.getWorth()) + " " + p.getName()); } ! return b.toString(); } --- 1062,1076 ---- /* Report winner */ Player winner = rankedPlayers.get(0); ! b.add(LocalText.getText("EoGWinner") + winner.getName() ! + "! \n\n"+ LocalText.getText("EoGFinalRanking") + " :"); /* Report final ranking */ int i = 0; for (Player p : rankedPlayers) { ! b.add("\n" + (++i) + ". " + Bank.format(p.getWorth()) + " " + p.getName()); } ! return b; } Index: GameManagerI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManagerI.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** GameManagerI.java 14 Mar 2010 08:06:39 -0000 1.28 --- GameManagerI.java 14 Mar 2010 13:10:14 -0000 1.29 *************** *** 71,75 **** public abstract boolean isGameOver(); ! public abstract void logGameReport(); /** --- 71,77 ---- public abstract boolean isGameOver(); ! public void setGameOverReportedUI(boolean b); ! ! public boolean getGameOverReportedUI(); /** *************** *** 78,82 **** * @return */ ! public abstract String getGameReport(); /** --- 80,84 ---- * @return */ ! public abstract List<String> getGameReport(); /** Index: ShareSellingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/ShareSellingRound.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ShareSellingRound.java 31 Jan 2010 22:22:28 -0000 1.29 --- ShareSellingRound.java 14 Mar 2010 13:10:15 -0000 1.30 *************** *** 75,79 **** if (possibleActions.isEmpty() && cashToRaise.intValue() > 0) { ! DisplayBuffer.add(LocalText.getText("YouAreBankrupt", Bank.format(cashToRaise.intValue()))); --- 75,79 ---- if (possibleActions.isEmpty() && cashToRaise.intValue() > 0) { ! DisplayBuffer.add(LocalText.getText("YouMustRaiseCashButCannot", Bank.format(cashToRaise.intValue()))); |