From: Erik V. <ev...@us...> - 2008-12-23 19:50:55
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26324/rails/game Modified Files: Game.java Added Files: GameManagerI.java Log Message: Use new interface GameManagerI Index: Game.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Game.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Game.java 28 Oct 2008 21:01:34 -0000 1.19 --- Game.java 23 Dec 2008 19:50:41 -0000 1.20 *************** *** 23,27 **** /** The component Manager */ protected ComponentManager componentManager; ! protected GameManager gameManager; protected CompanyManagerI companyManager; protected PlayerManager playerManager; --- 23,27 ---- /** The component Manager */ protected ComponentManager componentManager; ! protected GameManagerI gameManager; protected CompanyManagerI companyManager; protected PlayerManager playerManager; *************** *** 114,118 **** } gameManager = ! (GameManager) componentManager.findComponent("GameManager"); if (gameManager == null) { throw new ConfigurationException( --- 114,118 ---- } gameManager = ! (GameManagerI) componentManager.findComponent("GameManager"); if (gameManager == null) { throw new ConfigurationException( --- NEW FILE: GameManagerI.java --- package rails.game; import java.util.List; import rails.common.Defs; import rails.game.action.PossibleAction; import rails.util.Tag; public interface GameManagerI { /** * @see rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element) */ public abstract void configureFromXML(Tag tag) throws ConfigurationException; public abstract void startGame(PlayerManager playerManager, CompanyManagerI companyManager, PhaseManager phaseManager); public abstract CompanyManagerI getCompanyManager(); /** * Should be called by each Round when it finishes. * * @param round The object that represents the finishing round. */ public abstract void nextRound(RoundI round); public abstract String getCompositeORNumber(); public abstract int getSRNumber(); public abstract void startShareSellingRound(OperatingRound or, PublicCompanyI companyNeedingTrain, int cashToRaise); public abstract void startTreasuryShareTradingRound(); /** * The central server-side method that takes a client-side initiated action * and processes it. * * @param action A PossibleAction subclass object sent by the client. * @return TRUE is the action was valid. */ public abstract boolean process(PossibleAction action); public abstract void processOnReload(List<PossibleAction> actions) throws Exception; public abstract void finishShareSellingRound(); public abstract void finishTreasuryShareRound(); public abstract void registerBankruptcy(); /** * To be called by the UI to check if the rails.game is over. * * @return */ public abstract boolean isGameOver(); public abstract void logGameReport(); /** * Create a HTML-formatted rails.game status report. * * @return */ public abstract String getGameReport(); /** * Should be called whenever a Phase changes. The effect on the number of * ORs is delayed until a StockRound finishes. * */ public abstract RoundI getCurrentRound(); /** * @return Returns the currentPlayerIndex. */ public abstract int getCurrentPlayerIndex(); /** * @param currentPlayerIndex The currentPlayerIndex to set. */ public abstract void setCurrentPlayerIndex(int currentPlayerIndex); public abstract void setCurrentPlayer(Player player); /** * Set priority deal to the player after the current player. * */ public abstract void setPriorityPlayer(); public abstract void setPriorityPlayer(Player player); /** * @return Returns the priorityPlayer. */ public abstract Player getPriorityPlayer(); /** * @return Returns the currentPlayer. */ public abstract Player getCurrentPlayer(); /** * @return Returns the players. */ public abstract List<Player> getPlayers(); public abstract int getNumberOfPlayers(); public abstract List<String> getPlayerNames(); public abstract List<PublicCompanyI> getAllPublicCompanies(); public abstract List<PrivateCompanyI> getAllPrivateCompanies(); /** * Return a player by its index in the list, modulo the number of players. * * @param index The player index. * @return A player object. */ public abstract Player getPlayerByIndex(int index); public abstract void setNextPlayer(); /** * @return the StartPacket */ public abstract StartPacket getStartPacket(); /** * @return Current phase */ public abstract PhaseI getCurrentPhase(); public abstract PhaseManager getPhaseManager(); public abstract String getHelp(); public abstract boolean canAnyCompanyHoldShares(); public abstract String getClassName(Defs.ClassName key); public abstract int getStockRoundSequenceRule(); public abstract int getTreasuryShareLimit(); public abstract Object getCommonParameter(Defs.Parm key); } |