Don't let a player create a new table or join an existing table if they're

already sitting at a table. We also enforce this in the UI (though not in
certain cases in MSOY at the moment which is how this was uncovered).


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@577 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2008-03-24 23:00:09 +00:00
parent c0ce0d188b
commit 29460ce450
2 changed files with 16 additions and 2 deletions
@@ -55,7 +55,11 @@ public interface ParlorCodes extends InvocationCodes
* occupied. */
public static final String TABLE_POSITION_OCCUPIED = "m.table_position_occupied";
/** An error code returned when a user requests to leave a table that
* they were not sitting at in the first place. */
/** An error code returned when a user requests to creat or join a table but they're already
* sitting at another table. */
public static final String ALREADY_AT_TABLE = "m.already_at_table";
/** An error code returned when a user requests to leave a table that they were not sitting at
* in the first place. */
public static final String NOT_AT_TABLE = "m.not_at_table";
}
@@ -116,6 +116,11 @@ public class TableManager
public Table createTable (BodyObject creator, TableConfig tableConfig, GameConfig config)
throws InvocationException
{
// make sure the caller is not already in a table
if (_boidMap.containsKey(creator.getOid())) {
throw new InvocationException(ALREADY_AT_TABLE);
}
// create a brand spanking new table
Table table;
try {
@@ -182,6 +187,11 @@ public class TableManager
{
BodyObject joiner = (BodyObject)caller;
// make sure the caller is not already in a table
if (_boidMap.containsKey(joiner.getOid())) {
throw new InvocationException(ALREADY_AT_TABLE);
}
// look the table up
Table table = _tables.get(tableId);
if (table == null) {