Change "readObject() as Type" to "Type(readObject())" for vilya for better error checking and faster failure

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@758 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Jamie Doornbos
2008-10-13 17:42:58 +00:00
parent 9cf566de38
commit d2557dfb7f
15 changed files with 23 additions and 23 deletions
@@ -53,7 +53,7 @@ public class PlayerCard
public function readObject (ins :ObjectInputStream) :void public function readObject (ins :ObjectInputStream) :void
{ {
pidx = ins.readInt(); pidx = ins.readInt();
card = (ins.readObject() as Card); card = Card(ins.readObject());
} }
// from interface Streamable // from interface Streamable
@@ -32,7 +32,7 @@ public class ChoiceParameter extends Parameter
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
choices = (ins.readObject() as TypedArray); choices = TypedArray(ins.readObject());
start = (ins.readField(String) as String); start = (ins.readField(String) as String);
} }
+4 -4
View File
@@ -240,10 +240,10 @@ public class Table
tableId = ins.readInt(); tableId = ins.readInt();
lobbyOid = ins.readInt(); lobbyOid = ins.readInt();
gameOid = ins.readInt(); gameOid = ins.readInt();
players = (ins.readObject() as TypedArray); players = TypedArray(ins.readObject());
watchers = (ins.readObject() as TypedArray); watchers = TypedArray(ins.readObject());
config = (ins.readObject() as GameConfig); config = GameConfig(ins.readObject());
tconfig = (ins.readObject() as TableConfig); tconfig = TableConfig(ins.readObject());
} }
// from Streamable // from Streamable
@@ -58,7 +58,7 @@ public class TableConfig extends SimpleStreamableObject
super.readObject(ins); super.readObject(ins);
desiredPlayerCount = ins.readInt(); desiredPlayerCount = ins.readInt();
minimumPlayerCount = ins.readInt(); minimumPlayerCount = ins.readInt();
teamMemberIndices = (ins.readObject() as TypedArray); teamMemberIndices = TypedArray(ins.readObject());
privateTable = ins.readBoolean(); privateTable = ins.readBoolean();
} }
@@ -170,9 +170,9 @@ public /*abstract*/ class GameConfig extends PlaceConfig
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
players = (ins.readObject() as TypedArray); players = TypedArray(ins.readObject());
rated = ins.readBoolean(); rated = ins.readBoolean();
ais = (ins.readObject() as TypedArray); ais = TypedArray(ins.readObject());
} }
// from interface Streamable // from interface Streamable
@@ -427,7 +427,7 @@ public class GameObject extends PlaceObject
state = ins.readInt(); state = ins.readInt();
isRated = ins.readBoolean(); isRated = ins.readBoolean();
isPrivate = ins.readBoolean(); isPrivate = ins.readBoolean();
players = (ins.readObject() as TypedArray); players = TypedArray(ins.readObject());
winners = (ins.readField(TypedArray.getJavaType(Boolean)) as TypedArray); winners = (ins.readField(TypedArray.getJavaType(Boolean)) as TypedArray);
sessionId = ins.readInt(); sessionId = ins.readInt();
playerStatus = (ins.readField(TypedArray.getJavaType(int)) as TypedArray); playerStatus = (ins.readField(TypedArray.getJavaType(int)) as TypedArray);
@@ -102,7 +102,7 @@ public class SceneModel extends SimpleStreamableObject
sceneId = ins.readInt(); sceneId = ins.readInt();
name = (ins.readField(String) as String); name = (ins.readField(String) as String);
version = ins.readInt(); version = ins.readInt();
auxModels = (ins.readObject() as TypedArray); auxModels = TypedArray(ins.readObject());
} }
// documentation inherited from interface Streamable // documentation inherited from interface Streamable
@@ -75,7 +75,7 @@ public class ClusterObject extends DObject
{ {
super.readObject(ins); super.readObject(ins);
occupants = (ins.readObject() as OidList); occupants = OidList(ins.readObject());
} }
} }
} }
@@ -81,8 +81,8 @@ public class ModifyPortalsUpdate extends SceneUpdate
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
portalsRemoved = (ins.readObject() as TypedArray); portalsRemoved = TypedArray(ins.readObject());
portalsAdded = (ins.readObject() as TypedArray); portalsAdded = TypedArray(ins.readObject());
} }
// from interface Streamable // from interface Streamable
@@ -127,7 +127,7 @@ public class Portal extends SimpleStreamableObject
{ {
super.readObject(ins); super.readObject(ins);
portalId = ins.readShort(); portalId = ins.readShort();
loc = (ins.readObject() as Location); loc = Location(ins.readObject());
targetSceneId = ins.readInt(); targetSceneId = ins.readInt();
targetPortalId = ins.readShort(); targetPortalId = ins.readShort();
} }
@@ -75,7 +75,7 @@ public class SceneLocation extends SimpleStreamableObject
{ {
super.readObject(ins); super.readObject(ins);
bodyOid = ins.readInt(); bodyOid = ins.readInt();
loc = (ins.readObject() as Location); loc = Location(ins.readObject());
} }
// documentation inherited from superinterface Streamable // documentation inherited from superinterface Streamable
@@ -102,7 +102,7 @@ public class SpotSceneModel extends SimpleStreamableObject
override public function readObject (ins :ObjectInputStream) :void override public function readObject (ins :ObjectInputStream) :void
{ {
super.readObject(ins); super.readObject(ins);
portals = (ins.readObject() as TypedArray); portals = TypedArray(ins.readObject());
defaultEntranceId = ins.readInt(); defaultEntranceId = ins.readInt();
} }
@@ -158,8 +158,8 @@ public class SpotSceneObject extends SceneObject
{ {
super.readObject(ins); super.readObject(ins);
occupantLocs = (ins.readObject() as DSet); occupantLocs = DSet(ins.readObject());
clusters = (ins.readObject() as DSet); clusters = DSet(ins.readObject());
} }
} }
} }
@@ -66,8 +66,8 @@ public class SceneSummary
{ {
sceneId = ins.readInt(); sceneId = ins.readInt();
name = (ins.readField(String) as String); name = (ins.readField(String) as String);
neighbors = (ins.readObject() as TypedArray); neighbors = TypedArray(ins.readObject());
neighborDirs = (ins.readObject() as TypedArray); neighborDirs = TypedArray(ins.readObject());
} }
// from interface Streamable // from interface Streamable
@@ -62,8 +62,8 @@ public class ZoneSummary extends SimpleStreamableObject
{ {
super.readObject(ins); super.readObject(ins);
zoneId = ins.readInt(); zoneId = ins.readInt();
name = (ins.readObject() as Name); name = Name(ins.readObject());
scenes = (ins.readObject() as TypedArray); scenes = TypedArray(ins.readObject());
} }
// from interface Streamable // from interface Streamable