git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@32 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-07-29 01:10:22 +00:00
parent de896d967c
commit ed0c4fd3f4
4 changed files with 19 additions and 26 deletions
@@ -21,6 +21,8 @@
package com.threerings.parlor.client { package com.threerings.parlor.client {
import com.threerings.util.ArrayUtil;
import com.threerings.presents.client.BasicDirector; import com.threerings.presents.client.BasicDirector;
import com.threerings.presents.client.Client; import com.threerings.presents.client.Client;
import com.threerings.presents.client.ClientEvent; import com.threerings.presents.client.ClientEvent;
@@ -306,11 +308,8 @@ public class TableDirector extends BasicDirector
// look for our username in the occupants array // look for our username in the occupants array
var self :BodyObject = var self :BodyObject =
(_pctx.getClient().getClientObject() as BodyObject); (_pctx.getClient().getClientObject() as BodyObject);
for (var ii :int = 0; ii < table.occupants.length; ii++) { if (ArrayUtil.contains(table.occupants, self.getVisibleName())) {
if (self.getVisibleName().equals(table.occupants[i])) { _ourTable = table;
_ourTable = table;
break;
}
} }
// if nothing changed, bail now // if nothing changed, bail now
+11 -11
View File
@@ -129,27 +129,27 @@ public class Table
* For a team game, get the team member indices of the compressed * For a team game, get the team member indices of the compressed
* players array returned by getPlayers(). * 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; var teams :Array = tconfig.teamMemberIndices;
if (teams == null) { if (teams == null) {
return null; return null;
} }
// TODO
// compress the team indexes down // compress the team indexes down
ArrayIntSet set = new ArrayIntSet(); var newTeams :TypedArray = new TypedArray("[[I");
int[][] newTeams = new int[teams.length][]; var players :TypedArray = getPlayers();
Name[] players = getPlayers(); for (var ii :int = 0; ii < teams.length; ii++) {
for (int ii=0; ii < teams.length; ii++) { var subTeams :Array = (teams[ii] as Array);
set.clear(); var newSubTeams :TypedArray = TypedArray.create(int);
for (int jj=0; jj < teams[ii].length; jj++) { for (var jj :int = 0; jj < subTeams.length; jj++) {
Name occ = occupants[teams[ii][jj]]; var occ :Name = (occupants[(subTeams[jj] as int)] as Name);
if (occ != null) { 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; return newTeams;
@@ -54,8 +54,7 @@ public class SceneModel
public var version :int; public var version :int;
/** Auxiliary scene model information. */ /** Auxiliary scene model information. */
public var auxModels :TypedArray = public var auxModels :TypedArray = TypedArray.create(AuxModel);
new TypedArray("[Lcom.threerings.whirled.data.AuxModel;");
/** /**
* Adds the specified auxiliary model to this scene model. * Adds the specified auxiliary model to this scene model.
@@ -21,6 +21,7 @@
package com.threerings.whirled.spot.data { package com.threerings.whirled.spot.data {
import com.threerings.util.ArrayUtil;
import com.threerings.util.ClassUtil; import com.threerings.util.ClassUtil;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
@@ -41,8 +42,7 @@ public class SpotSceneModel
implements Streamable, AuxModel implements Streamable, AuxModel
{ {
/** An array containing all portals in this scene. */ /** An array containing all portals in this scene. */
public var portals :TypedArray = public var portals :TypedArray = TypedArray.create(Portal);
new TypedArray(TypedArray.getJavaType(Portal));
/** The portal id of the default entrance to this scene. If a body /** The portal id of the default entrance to this scene. If a body
* enters the scene without coming from another scene, this is the * enters the scene without coming from another scene, this is the
@@ -62,12 +62,7 @@ public class SpotSceneModel
*/ */
public function removePortal (portal :Portal) :void public function removePortal (portal :Portal) :void
{ {
for (var ii :int = 0; ii < portals.length; ii++) { ArrayUtil.removeFirst(portals, portal);
if (portal.equals(portals[ii])) {
portals.splice(ii, 1);
return;
}
}
} }
// documentation inherited from superinterface Cloneable // documentation inherited from superinterface Cloneable