Exploratory widening/vararging.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@811 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -22,8 +22,6 @@
|
|||||||
package com.threerings.whirled.spot.client;
|
package com.threerings.whirled.spot.client;
|
||||||
|
|
||||||
import com.samskivert.util.ResultListener;
|
import com.samskivert.util.ResultListener;
|
||||||
import com.samskivert.util.StringUtil;
|
|
||||||
|
|
||||||
import com.threerings.presents.client.BasicDirector;
|
import com.threerings.presents.client.BasicDirector;
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.client.InvocationService.ConfirmListener;
|
import com.threerings.presents.client.InvocationService.ConfirmListener;
|
||||||
@@ -126,8 +124,7 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
// look up the destination scene and location
|
// look up the destination scene and location
|
||||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||||
if (scene == null) {
|
if (scene == null) {
|
||||||
log.warning("Requested to traverse portal when we have no scene " +
|
log.warning("Requested to traverse portal when we have no scene", "portalId", portalId);
|
||||||
"[portalId=" + portalId + "].");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,22 +132,22 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
int sceneId = _scdir.getScene().getId();
|
int sceneId = _scdir.getScene().getId();
|
||||||
int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject());
|
int clSceneId = ScenePlace.getSceneId((BodyObject)_ctx.getClient().getClientObject());
|
||||||
if (sceneId != clSceneId) {
|
if (sceneId != clSceneId) {
|
||||||
log.warning("Client and server differ in opinion of what scene we're in " +
|
log.warning("Client and server differ in opinion of what scene we're in",
|
||||||
"[sSceneId=" + clSceneId + ", cSceneId=" + sceneId + "].");
|
"sSceneId", clSceneId, "cSceneId", sceneId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the portal they're talking about
|
// find the portal they're talking about
|
||||||
Portal dest = scene.getPortal(portalId);
|
Portal dest = scene.getPortal(portalId);
|
||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
log.warning("Requested to traverse non-existent portal [portalId=" + portalId +
|
log.warning("Requested to traverse non-existent portal",
|
||||||
", portals=" + StringUtil.toString(scene.getPortals()) + "].");
|
"portalId", portalId, "portals", scene.getPortals());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare to move to this scene (sets up pending data)
|
// prepare to move to this scene (sets up pending data)
|
||||||
if (!_scdir.prepareMoveTo(dest.targetSceneId, rl)) {
|
if (!_scdir.prepareMoveTo(dest.targetSceneId, rl)) {
|
||||||
log.info("Portal traversal vetoed by scene director [portalId=" + portalId + "].");
|
log.info("Portal traversal vetoed by scene director", "portalId", portalId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +201,8 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
|
|
||||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||||
if (scene == null) {
|
if (scene == null) {
|
||||||
log.warning("Requested to change locations, but we're not currently in any scene " +
|
log.warning("Requested to change locations, but we're not currently in any scene",
|
||||||
"[loc=" + loc + "].");
|
"loc", loc);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.requestFailed(new Exception("m.cant_get_there"));
|
listener.requestFailed(new Exception("m.cant_get_there"));
|
||||||
}
|
}
|
||||||
@@ -213,7 +210,7 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
}
|
}
|
||||||
|
|
||||||
int sceneId = _scdir.getScene().getId();
|
int sceneId = _scdir.getScene().getId();
|
||||||
log.info("Sending changeLocation request [scid=" + sceneId + ", loc=" + loc + "].");
|
log.info("Sending changeLocation request", "scid", sceneId, "loc", loc);
|
||||||
|
|
||||||
_pendingLoc = (Location)loc.clone();
|
_pendingLoc = (Location)loc.clone();
|
||||||
ConfirmListener clist = new ConfirmListener() {
|
ConfirmListener clist = new ConfirmListener() {
|
||||||
@@ -247,15 +244,15 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
{
|
{
|
||||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||||
if (scene == null) {
|
if (scene == null) {
|
||||||
log.warning("Requested to join cluster, but we're not currently in any scene " +
|
log.warning("Requested to join cluster, but we're not currently in any scene",
|
||||||
"[froid=" + froid + "].");
|
"froid", froid);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.requestFailed(new Exception("m.cant_get_there"));
|
listener.requestFailed(new Exception("m.cant_get_there"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Joining cluster [friend=" + froid + "].");
|
log.info("Joining cluster", "friend", froid);
|
||||||
|
|
||||||
_sservice.joinCluster(_ctx.getClient(), froid, new ConfirmListener() {
|
_sservice.joinCluster(_ctx.getClient(), froid, new ConfirmListener() {
|
||||||
public void requestProcessed () {
|
public void requestProcessed () {
|
||||||
@@ -295,15 +292,15 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
// make sure we're currently in a scene
|
// make sure we're currently in a scene
|
||||||
SpotScene scene = (SpotScene)_scdir.getScene();
|
SpotScene scene = (SpotScene)_scdir.getScene();
|
||||||
if (scene == null) {
|
if (scene == null) {
|
||||||
log.warning("Requested to speak to cluster, but we're not currently in any scene " +
|
log.warning("Requested to speak to cluster, but we're not currently in any scene",
|
||||||
"[message=" + message + "].");
|
"message", message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure we're part of a cluster
|
// make sure we're part of a cluster
|
||||||
if (_self.getClusterOid() <= 0) {
|
if (_self.getClusterOid() <= 0) {
|
||||||
log.info("Ignoring cluster speak as we're not in a cluster " +
|
log.info("Ignoring cluster speak as we're not in a cluster",
|
||||||
"[cloid=" + _self.getClusterOid() + "].");
|
"cloid", _self.getClusterOid());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,8 +332,7 @@ public class SpotSceneDirector extends BasicDirector
|
|||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
public void requestFailed (int oid, ObjectAccessException cause)
|
public void requestFailed (int oid, ObjectAccessException cause)
|
||||||
{
|
{
|
||||||
log.warning("Unable to subscribe to cluster chat object [oid=" + oid +
|
log.warning("Unable to subscribe to cluster chat object", "oid", oid, "cause", cause);
|
||||||
", cause=" + cause + "].");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// documentation inherited from interface
|
||||||
|
|||||||
@@ -24,14 +24,13 @@ package com.threerings.whirled.spot.data;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes available the spot scene information that the server needs to do
|
* Makes available the spot scene information that the server needs to do its business.
|
||||||
* its business.
|
|
||||||
*/
|
*/
|
||||||
public interface SpotScene
|
public interface SpotScene
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns a {@link Portal} object for the portal with the specified
|
* Returns a {@link Portal} object for the portal with the specified id or null if no portal
|
||||||
* id or null if no portal exists with that id.
|
* exists with that id.
|
||||||
*/
|
*/
|
||||||
public Portal getPortal (int portalId);
|
public Portal getPortal (int portalId);
|
||||||
|
|
||||||
@@ -46,24 +45,21 @@ public interface SpotScene
|
|||||||
public Iterator<Portal> getPortals ();
|
public Iterator<Portal> getPortals ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the portal id that should be assigned to the next portal
|
* Returns the portal id that should be assigned to the next portal added to this scene.
|
||||||
* added to this scene.
|
|
||||||
*/
|
*/
|
||||||
public short getNextPortalId ();
|
public short getNextPortalId ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the portal that represents the default entrance to this
|
* Returns the portal that represents the default entrance to this scene. If a body enters the
|
||||||
* scene. If a body enters the scene at logon time rather than
|
* scene at logon time rather than entering from some other scene, this is the portal at which
|
||||||
* entering from some other scene, this is the portal at which they
|
* they would appear.
|
||||||
* would appear.
|
|
||||||
*/
|
*/
|
||||||
public Portal getDefaultEntrance ();
|
public Portal getDefaultEntrance ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a portal to this scene, immediately making the requisite
|
* Adds a portal to this scene, immediately making the requisite modifications to the
|
||||||
* modifications to the underlying scene model. The portal id should
|
* underlying scene model. The portal id should have already been assigned using the value
|
||||||
* have already been assigned using the value obtained from {@link
|
* obtained from {@link #getNextPortalId}.
|
||||||
* #getNextPortalId}.
|
|
||||||
*/
|
*/
|
||||||
public void addPortal (Portal portal);
|
public void addPortal (Portal portal);
|
||||||
|
|
||||||
@@ -73,8 +69,8 @@ public interface SpotScene
|
|||||||
public void removePortal (Portal portal);
|
public void removePortal (Portal portal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default entrance in this scene, immediately making the
|
* Sets the default entrance in this scene, immediately making the requisite modifications to
|
||||||
* requisite modifications to the underlying scene model.
|
* the underlying scene model.
|
||||||
*/
|
*/
|
||||||
public void setDefaultEntrance (Portal portal);
|
public void setDefaultEntrance (Portal portal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ public class SpotSceneImpl
|
|||||||
implements SpotScene
|
implements SpotScene
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Creates an instance that will obtain data from the supplied spot
|
* Creates an instance that will obtain data from the supplied spot scene model.
|
||||||
* scene model.
|
|
||||||
*/
|
*/
|
||||||
public SpotSceneImpl (SpotSceneModel smodel)
|
public SpotSceneImpl (SpotSceneModel smodel)
|
||||||
{
|
{
|
||||||
@@ -46,8 +45,7 @@ public class SpotSceneImpl
|
|||||||
protected void readPortals ()
|
protected void readPortals ()
|
||||||
{
|
{
|
||||||
_portals.clear();
|
_portals.clear();
|
||||||
for (int ii = 0, ll = _smodel.portals.length; ii < ll; ii++) {
|
for (Portal port : _smodel.portals) {
|
||||||
Portal port = _smodel.portals[ii];
|
|
||||||
_portals.put(port.portalId, port);
|
_portals.put(port.portalId, port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,8 +101,7 @@ public class SpotSceneImpl
|
|||||||
public void addPortal (Portal portal)
|
public void addPortal (Portal portal)
|
||||||
{
|
{
|
||||||
if (portal.portalId <= 0) {
|
if (portal.portalId <= 0) {
|
||||||
log.warning("Refusing to add zero-id portal " +
|
log.warning("Refusing to add zero-id portal", "scene", this, "portal", portal);
|
||||||
"[scene=" + this + ", portal=" + portal + "].");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,8 +137,8 @@ public class SpotSceneImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be called if a scene update was received that caused
|
* This should be called if a scene update was received that caused our underlying scene model
|
||||||
* our underlying scene model to change.
|
* to change.
|
||||||
*/
|
*/
|
||||||
public void updateReceived ()
|
public void updateReceived ()
|
||||||
{
|
{
|
||||||
@@ -154,7 +151,7 @@ public class SpotSceneImpl
|
|||||||
/** A mapping from portal id to portal. */
|
/** A mapping from portal id to portal. */
|
||||||
protected HashIntMap<Portal> _portals = new HashIntMap<Portal>();
|
protected HashIntMap<Portal> _portals = new HashIntMap<Portal>();
|
||||||
|
|
||||||
/** We don't allow more than ~32k portals in a scene. Things would
|
/** We don't allow more than ~32k portals in a scene. Things would slow down *way* before we
|
||||||
* slow down *way* before we got there. */
|
* got there. */
|
||||||
protected static final int MAX_PORTAL_ID = Short.MAX_VALUE;
|
protected static final int MAX_PORTAL_ID = Short.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,9 @@ import com.threerings.whirled.data.AuxModel;
|
|||||||
import com.threerings.whirled.data.SceneModel;
|
import com.threerings.whirled.data.SceneModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The spot scene model extends the standard scene model with information
|
* The spot scene model extends the standard scene model with information on portals. Portals are
|
||||||
* on portals. Portals are referenced by an identifier, unique within the
|
* referenced by an identifier, unique within the scene and unchanging, so that portals can stably
|
||||||
* scene and unchanging, so that portals can stably reference the target
|
* reference the target portal in the scene to which they connect.
|
||||||
* portal in the scene to which they connect.
|
|
||||||
*/
|
*/
|
||||||
public class SpotSceneModel extends SimpleStreamableObject
|
public class SpotSceneModel extends SimpleStreamableObject
|
||||||
implements AuxModel
|
implements AuxModel
|
||||||
@@ -41,9 +40,8 @@ public class SpotSceneModel extends SimpleStreamableObject
|
|||||||
/** An array containing all portals in this scene. */
|
/** An array containing all portals in this scene. */
|
||||||
public Portal[] portals = new Portal[0];
|
public Portal[] portals = new Portal[0];
|
||||||
|
|
||||||
/** The portal id of the default entrance to this scene. If a body
|
/** The portal id of the default entrance to this scene. If a body enters the scene without
|
||||||
* enters the scene without coming from another scene, this is the
|
* coming from another scene, this is the portal at which they would appear. */
|
||||||
* portal at which they would appear. */
|
|
||||||
public int defaultEntranceId = -1;
|
public int defaultEntranceId = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,16 +77,15 @@ public class SpotSceneModel extends SimpleStreamableObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locates and returns the {@link SpotSceneModel} among the auxiliary
|
* Locates and returns the {@link SpotSceneModel} among the auxiliary scene models associated
|
||||||
* scene models associated with the supplied scene
|
* with the supplied scene model. <code>null</code> is returned if no spot scene model could
|
||||||
* model. <code>null</code> is returned if no spot scene model could
|
|
||||||
* be found.
|
* be found.
|
||||||
*/
|
*/
|
||||||
public static SpotSceneModel getSceneModel (SceneModel model)
|
public static SpotSceneModel getSceneModel (SceneModel model)
|
||||||
{
|
{
|
||||||
for (int ii = 0; ii < model.auxModels.length; ii++) {
|
for (AuxModel auxModel : model.auxModels) {
|
||||||
if (model.auxModels[ii] instanceof SpotSceneModel) {
|
if (auxModel instanceof SpotSceneModel) {
|
||||||
return (SpotSceneModel)model.auxModels[ii];
|
return (SpotSceneModel)auxModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -24,10 +24,9 @@ package com.threerings.whirled.spot.server;
|
|||||||
import com.threerings.whirled.server.WhirledSession;
|
import com.threerings.whirled.server.WhirledSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extends the Whirled client and handles the necessary notifications that
|
* Extends the Whirled client and handles the necessary notifications that take place when a user
|
||||||
* take place when a user logs off to let the clients displaying the scene
|
* logs off to let the clients displaying the scene they were occupying know that they didn't exit
|
||||||
* they were occupying know that they didn't exit via a portal, but
|
* via a portal, but instead just disappeared.
|
||||||
* instead just disappeared.
|
|
||||||
*/
|
*/
|
||||||
public class SpotClient extends WhirledSession
|
public class SpotClient extends WhirledSession
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,8 +147,7 @@ public class SpotSceneManager extends SceneManager
|
|||||||
while (cliter.hasNext()) {
|
while (cliter.hasNext()) {
|
||||||
ClusterRecord clrec = cliter.next();
|
ClusterRecord clrec = cliter.next();
|
||||||
if (clrec.containsKey(bodyOid)) {
|
if (clrec.containsKey(bodyOid)) {
|
||||||
log.info("Pruning departed body from cluster [boid=" + bodyOid +
|
log.info("Pruning departed body from cluster", "boid", bodyOid, "cluster", clrec);
|
||||||
", cluster=" + clrec + "].");
|
|
||||||
clrec.removeBody(bodyOid);
|
clrec.removeBody(bodyOid);
|
||||||
if (clrec.size() == 0) {
|
if (clrec.size() == 0) {
|
||||||
// if we just removed the last body, destroy the cluster, need to use the
|
// if we just removed the last body, destroy the cluster, need to use the
|
||||||
@@ -180,16 +179,15 @@ public class SpotSceneManager extends SceneManager
|
|||||||
if (from != null && from.targetPortalId != -1) {
|
if (from != null && from.targetPortalId != -1) {
|
||||||
entry = _sscene.getPortal(from.targetPortalId);
|
entry = _sscene.getPortal(from.targetPortalId);
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
log.warning("Body mapped at invalid portal [where=" + where() +
|
log.warning("Body mapped at invalid portal",
|
||||||
", who=" + body.who() + ", from=" + from + "].");
|
"where", where(), "who", body.who(), "from", from);
|
||||||
entry = _sscene.getDefaultEntrance();
|
entry = _sscene.getDefaultEntrance();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
entry = _sscene.getDefaultEntrance();
|
entry = _sscene.getDefaultEntrance();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.debug("Positioning entering body [who=" + body.who() +
|
// log.debug("Positioning entering body", "who", body.who(), "where", entry.getOppLocation());
|
||||||
// ", where=" + entry.getOppLocation() + "].");
|
|
||||||
|
|
||||||
// create a scene location for them located on the entrance portal but facing the opposite
|
// create a scene location for them located on the entrance portal but facing the opposite
|
||||||
// direction
|
// direction
|
||||||
@@ -216,8 +214,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
{
|
{
|
||||||
SpotScene scene = (SpotScene)getScene();
|
SpotScene scene = (SpotScene)getScene();
|
||||||
if (scene == null) {
|
if (scene == null) {
|
||||||
log.warning("No scene in moveBodyToDefaultPortal()? [who=" + body.who() +
|
log.warning("No scene in moveBodyToDefaultPortal()?",
|
||||||
", where=" + where() + "].");
|
"who", body.who(), "where", where());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,8 +223,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
Location eloc = scene.getDefaultEntrance().getLocation();
|
Location eloc = scene.getDefaultEntrance().getLocation();
|
||||||
handleChangeLoc(body, eloc);
|
handleChangeLoc(body, eloc);
|
||||||
} catch (InvocationException ie) {
|
} catch (InvocationException ie) {
|
||||||
log.warning("Could not move user to default portal [where=" + where() +
|
log.warning("Could not move user to default portal",
|
||||||
", who=" + body.who() + ", error=" + ie + "].");
|
"where", where(), "who", body.who(), "error", ie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,8 +243,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
{
|
{
|
||||||
// make sure they are in our scene
|
// make sure they are in our scene
|
||||||
if (!_ssobj.occupants.contains(source.getOid())) {
|
if (!_ssobj.occupants.contains(source.getOid())) {
|
||||||
log.warning("Refusing change loc from non-scene occupant [where=" + where() +
|
log.warning("Refusing change loc from non-scene occupant",
|
||||||
", who=" + source.who() + ", loc=" + loc + "].");
|
"where", where(), "who", source.who(), "loc", loc);
|
||||||
throw new InvocationException(INTERNAL_ERROR);
|
throw new InvocationException(INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,8 +279,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
SceneLocation sloc = new SceneLocation(loc, source.getOid());
|
SceneLocation sloc = new SceneLocation(loc, source.getOid());
|
||||||
if (!_ssobj.occupantLocs.contains(sloc)) {
|
if (!_ssobj.occupantLocs.contains(sloc)) {
|
||||||
// complain if they don't already have a location configured
|
// complain if they don't already have a location configured
|
||||||
log.warning("Changing loc for occupant without previous loc [where=" + where() +
|
log.warning("Changing loc for occupant without previous loc",
|
||||||
", who=" + source.who() + ", nloc=" + loc + "].", new Exception());
|
"where", where(), "who", source.who(), "nloc", loc, new Exception());
|
||||||
_ssobj.addToOccupantLocs(sloc);
|
_ssobj.addToOccupantLocs(sloc);
|
||||||
} else {
|
} else {
|
||||||
_ssobj.updateOccupantLocs(sloc);
|
_ssobj.updateOccupantLocs(sloc);
|
||||||
@@ -313,17 +311,17 @@ public class SpotSceneManager extends SceneManager
|
|||||||
// otherwise see if they sent us the user's oid
|
// otherwise see if they sent us the user's oid
|
||||||
DObject tobj = _omgr.getObject(targetOid);
|
DObject tobj = _omgr.getObject(targetOid);
|
||||||
if (!(tobj instanceof BodyObject)) {
|
if (!(tobj instanceof BodyObject)) {
|
||||||
log.info("Can't join cluster, missing target [creator=" + joiner.who() +
|
log.info("Can't join cluster, missing target",
|
||||||
", targetOid=" + targetOid + "].");
|
"creator", joiner.who(), "targetOid", targetOid);
|
||||||
throw new InvocationException(NO_SUCH_CLUSTER);
|
throw new InvocationException(NO_SUCH_CLUSTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure we're in the same scene as said user
|
// make sure we're in the same scene as said user
|
||||||
BodyObject friend = (BodyObject)tobj;
|
BodyObject friend = (BodyObject)tobj;
|
||||||
if (friend.getPlaceOid() != joiner.getPlaceOid()) {
|
if (friend.getPlaceOid() != joiner.getPlaceOid()) {
|
||||||
log.info("Refusing cluster join from non-proximate user [joiner=" + joiner.who() +
|
log.info("Refusing cluster join from non-proximate user",
|
||||||
", jloc=" + joiner.location + ", target=" + friend.who() +
|
"joiner", joiner.who(), "jloc", joiner.location, "target", friend.who(),
|
||||||
", tloc=" + friend.location + "].");
|
"tloc", friend.location);
|
||||||
throw new InvocationException(NO_SUCH_CLUSTER);
|
throw new InvocationException(NO_SUCH_CLUSTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +336,7 @@ public class SpotSceneManager extends SceneManager
|
|||||||
checkCanCluster(joiner, friend);
|
checkCanCluster(joiner, friend);
|
||||||
|
|
||||||
// otherwise we create a new cluster and add our charter members!
|
// otherwise we create a new cluster and add our charter members!
|
||||||
// Log.debug("Creating cluster [starter=" + joiner.who() + ", tgt=" + friend.who() + "].");
|
// log.debug("Creating cluster", "starter", joiner.who(), "tgt", friend.who());
|
||||||
clrec = createClusterRecord();
|
clrec = createClusterRecord();
|
||||||
clrec.addBody(friend);
|
clrec.addBody(friend);
|
||||||
clrec.addBody(joiner);
|
clrec.addBody(joiner);
|
||||||
@@ -395,8 +393,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
* Called by the {@link SpotProvider} when we receive a cluster speak request.
|
* Called by the {@link SpotProvider} when we receive a cluster speak request.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void handleClusterSpeakRequest (int sourceOid, Name source, String bundle,
|
protected void handleClusterSpeakRequest (
|
||||||
String message, byte mode)
|
int sourceOid, Name source, String bundle, String message, byte mode)
|
||||||
{
|
{
|
||||||
handleClusterMessageRequest(sourceOid, new UserMessage(source, bundle, message, mode));
|
handleClusterMessageRequest(sourceOid, new UserMessage(source, bundle, message, mode));
|
||||||
}
|
}
|
||||||
@@ -408,9 +406,9 @@ public class SpotSceneManager extends SceneManager
|
|||||||
{
|
{
|
||||||
ClusterRecord clrec = getCluster(sourceOid);
|
ClusterRecord clrec = getCluster(sourceOid);
|
||||||
if (clrec == null) {
|
if (clrec == null) {
|
||||||
log.warning("Non-clustered user requested cluster speak [where=" + where() +
|
log.warning("Non-clustered user requested cluster speak",
|
||||||
", chatter=" + message.speaker + " (" + sourceOid + "), " +
|
"where", where(), "chatter", (message.speaker + " (" + sourceOid + ")"),
|
||||||
"msg=" + message + "].");
|
"msg", message);
|
||||||
} else {
|
} else {
|
||||||
SpeakUtil.sendMessage(clrec.getClusterObject(), message);
|
SpeakUtil.sendMessage(clrec.getClusterObject(), message);
|
||||||
}
|
}
|
||||||
@@ -473,8 +471,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
throws InvocationException
|
throws InvocationException
|
||||||
{
|
{
|
||||||
if (!(body instanceof ClusteredBodyObject)) {
|
if (!(body instanceof ClusteredBodyObject)) {
|
||||||
log.warning("Refusing to add non-clustered body to cluster [cloid=" +
|
log.warning("Refusing to add non-clustered body to cluster",
|
||||||
_clobj.getOid() + ", size=" + size() + ", who=" + body.who() + "].");
|
"cloid", _clobj.getOid(), "size", size(), "who", body.who());
|
||||||
throw new InvocationException(INTERNAL_ERROR);
|
throw new InvocationException(INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +509,7 @@ public class SpotSceneManager extends SceneManager
|
|||||||
_ssobj.commitTransaction();
|
_ssobj.commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.debug("Added " + body.who() + " to "+ this + ".");
|
// log.debug("Added " + body.who() + " to "+ this + ".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,8 +517,8 @@ public class SpotSceneManager extends SceneManager
|
|||||||
{
|
{
|
||||||
BodyObject body = (BodyObject)remove(bodyOid);
|
BodyObject body = (BodyObject)remove(bodyOid);
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
log.warning("Requested to remove unknown body from cluster [cloid=" +
|
log.warning("Requested to remove unknown body from cluster",
|
||||||
_clobj.getOid() + ", size=" + size() + ", who=" + bodyOid + "].");
|
"cloid", _clobj.getOid(), "size", size(), "who", bodyOid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,7 +545,7 @@ public class SpotSceneManager extends SceneManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.debug("Removed " + bodyOid + " from "+ this + ".");
|
// log.debug("Removed " + bodyOid + " from "+ this + ".");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,7 +567,7 @@ public class SpotSceneManager extends SceneManager
|
|||||||
|
|
||||||
protected void destroy (boolean doRemoval)
|
protected void destroy (boolean doRemoval)
|
||||||
{
|
{
|
||||||
// Log.debug("Cluster empty, going away [cloid=" + _clobj.getOid() + "].");
|
// log.debug("Cluster empty, going away", "cloid", _clobj.getOid());
|
||||||
_ssobj.removeFromClusters(_cluster.getKey());
|
_ssobj.removeFromClusters(_cluster.getKey());
|
||||||
|
|
||||||
// if we've also been requested to remove ourself from the clusters list, do that
|
// if we've also been requested to remove ourself from the clusters list, do that
|
||||||
|
|||||||
Reference in New Issue
Block a user