Updates to reflect new BodyObject.location change. We now have a ScenePlace and
ScenedBodyObject goes away. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@372 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -38,11 +38,12 @@ import com.threerings.crowd.chat.client.ChatDirector;
|
||||
import com.threerings.crowd.chat.data.ChatCodes;
|
||||
import com.threerings.crowd.client.LocationAdapter;
|
||||
import com.threerings.crowd.client.LocationDirector;
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.crowd.data.PlaceObject;
|
||||
|
||||
import com.threerings.whirled.client.SceneDirector;
|
||||
import com.threerings.whirled.data.SceneModel;
|
||||
import com.threerings.whirled.data.ScenedBodyObject;
|
||||
import com.threerings.whirled.data.ScenePlace;
|
||||
import com.threerings.whirled.util.WhirledContext;
|
||||
|
||||
import com.threerings.whirled.spot.Log;
|
||||
@@ -130,10 +131,10 @@ public class SpotSceneDirector extends BasicDirector
|
||||
|
||||
// sanity check the server's notion of what scene we're in with our notion of it
|
||||
int sceneId = _scdir.getScene().getId();
|
||||
ScenedBodyObject sbobj = (ScenedBodyObject)_ctx.getClient().getClientObject();
|
||||
if (sceneId != sbobj.getSceneId()) {
|
||||
int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject());
|
||||
if (sceneId != clSceneId) {
|
||||
Log.warning("Client and server differ in opinion of what scene we're in " +
|
||||
"[sSceneId=" + sbobj.getSceneId() + ", cSceneId=" + sceneId + "].");
|
||||
"[sSceneId=" + clSceneId + ", cSceneId=" + sceneId + "].");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
package com.threerings.whirled.spot.data;
|
||||
|
||||
import com.threerings.whirled.data.ScenedBodyObject;
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
/**
|
||||
* Defines some required methods for a {@link ScenedBodyObject} that is to
|
||||
* participate in the Whirled Spot system.
|
||||
* Defines some required methods for a {@link BodyObject} that is to participate in the Whirled
|
||||
* Spot system.
|
||||
*/
|
||||
public interface ClusteredBodyObject extends ScenedBodyObject
|
||||
public interface ClusteredBodyObject
|
||||
{
|
||||
/**
|
||||
* Returns the field name of the cluster oid distributed object field.
|
||||
@@ -35,8 +35,7 @@ public interface ClusteredBodyObject extends ScenedBodyObject
|
||||
public String getClusterField ();
|
||||
|
||||
/**
|
||||
* Returns the oid of the cluster to which this user currently
|
||||
* belongs.
|
||||
* Returns the oid of the cluster to which this user currently belongs.
|
||||
*/
|
||||
public int getClusterOid ();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import com.threerings.crowd.data.BodyObject;
|
||||
import com.threerings.crowd.server.PlaceRegistry;
|
||||
|
||||
import com.threerings.whirled.client.SceneService.SceneMoveListener;
|
||||
import com.threerings.whirled.data.ScenedBodyObject;
|
||||
import com.threerings.whirled.data.ScenePlace;
|
||||
import com.threerings.whirled.server.SceneManager;
|
||||
import com.threerings.whirled.server.SceneRegistry;
|
||||
|
||||
@@ -74,7 +74,8 @@ public class SpotProvider
|
||||
throws InvocationException
|
||||
{
|
||||
// le sanity check
|
||||
int cSceneId = getCallerSceneId(caller);
|
||||
BodyObject body = (BodyObject)caller;
|
||||
int cSceneId = ScenePlace.getSceneId(body);
|
||||
if (cSceneId != sceneId) {
|
||||
Log.info("Ignoring stale traverse portal request [caller=" + caller.who() +
|
||||
", oSceneId=" + sceneId + ", portalId=" + portalId +
|
||||
@@ -84,7 +85,6 @@ public class SpotProvider
|
||||
}
|
||||
|
||||
// obtain the source scene
|
||||
BodyObject body = (BodyObject)caller;
|
||||
SpotSceneManager srcmgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
if (srcmgr == null) {
|
||||
Log.warning("Traverse portal missing source scene " +
|
||||
@@ -124,7 +124,7 @@ public class SpotProvider
|
||||
throws InvocationException
|
||||
{
|
||||
BodyObject source = (BodyObject)caller;
|
||||
int cSceneId = getCallerSceneId(caller);
|
||||
int cSceneId = ScenePlace.getSceneId(source);
|
||||
if (cSceneId != sceneId) {
|
||||
Log.info("Rejecting changeLocation for invalid scene [user=" + source.who() +
|
||||
", insid=" + cSceneId + ", wantsid=" + sceneId + ", loc=" + loc + "].");
|
||||
@@ -153,8 +153,8 @@ public class SpotProvider
|
||||
SpotService.ConfirmListener listener)
|
||||
throws InvocationException
|
||||
{
|
||||
int sceneId = getCallerSceneId(caller);
|
||||
BodyObject source = (BodyObject)caller;
|
||||
int sceneId = ScenePlace.getSceneId(source);
|
||||
|
||||
// look up the scene manager for the specified scene
|
||||
SpotSceneManager smgr = (SpotSceneManager)_screg.getSceneManager(sceneId);
|
||||
@@ -184,7 +184,7 @@ public class SpotProvider
|
||||
if (errmsg != null) {
|
||||
SpeakProvider.sendFeedback(source, MessageManager.GLOBAL_BUNDLE, errmsg);
|
||||
} else {
|
||||
sendClusterChatMessage(getCallerSceneId(caller), source.getOid(),
|
||||
sendClusterChatMessage(ScenePlace.getSceneId(source), source.getOid(),
|
||||
source.getVisibleName(), null, message, mode);
|
||||
}
|
||||
}
|
||||
@@ -221,23 +221,6 @@ public class SpotProvider
|
||||
smgr.handleClusterSpeakRequest(speakerOid, speaker, bundle, message, mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the scene id occupied by the supplied caller.
|
||||
*
|
||||
* @exception InvocationException thrown if the caller does not implement {@link
|
||||
* ScenedBodyObject}.
|
||||
*/
|
||||
protected static int getCallerSceneId (ClientObject caller)
|
||||
throws InvocationException
|
||||
{
|
||||
if (caller instanceof ScenedBodyObject) {
|
||||
return ((ScenedBodyObject)caller).getSceneId();
|
||||
} else {
|
||||
Log.warning("Can't get scene from non-scened caller " + caller.who() + ".");
|
||||
throw new InvocationException(INTERNAL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/** The place registry with which we interoperate. */
|
||||
protected PlaceRegistry _plreg;
|
||||
|
||||
|
||||
@@ -61,23 +61,25 @@ public class SpotSceneManager extends SceneManager
|
||||
*/
|
||||
public static void moveBodyToDefaultPortal (BodyObject body)
|
||||
{
|
||||
SpotSceneManager mgr = (SpotSceneManager)CrowdServer.plreg.getPlaceManager(body.location);
|
||||
if (mgr != null) {
|
||||
SpotScene scene = (SpotScene)mgr.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("No scene in moveBodyToDefaultPortal()? " +
|
||||
"[who=" + body.who() +
|
||||
", where=" + mgr.where() + "].");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Location eloc = scene.getDefaultEntrance().getLocation();
|
||||
mgr.handleChangeLoc(body, eloc);
|
||||
} catch (InvocationException ie) {
|
||||
Log.warning("Could not move user to default portal " +
|
||||
"[where=" + mgr.where() + ", who=" + body.who() +
|
||||
", error=" + ie + "].");
|
||||
}
|
||||
SpotSceneManager mgr = (SpotSceneManager)
|
||||
CrowdServer.plreg.getPlaceManager(body.getPlaceOid());
|
||||
if (mgr == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpotScene scene = (SpotScene)mgr.getScene();
|
||||
if (scene == null) {
|
||||
Log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
|
||||
", where=" + mgr.where() + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Location eloc = scene.getDefaultEntrance().getLocation();
|
||||
mgr.handleChangeLoc(body, eloc);
|
||||
} catch (InvocationException ie) {
|
||||
Log.warning("Could not move user to default portal [where=" + mgr.where() +
|
||||
", who=" + body.who() + ", error=" + ie + "].");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user