diff --git a/src/as/com/threerings/crowd/data/OccupantInfo.as b/src/as/com/threerings/crowd/data/OccupantInfo.as index cd9355b83..808610a95 100644 --- a/src/as/com/threerings/crowd/data/OccupantInfo.as +++ b/src/as/com/threerings/crowd/data/OccupantInfo.as @@ -94,7 +94,7 @@ public class OccupantInfo // documentation inherited from superinterface Streamable public function readObject (ins :ObjectInputStream) :void { - bodyOid = (ins.readObject() as Integer); + bodyOid = (ins.readField(Integer) as Integer); username = (ins.readObject() as Name); status = ins.readByte(); } diff --git a/src/as/com/threerings/io/ObjectInputStream.as b/src/as/com/threerings/io/ObjectInputStream.as index a1ad22a5e..70c695440 100644 --- a/src/as/com/threerings/io/ObjectInputStream.as +++ b/src/as/com/threerings/io/ObjectInputStream.as @@ -31,12 +31,14 @@ public class ObjectInputStream public function readObject () :Object //throws IOError { + var DEBUG_ID :String = "[" + (++_tempy) + "] "; try { // read in the class code for this instance var code :int = readShort(); // a zero code indicates a null value if (code == 0) { + Log.debug(DEBUG_ID + "Read null"); return null; } @@ -50,7 +52,7 @@ public class ObjectInputStream // read in the class metadata var cname :String = Translations.getFromServer(readUTF()); - Log.debug("read cname: " + cname); +// Log.debug("read cname: " + cname); var streamer :Streamer = Streamer.getStreamerByJavaName(cname); if (streamer == Streamer.BAD_STREAMER) { Log.warning("OMG, cannot stream " + cname); @@ -60,10 +62,11 @@ public class ObjectInputStream cmap = new ClassMapping(code, cname, streamer); _classMap[code] = cmap; -// Log.debug("Created mapping for (" + code + "): " + cname); + Log.debug(DEBUG_ID + + "Created mapping: (" + code + "): " + cname); } else { - Log.debug("Read known code: " + code); + Log.debug(DEBUG_ID + "Read known code: (" + code + ")"); cmap = (_classMap[code] as ClassMapping); if (null == cmap) { throw new IOError("Read object for which we have no " + @@ -71,7 +74,7 @@ public class ObjectInputStream } } - Log.debug("Creating object sleeve..."); +// Log.debug("Creating object sleeve..."); var target :Object; if (cmap.streamer === null) { var clazz :Class = ClassUtil.getClassByName(cmap.classname); @@ -80,9 +83,9 @@ public class ObjectInputStream } else { target = cmap.streamer.createObject(this); } - Log.debug("Reading object..."); + //Log.debug("Reading object..."); readBareObjectImpl(target, cmap.streamer); - Log.debug("Read object: " + target); + Log.debug(DEBUG_ID + "Read object: " + target); return target; } catch (me :MemoryError) { @@ -229,5 +232,10 @@ public class ObjectInputStream /** A map of short class code to ClassMapping info. */ protected var _classMap :Array = new Array(); + + + + + static var _tempy :int = 0; } } diff --git a/src/as/com/threerings/io/StreamableArray.as b/src/as/com/threerings/io/StreamableArray.as deleted file mode 100644 index 9d7114314..000000000 --- a/src/as/com/threerings/io/StreamableArray.as +++ /dev/null @@ -1,20 +0,0 @@ -package com.threerings.io { - -public dynamic class StreamableArray extends Array - implements Streamable -{ - public function StreamableArray (ctype :Class = undefined, length :int = 0) - { - super(length); - _ctype = ctype; - } - - public function StreamableArray (ctype :Class, ... values) - { - super(values); - _ctype = ctype; - } - - /** The type of all the elements in the array. */ - protected var _ctype :Class; -} diff --git a/src/as/com/threerings/presents/client/InvocationDirector.as b/src/as/com/threerings/presents/client/InvocationDirector.as index a5c0fa10f..12cb2a8d7 100644 --- a/src/as/com/threerings/presents/client/InvocationDirector.as +++ b/src/as/com/threerings/presents/client/InvocationDirector.as @@ -152,12 +152,6 @@ public class InvocationDirector var event :InvocationRequestEvent = new InvocationRequestEvent(invOid, invCode, methodId, args); - // because invocation directors are used on the server, we set the - // source oid here so that invocation requests are properly - // attributed to the right client object when created by - // server-side entities only sort of pretending to be a client - event.setSourceOid(_clobj.getOid()); - // now, dispatch the event _omgr.postEvent(event); } diff --git a/src/as/com/threerings/presents/dobj/DEvent.as b/src/as/com/threerings/presents/dobj/DEvent.as index e68bb61b2..fec01fea4 100644 --- a/src/as/com/threerings/presents/dobj/DEvent.as +++ b/src/as/com/threerings/presents/dobj/DEvent.as @@ -41,28 +41,6 @@ public /* abstract */ class DEvent return false; } - /** - * Returns the object id of the client that generated this event. If - * the event was generated by the server, the value returned will be - * -1. This is not valid on the client, it will return -1 for all - * events there (it is primarily provided to allow for event-level - * access control). - */ - public function getSourceOid () :int - { - return _soid; - } - - /** - * Do not call this method. Sets the source oid of the client that - * generated this event. It is automatically called by the client - * management code when a client forwards an event to the server. - */ - public function setSourceOid (sourceOid :int) :void - { - _soid = sourceOid; - } - /** * We want to make the notifyListener method visible to DObject. */ @@ -120,9 +98,6 @@ public /* abstract */ class DEvent /** The oid of the object that is the target of this event. */ protected var _toid :int; - /** The oid of the client that generated this event. */ - protected var _soid :int = -1; - protected static const UNSET_OLD_ENTRY :DSetEntry = new DummyEntry(); } } diff --git a/src/as/com/threerings/presents/dobj/DObject.as b/src/as/com/threerings/presents/dobj/DObject.as index 15ee47033..67d28ee20 100644 --- a/src/as/com/threerings/presents/dobj/DObject.as +++ b/src/as/com/threerings/presents/dobj/DObject.as @@ -103,6 +103,7 @@ public class DObject // extends EventDispatcher public function postMessage (name :String, args :Array) :void { + trace("posting message: " + name + ", " + args); postEvent(new MessageEvent(_oid, name, args)); } @@ -242,7 +243,7 @@ public class DObject // extends EventDispatcher protected function requestEntryAdd (name :String, entry :DSetEntry) :void { // dispatch an entry added event - postEvent(new EntryAddedEvent(_oid, name, entry, false)); + postEvent(new EntryAddedEvent(_oid, name, entry)); } /** diff --git a/src/as/com/threerings/presents/dobj/EntryAddedEvent.as b/src/as/com/threerings/presents/dobj/EntryAddedEvent.as index d78dab39f..d42696cdc 100644 --- a/src/as/com/threerings/presents/dobj/EntryAddedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryAddedEvent.as @@ -27,7 +27,7 @@ public class EntryAddedEvent extends NamedEvent * @param entry the entry to add to the set attribute. */ public function EntryAddedEvent ( - targetOid :int, name :String, entry :DSetEntry) + targetOid :int = 0, name :String = null, entry :DSetEntry = null) { super(targetOid, name); _entry = entry; diff --git a/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as b/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as index 3986aba2f..129676608 100644 --- a/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryRemovedEvent.as @@ -29,11 +29,14 @@ public class EntryRemovedEvent extends NamedEvent * @param oldEntry the previous value of the entry. */ public function EntryRemovedEvent ( - targetOid :int, name :String, key :Object, oldEntry :DSetEntry) + targetOid :int = 0, name :String = null, key :Object = null, + oldEntry :DSetEntry = null) { super(targetOid, name); _key = key; - _oldEntry = oldEntry; + if (oldEntry != null) { + _oldEntry = oldEntry; + } } /** diff --git a/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as b/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as index d469a4810..678ad4166 100644 --- a/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as +++ b/src/as/com/threerings/presents/dobj/EntryUpdatedEvent.as @@ -28,11 +28,14 @@ public class EntryUpdatedEvent extends NamedEvent * @param oldEntry the previous value of the entry. */ public function EntryUpdatedEvent ( - targetOid :int, name :String, entry :DSetEntry, oldEntry :DSetEntry) + targetOid :int = 0, name :String = null, entry :DSetEntry = null, + oldEntry :DSetEntry = null) { super(targetOid, name); _entry = entry; - _oldEntry = oldEntry; + if (oldEntry != null) { + _oldEntry = oldEntry; + } } /** diff --git a/src/as/com/threerings/presents/dobj/MessageEvent.as b/src/as/com/threerings/presents/dobj/MessageEvent.as index 8a325a749..439cea094 100644 --- a/src/as/com/threerings/presents/dobj/MessageEvent.as +++ b/src/as/com/threerings/presents/dobj/MessageEvent.as @@ -2,6 +2,7 @@ package com.threerings.presents.dobj { import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectOutputStream; +import com.threerings.io.TypedArray; import com.threerings.util.StringBuilder; @@ -26,7 +27,8 @@ public class MessageEvent extends NamedEvent * @param args the arguments for this message. This array should * contain only values of valid distributed object types. */ - public function MessageEvent (targetOid :int, name :String, args :Array) + public function MessageEvent ( + targetOid :int = 0, name :String = null, args :Array = null) { super(targetOid, name); _args = args; @@ -76,6 +78,20 @@ public class MessageEvent extends NamedEvent buf.append(", args=", _args); } + // documentation inherited + public override function writeObject (out :ObjectOutputStream) :void + { + super.writeObject(out); + out.writeField(_args); + } + + // documentation inherited + public override function readObject (ins :ObjectInputStream) :void + { + super.readObject(ins); + _args = (ins.readField(Array) as Array); + } + protected var _args :Array; } } diff --git a/src/as/com/threerings/presents/dobj/OidList.as b/src/as/com/threerings/presents/dobj/OidList.as index 38b6eb605..ea0dce651 100644 --- a/src/as/com/threerings/presents/dobj/OidList.as +++ b/src/as/com/threerings/presents/dobj/OidList.as @@ -109,6 +109,7 @@ public class OidList public function readObject (ins :ObjectInputStream) :void { _oids = (ins.readField("[I") as TypedArray); + _oids.length = ins.readInt(); } public function toString () :String