At Ray's suggestion, go ahead and throw an error when the wrong type is read. Use the Type(obj) cast syntax (I was unaware that this would actually throw an error). Reading objects of a basic type like Array must still use "readObject(Array) as Array" so this is still supported, though not needed for user types.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5441 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -180,7 +180,7 @@ public class BodyObject extends ClientObject
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
location = (ins.readObject(Place) as Place);
|
||||
location = Place(ins.readObject());
|
||||
status = ins.readByte();
|
||||
awayMessage = (ins.readField(String) as String);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class OccupantInfo extends SimpleStreamableObject
|
||||
{
|
||||
super.readObject(ins);
|
||||
bodyOid = (ins.readField(Integer) as Integer).value;
|
||||
username = (ins.readObject(Name) as Name);
|
||||
username = Name(ins.readObject());
|
||||
status = ins.readByte();
|
||||
}
|
||||
|
||||
|
||||
@@ -206,9 +206,9 @@ public class PlaceObject extends DObject
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
occupants = (ins.readObject(OidList) as OidList);
|
||||
occupantInfo = (ins.readObject(DSet) as DSet);
|
||||
speakService = (ins.readObject(SpeakMarshaller) as SpeakMarshaller);
|
||||
occupants = OidList(ins.readObject());
|
||||
occupantInfo = DSet(ins.readObject());
|
||||
speakService = SpeakMarshaller(ins.readObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user