From 0af2789c7b3373caec64db98d7fb50263be4b1b1 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 6 Mar 2007 02:20:12 +0000 Subject: [PATCH] Extract the GameConfig creation into an overridable method so that TableManager users can do the right thing with regard to adding extra configuration stuff (rather than trusting the client to have done it). git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@227 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../threerings/parlor/server/TableManager.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index 08d68322..59913580 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -318,11 +318,8 @@ public class TableManager protected int createGame (final Table table) throws InvocationException { - // fill the players array into the game config - table.config.players = table.getPlayers(); - try { - PlaceManager pmgr = CrowdServer.plreg.createPlace(table.config); + PlaceManager pmgr = CrowdServer.plreg.createPlace(createConfig(table)); GameObject gobj = (GameObject) pmgr.getPlaceObject(); gameCreated(table, gobj); return gobj.getOid(); @@ -334,6 +331,18 @@ public class TableManager } } + /** + * This method should validate that the (client provided) configuration in the supplied {@link + * Table} object is valid and fill in any extra information that is the purview of the server. + */ + protected GameConfig createConfig (Table table) + { + // fill the players array into the game config + table.config.players = table.getPlayers(); + // we just trust the rest by default, yay! + return table.config; + } + /** * Called when our game has been created, we take this opportunity to clean * up the table and transition it to "in play" mode.