diff --git a/src/as/com/threerings/parlor/client/TableDirector.as b/src/as/com/threerings/parlor/client/TableDirector.as index 2a280a43..e87e8bd7 100644 --- a/src/as/com/threerings/parlor/client/TableDirector.as +++ b/src/as/com/threerings/parlor/client/TableDirector.as @@ -21,6 +21,8 @@ package com.threerings.parlor.client { +import com.threerings.util.ArrayUtil; + import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.Client; import com.threerings.presents.client.ClientEvent; @@ -306,11 +308,8 @@ public class TableDirector extends BasicDirector // look for our username in the occupants array var self :BodyObject = (_pctx.getClient().getClientObject() as BodyObject); - for (var ii :int = 0; ii < table.occupants.length; ii++) { - if (self.getVisibleName().equals(table.occupants[i])) { - _ourTable = table; - break; - } + if (ArrayUtil.contains(table.occupants, self.getVisibleName())) { + _ourTable = table; } // if nothing changed, bail now diff --git a/src/as/com/threerings/parlor/data/Table.as b/src/as/com/threerings/parlor/data/Table.as index 6773a088..308875be 100644 --- a/src/as/com/threerings/parlor/data/Table.as +++ b/src/as/com/threerings/parlor/data/Table.as @@ -129,27 +129,27 @@ public class Table * For a team game, get the team member indices of the compressed * players array returned by getPlayers(). */ - public function getTeamMemberIndices () :Array /* of Array of int */ + public function getTeamMemberIndices () :TypedArray /* of Array of int */ { var teams :Array = tconfig.teamMemberIndices; if (teams == null) { return null; } -// TODO // compress the team indexes down - ArrayIntSet set = new ArrayIntSet(); - int[][] newTeams = new int[teams.length][]; - Name[] players = getPlayers(); - for (int ii=0; ii < teams.length; ii++) { - set.clear(); - for (int jj=0; jj < teams[ii].length; jj++) { - Name occ = occupants[teams[ii][jj]]; + var newTeams :TypedArray = new TypedArray("[[I"); + var players :TypedArray = getPlayers(); + for (var ii :int = 0; ii < teams.length; ii++) { + var subTeams :Array = (teams[ii] as Array); + var newSubTeams :TypedArray = TypedArray.create(int); + for (var jj :int = 0; jj < subTeams.length; jj++) { + var occ :Name = (occupants[(subTeams[jj] as int)] as Name); if (occ != null) { - set.add(ListUtil.indexOf(players, occ)); + newSubTeams.push(ArrayUtil.indexOf(players, occ)); } } - newTeams[ii] = set.toIntArray(); + newSubTeams.sort(null, Array.NUMERIC); + newTeams[ii] = newSubTeams; } return newTeams; diff --git a/src/as/com/threerings/whirled/data/SceneModel.as b/src/as/com/threerings/whirled/data/SceneModel.as index 8a843dfc..8f743d2e 100644 --- a/src/as/com/threerings/whirled/data/SceneModel.as +++ b/src/as/com/threerings/whirled/data/SceneModel.as @@ -54,8 +54,7 @@ public class SceneModel public var version :int; /** Auxiliary scene model information. */ - public var auxModels :TypedArray = - new TypedArray("[Lcom.threerings.whirled.data.AuxModel;"); + public var auxModels :TypedArray = TypedArray.create(AuxModel); /** * Adds the specified auxiliary model to this scene model. diff --git a/src/as/com/threerings/whirled/spot/data/SpotSceneModel.as b/src/as/com/threerings/whirled/spot/data/SpotSceneModel.as index c793e342..8b323507 100644 --- a/src/as/com/threerings/whirled/spot/data/SpotSceneModel.as +++ b/src/as/com/threerings/whirled/spot/data/SpotSceneModel.as @@ -21,6 +21,7 @@ package com.threerings.whirled.spot.data { +import com.threerings.util.ArrayUtil; import com.threerings.util.ClassUtil; import com.threerings.io.Streamable; @@ -41,8 +42,7 @@ public class SpotSceneModel implements Streamable, AuxModel { /** An array containing all portals in this scene. */ - public var portals :TypedArray = - new TypedArray(TypedArray.getJavaType(Portal)); + public var portals :TypedArray = TypedArray.create(Portal); /** The portal id of the default entrance to this scene. If a body * enters the scene without coming from another scene, this is the @@ -62,12 +62,7 @@ public class SpotSceneModel */ public function removePortal (portal :Portal) :void { - for (var ii :int = 0; ii < portals.length; ii++) { - if (portal.equals(portals[ii])) { - portals.splice(ii, 1); - return; - } - } + ArrayUtil.removeFirst(portals, portal); } // documentation inherited from superinterface Cloneable