diff --git a/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java b/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java index bbfeaa2d7..f9846ecaa 100644 --- a/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java +++ b/src/java/com/threerings/micasa/simulator/server/SimulatorManager.java @@ -1,5 +1,5 @@ // -// $Id: SimulatorManager.java,v 1.12 2002/08/14 19:07:51 mdb Exp $ +// $Id: SimulatorManager.java,v 1.13 2002/10/06 00:53:15 mdb Exp $ package com.threerings.micasa.simulator.server; @@ -90,19 +90,18 @@ public class SimulatorManager // been started up (which is done by the place registry // once the game object creation has completed) + // configure the game config with the player names + config.players = new String[_playerCount]; + config.players[0] = _source.username; + for (int ii = 1; ii < _playerCount; ii++) { + config.players[ii] = "simulant" + ii; + } + // we needn't hang around and wait for game object // creation if it's just us CreationObserver obs = (_playerCount == 1) ? null : this; _gmgr = (GameManager)_plreg.createPlace(config, obs); - // give the game manager the player names - String[] names = new String[_playerCount]; - names[0] = _source.username; - for (int ii = 1; ii < _playerCount; ii++) { - names[ii] = "simulant" + ii; - } - _gmgr.setPlayers(names); - for (int ii = 1; ii < _playerCount; ii++) { // mark all simulants as AI players _gmgr.setAI(ii, skill); diff --git a/src/java/com/threerings/parlor/game/GameConfig.java b/src/java/com/threerings/parlor/game/GameConfig.java index 8ed41911b..5fe60c0b4 100644 --- a/src/java/com/threerings/parlor/game/GameConfig.java +++ b/src/java/com/threerings/parlor/game/GameConfig.java @@ -1,5 +1,5 @@ // -// $Id: GameConfig.java,v 1.12 2002/09/06 22:52:27 shaper Exp $ +// $Id: GameConfig.java,v 1.13 2002/10/06 00:53:15 mdb Exp $ package com.threerings.parlor.game; @@ -25,6 +25,10 @@ import com.threerings.parlor.client.GameConfigurator; */ public abstract class GameConfig extends PlaceConfig { + /** The usernames of the players involved in this game, or an empty + * array if such information is not needed by this particular game. */ + public String[] players = new String[0]; + /** Indicates whether or not this game is rated. */ public boolean rated = true; diff --git a/src/java/com/threerings/parlor/game/GameManager.java b/src/java/com/threerings/parlor/game/GameManager.java index 371ea80cf..9d3bd3453 100644 --- a/src/java/com/threerings/parlor/game/GameManager.java +++ b/src/java/com/threerings/parlor/game/GameManager.java @@ -1,5 +1,5 @@ // -// $Id: GameManager.java,v 1.45 2002/10/06 00:44:16 mdb Exp $ +// $Id: GameManager.java,v 1.46 2002/10/06 00:53:15 mdb Exp $ package com.threerings.parlor.game; @@ -48,6 +48,12 @@ public class GameManager extends PlaceManager // save off a casted reference to our config _gameconfig = (GameConfig)_config; + + // keep this around for now, we'll need it later + _players = _gameconfig.players; + + // instantiate a player oid array which we'll fill in later + _playerOids = new int[_players.length]; } /** @@ -153,26 +159,6 @@ public class GameManager extends PlaceManager { } - /** - * Provides the game manager with a list of the usernames of all - * players in the game. This happens before startup and before the - * game object has been created. Note that party games may - * subsequently add or remove players via {@link #addPlayer} and - * {@link #removePlayer}, and so should be sure to handle a changing - * player list gracefully. - * - * @param players the usernames of all of the players in this game or - * a zero-length array if the game has no specific set of players. - */ - public void setPlayers (String[] players) - { - // keep this around for now, we'll need it later - _players = players; - - // instantiate a player oid array which we'll fill in later - _playerOids = new int[players.length]; - } - /** * Sets the specified player as an AI with the specified skill. It is * assumed that this will be set soon after the player names for all diff --git a/src/java/com/threerings/parlor/server/ParlorManager.java b/src/java/com/threerings/parlor/server/ParlorManager.java index 58fad26ce..401cbbcaa 100644 --- a/src/java/com/threerings/parlor/server/ParlorManager.java +++ b/src/java/com/threerings/parlor/server/ParlorManager.java @@ -1,5 +1,5 @@ // -// $Id: ParlorManager.java,v 1.19 2002/08/14 19:07:54 mdb Exp $ +// $Id: ParlorManager.java,v 1.20 2002/10/06 00:53:15 mdb Exp $ package com.threerings.parlor.server; @@ -182,6 +182,10 @@ public class ParlorManager try { Log.info("Creating game manager [invite=" + invite + "]."); + // configure the game config with the player info + invite.config.players = new String[] { + invite.invitee.username, invite.inviter.username }; + // create the game manager and begin it's initialization // process. the game manager will take care of notifying the // players that the game has been created once it has been @@ -190,10 +194,6 @@ public class ParlorManager GameManager gmgr = (GameManager) _plreg.createPlace(invite.config, null); - // provide the game manager with the player list - gmgr.setPlayers(new String[] { - invite.invitee.username, invite.inviter.username }); - } catch (Exception e) { Log.warning("Unable to create game manager [invite=" + invite + ", error=" + e + "]."); diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index 5640468a7..d715958ec 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -1,5 +1,5 @@ // -// $Id: TableManager.java,v 1.7 2002/08/14 19:07:54 mdb Exp $ +// $Id: TableManager.java,v 1.8 2002/10/06 00:53:15 mdb Exp $ package com.threerings.parlor.server; @@ -262,6 +262,9 @@ public class TableManager try { Log.info("Creating game manager [config=" + config + "]."); + // configure the game config with the players array + config.players = players; + // create the game manager and begin it's initialization // process. the game manager will take care of notifying the // players that the game has been created once it has been @@ -269,9 +272,6 @@ public class TableManager // game object creation has completed) gmgr = (GameManager)CrowdServer.plreg.createPlace(config, this); - // provide the game manager with some initialization info - gmgr.setPlayers(players); - } catch (Exception e) { Log.warning("Unable to create game manager [config=" + config + ", players=" + StringUtil.toString(players) + "].");