The PuzzleService was superfluous. The ParlorService can handle starting

single player games and indeed should because it's useful outside the
context of puzzles and their ilk.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3359 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-02-19 22:38:06 +00:00
parent 4036d12121
commit 41fb0b1b80
11 changed files with 81 additions and 296 deletions
@@ -100,6 +100,13 @@ public class ParlorDispatcher extends InvocationDispatcher
);
return;
case ParlorMarshaller.START_SOLITAIRE:
((ParlorProvider)provider).startSolitaire(
source,
(GameConfig)args[0], (InvocationService.ConfirmListener)args[1]
);
return;
default:
super.dispatchRequest(source, methodId, args);
}
@@ -23,6 +23,7 @@ package com.threerings.parlor.server;
import com.threerings.util.Name;
import com.threerings.presents.client.InvocationService;
import com.threerings.presents.client.InvocationService.InvocationListener;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.server.InvocationException;
@@ -37,6 +38,7 @@ import com.threerings.parlor.client.ParlorService.InviteListener;
import com.threerings.parlor.client.ParlorService.TableListener;
import com.threerings.parlor.data.ParlorCodes;
import com.threerings.parlor.game.GameConfig;
import com.threerings.parlor.game.GameManager;
/**
* The parlor provider handles the server side of the various Parlor
@@ -160,6 +162,40 @@ public class ParlorProvider
// themselves removed from the table they just left
}
/**
* Handles a {@link ParlorService#startSolitaire} request.
*/
public void startSolitaire (ClientObject caller, GameConfig config,
InvocationService.ConfirmListener listener)
throws InvocationException
{
BodyObject user = (BodyObject)caller;
Log.debug("Processing start puzzle [caller=" + user.who() +
", config=" + config + "].");
try {
// just this fellow will be playing
config.players = new Name[] { user.username };
// create the game manager and begin its initialization
// process
GameManager gmgr = (GameManager)
CrowdServer.plreg.createPlace(config, null);
// 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
listener.requestProcessed();
} catch (InstantiationException ie) {
Log.warning("Error instantiating game manager " +
"[for=" + caller.who() + ", config=" + config + "].");
Log.logStackTrace(ie);
throw new InvocationException(INTERNAL_ERROR);
}
}
/**
* Looks up the place manager associated with the supplied lobby oid,
* casts it to a table lobby manager and obtains the associated table