Added a Cloneable interface, fixed up a few bits.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4148 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-05-25 01:18:04 +00:00
parent 4415b88e60
commit 9b11d03b46
8 changed files with 33 additions and 17 deletions
@@ -325,6 +325,7 @@ public class ChatDirector extends BasicDirector
return result;
}
trace("Chatted: " + record + ", " + hist[0]);
if (record) {
// get the final history-ready command string
hist[0] = "/" + ((hist[0] == null) ? command : hist[0]);
@@ -189,6 +189,7 @@ public class Communicator
*/
protected function socketClosed (event :Event) :void
{
Log.getLog(this).warning("socket was closed: " + event);
_client.notifyObservers(ClientEvent.CLIENT_CONNECTION_FAILED);
shutdown(null);
}
@@ -8,13 +8,13 @@ public class ConfirmMarshaller extends ListenerMarshaller
public static const REQUEST_PROCESSED :int = 1;
// documetnation inherited from interfacc
public function requestProcessed ()
public function requestProcessed () :void
{
// TODO: server only?
}
// documetnation inherited
public function dispatchResponse (methodId :int, args :Array) :void
public override function dispatchResponse (methodId :int, args :Array) :void
{
switch (methodId) {
case REQUEST_PROCESSED:
+10
View File
@@ -0,0 +1,10 @@
package com.threerings.util {
public interface Cloneable
{
/**
* Create a clone of this object.
*/
function clone () :Object;
}
}
@@ -21,17 +21,15 @@
package com.threerings.whirled.data {
import com.threerings.util.Cloneable;
import com.threerings.io.Streamable;
/**
* An interface that must be implemented by auxiliary scene models.
*/
public interface AuxModel extends Streamable /*, Cloneable*/
public interface AuxModel extends Streamable, Cloneable
{
/**
* Creates a clone of this auxiliary model.
*/
function clone () :Object;
//throws CloneNotSupportedException;
// no new methods
}
}
@@ -22,6 +22,7 @@
package com.threerings.whirled.data {
import com.threerings.util.ClassUtil;
import com.threerings.util.Cloneable;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
@@ -38,7 +39,7 @@ import com.threerings.io.TypedArray;
* server to the client.
*/
public class SceneModel
implements Streamable /*, Cloneable */
implements Streamable, Cloneable
{
/** This scene's unique identifier. */
public var sceneId :int;
@@ -64,7 +65,7 @@ public class SceneModel
auxModels.push(auxModel);
}
// documentation inherited
// documentation inherited from interface Cloneable
public function clone () :Object
{
var clazz :Class = ClassUtil.getClass(this);
@@ -23,12 +23,13 @@ package com.threerings.whirled.spot.data {
import com.threerings.io.Streamable;
import com.threerings.util.Cloneable;
import com.threerings.util.Hashable;
/**
* Contains information on a scene occupant's position and orientation.
*/
public interface Location extends Streamable, Hashable
public interface Location extends Cloneable, Streamable, Hashable
{
/**
* Get a new Location instance that is equals() to this one but that
@@ -42,9 +43,10 @@ public interface Location extends Streamable, Hashable
*/
function equivalent (other :Location) :Boolean;
/**
* Locations are cloneable.
*/
function clone () :Object;
/** Two locations are equals by coordinates only. */
//function equals (other :Object) :Boolean;
/** The hashcode should be based on coordinates only. */
//function hashCode () :int;
}
}
@@ -21,6 +21,9 @@
package com.threerings.whirled.spot.data {
import com.threerings.util.Byte;
import com.threerings.util.Integer;
import com.threerings.presents.client.Client;
import com.threerings.presents.client.InvocationService;
import com.threerings.presents.client.ConfirmListener;
@@ -29,7 +32,7 @@ import com.threerings.presents.data.ConfirmMarshaller;
import com.threerings.presents.dobj.InvocationResponseEvent;
import com.threerings.whirled.client.SceneService;
import com.threerings.whirled.client.SceneService_SceneMoveListener;
import com.threerings.whirled.data.SceneMarshaller;
import com.threerings.whirled.data.SceneMarshaller_SceneMoveMarshaller;
import com.threerings.whirled.spot.client.SpotService;
import com.threerings.whirled.spot.data.Location;
@@ -73,7 +76,7 @@ public class SpotMarshaller extends InvocationMarshaller
// documentation inherited from interface
public function joinCluster (arg1 :Client, arg2 :int, arg3 :ConfirmListener) :void
{
var listener3 :ConfirmMarshaller listener3 = new ConfirmMarshaller();
var listener3 :ConfirmMarshaller = new ConfirmMarshaller();
listener3.listener = arg3;
sendRequest(arg1, JOIN_CLUSTER, [
new Integer(arg2), listener3