Checkpoint.
Never in my life have I spent so much time debugging so little. I think the flash player is full of bugs, I've learned to just run everything two or three times and chase the error that happens the most. Fun! git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3929 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -2,6 +2,9 @@ package com.threerings.presents.dobj {
|
||||
|
||||
import flash.util.StringBuilder;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
/**
|
||||
* An attribute changed event is dispatched when a single attribute of a
|
||||
* distributed object has changed. It can also be constructed to request
|
||||
@@ -60,7 +63,8 @@ public class AttributeChangedEvent extends NamedEvent
|
||||
* used).
|
||||
*/
|
||||
public function AttributeChangedEvent (
|
||||
targetOid :int, name :String, value :Object, oldValue :Object)
|
||||
targetOid :int = 0, name :String = null, value :Object = null,
|
||||
oldValue :Object = null)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_value = value;
|
||||
@@ -83,6 +87,18 @@ public class AttributeChangedEvent extends NamedEvent
|
||||
buf.append(", value=", _value);
|
||||
}
|
||||
|
||||
public override function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
out.writeObject(_value);
|
||||
}
|
||||
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_value = ins.readObject();
|
||||
}
|
||||
|
||||
protected var _value :Object;
|
||||
protected var _oldValue :Object = UNSET_OLD_ENTRY;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public /* abstract */ class DEvent
|
||||
public function DEvent (targetOid :int)
|
||||
{
|
||||
_toid = targetOid;
|
||||
|
||||
//Log.debug("unset old = " + UNSET_OLD_ENTRY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,18 +128,31 @@ public /* abstract */ class DEvent
|
||||
}
|
||||
}
|
||||
|
||||
class DummyEntry implements com.threerings.presents.dobj.DSetEntry
|
||||
/*
|
||||
import com.threerings.presents.dobj.DSetEntry;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
class DummyEntry implements DSetEntry
|
||||
{
|
||||
public function DummyEntry ()
|
||||
{
|
||||
}
|
||||
|
||||
public function getKey () :Object
|
||||
{
|
||||
return null;
|
||||
return null; // dummy
|
||||
}
|
||||
|
||||
public function writeObject (out :com.threerings.io.ObjectOutputStream) :void
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
|
||||
public function readObject (ins :com.threerings.io.ObjectInputStream) :void
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -92,7 +92,7 @@ public class DObject // extends EventDispatcher
|
||||
event.friendNotifyListener(listener);
|
||||
|
||||
if (listener is EventListener) {
|
||||
listener.eventReceived(event);
|
||||
(listener as EventListener).eventReceived(event);
|
||||
}
|
||||
} catch (e :Error) {
|
||||
Log.warning("Listener choked during notification " +
|
||||
@@ -117,7 +117,6 @@ public class DObject // extends EventDispatcher
|
||||
Log.warning("Unable to post event, object has no omgr " +
|
||||
"[oid=" + getOid() + ", class=" + ClassUtil.getClassName(this) +
|
||||
", event=" + event + "].");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.threerings.util.Equalable;
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamable;
|
||||
import com.threerings.io.TypedArray;
|
||||
|
||||
import com.threerings.presents.Log;
|
||||
|
||||
@@ -241,7 +242,7 @@ public class DSet
|
||||
return (key as Equalable).equals(otherKey);
|
||||
|
||||
} else {
|
||||
throw new Error("Element key is neither simple or Equalabe");
|
||||
throw new Error("Element key is neither simple or Equalable");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,11 +267,12 @@ public class DSet
|
||||
// documentation inherited from interface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
_entries = (ins.readObject() as Array);
|
||||
_entries = (ins.readObject() as TypedArray);
|
||||
_entries.length = ins.readInt(); // then read the length and limit it
|
||||
}
|
||||
|
||||
/** The entries of the set (in a sparse array). */
|
||||
protected var _entries :Array;
|
||||
protected var _entries :TypedArray =
|
||||
new TypedArray("[Lcom.threerings.presents.dobj.DSet$Entry;");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.threerings.presents.dobj {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
public class DummyEntry
|
||||
implements DSetEntry
|
||||
{
|
||||
public function DummyEntry ()
|
||||
{
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSetEntry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return null; // dummy
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
|
||||
// documentation inherited from superinterface Streamable
|
||||
public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
// dummy
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class EntryUpdatedEvent extends NamedEvent
|
||||
{
|
||||
// only apply the change if we haven't already
|
||||
if (_oldEntry == UNSET_OLD_ENTRY) {
|
||||
var dset :DSet = target[_name];
|
||||
var dset :DSet = (target[_name] as DSet);
|
||||
// fetch the previous value for interested callers
|
||||
_oldEntry = dset.update(_entry);
|
||||
if (_oldEntry == null) {
|
||||
|
||||
Reference in New Issue
Block a user