Allow a joiner to say "any available seat". Also attempt to report errors in
the TableDirector (in Flash) even though none of that is actually wired up in MSOY. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@748 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -48,6 +48,9 @@ import com.threerings.parlor.game.data.GameObject;
|
||||
public class Table
|
||||
implements DSet.Entry, ParlorCodes
|
||||
{
|
||||
/** Used to request any position at a table. */
|
||||
public static final int ANY_POSITION = -1;
|
||||
|
||||
/** The unique identifier for this table. */
|
||||
public int tableId;
|
||||
|
||||
@@ -219,6 +222,22 @@ public class Table
|
||||
@ActionScript(omit=true)
|
||||
public String setPlayer (int position, BodyObject player)
|
||||
{
|
||||
// check whether this player has been banned
|
||||
if (_bannedUsers != null && _bannedUsers.contains(player.getVisibleName())) {
|
||||
return BANNED_FROM_TABLE;
|
||||
}
|
||||
|
||||
// if they just want any position, see if we have one available
|
||||
if (position == ANY_POSITION) {
|
||||
for (int ii = 0; ii < tconfig.desiredPlayerCount; ii++) {
|
||||
if (players[ii] == null) {
|
||||
setPlayerPos(ii, player);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return TABLE_POSITION_OCCUPIED;
|
||||
}
|
||||
|
||||
// make sure the requested position is a valid one
|
||||
if (position >= tconfig.desiredPlayerCount || position < 0) {
|
||||
return INVALID_TABLE_POSITION;
|
||||
@@ -229,10 +248,6 @@ public class Table
|
||||
return TABLE_POSITION_OCCUPIED;
|
||||
}
|
||||
|
||||
if (_bannedUsers != null && _bannedUsers.contains(player.getVisibleName())) {
|
||||
return BANNED_FROM_TABLE;
|
||||
}
|
||||
|
||||
// otherwise all is well, stick 'em in
|
||||
setPlayerPos(position, player);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user