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
This commit is contained in:
Michael Bayne
2007-03-06 02:20:12 +00:00
parent 384cc76cfe
commit 0af2789c7b
@@ -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.