Restructured things to work with the new mechanism for creating distributed

objects.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@53 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2006-08-23 23:48:07 +00:00
parent a993e2ec46
commit eed4d67b9e
9 changed files with 88 additions and 139 deletions
@@ -206,13 +206,10 @@ public class ParlorManager
invite.invitee.getVisibleName(),
invite.inviter.getVisibleName() };
// 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
// started up (which is done by the place registry once the
// game object creation has completed)
GameManager gmgr = (GameManager)
_plreg.createPlace(invite.config, null);
// 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
_plreg.createPlace(invite.config);
} catch (Exception e) {
Log.warning("Unable to create game manager [invite=" + invite +
@@ -181,14 +181,11 @@ public class ParlorProvider
config.players = new Name[] { user.getVisibleName() };
}
// create the game manager and begin its initialization
// process
GameManager gmgr = (GameManager)
CrowdServer.plreg.createPlace(config, null);
// create the game manager and begin its initialization process
CrowdServer.plreg.createPlace(config);
// the game manager will take care of notifying the player
// that the game has been created once it has been started up;
// but we let the caller know that we processed their request
// the game manager will notify the player that their game is
// "ready", but tell the caller that we processed their request
listener.requestProcessed();
} catch (InstantiationException ie) {
@@ -40,7 +40,6 @@ import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.crowd.server.CrowdServer;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.crowd.server.PlaceRegistry;
import com.threerings.parlor.Log;
import com.threerings.parlor.data.ParlorCodes;
@@ -261,14 +260,9 @@ public class TableManager
// fill the players array into the game config
table.config.players = table.getPlayers();
PlaceRegistry.CreationObserver obs =
new PlaceRegistry.CreationObserver() {
public void placeCreated (PlaceObject plobj, PlaceManager pmgr) {
gameCreated(table, plobj);
}
};
try {
CrowdServer.plreg.createPlace(table.config, obs);
PlaceManager pmgr = CrowdServer.plreg.createPlace(table.config);
gameCreated(table, (GameObject)pmgr.getPlaceObject());
} catch (Throwable t) {
Log.warning("Failed to create manager for game " +
"[config=" + table.config + "]: " + t);
@@ -277,16 +271,16 @@ public class TableManager
}
/**
* Called when our game has been created, we take this opportunity to
* clean up the table and transition it to "in play" mode.
* Called when our game has been created, we take this opportunity to clean
* up the table and transition it to "in play" mode.
*/
protected void gameCreated (Table table, PlaceObject plobj)
protected void gameCreated (Table table, GameObject gameobj)
{
// update the table with the newly created game object
table.gameOid = plobj.getOid();
table.gameOid = gameobj.getOid();
// configure the privacy of the game
((GameObject) plobj).setIsPrivate(table.tconfig.privateTable);
gameobj.setIsPrivate(table.tconfig.privateTable);
// clear the occupant to table mappings as this game is underway
for (int i = 0; i < table.bodyOids.length; i++) {
@@ -295,7 +289,7 @@ public class TableManager
// add an object death listener to unmap the table when the game
// finally goes away
plobj.addListener(_gameDeathListener);
gameobj.addListener(_gameDeathListener);
// and then update the lobby object that contains the table
_tlobj.updateTables(table);