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:
@@ -55,7 +55,11 @@ public interface ParlorCodes extends InvocationCodes
|
|||||||
* occupied. */
|
* occupied. */
|
||||||
public static final String TABLE_POSITION_OCCUPIED = "m.table_position_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
|
/** An error code returned when a user requests to creat or join a table but they're already
|
||||||
* they were not sitting at in the first place. */
|
* 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";
|
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)
|
public Table createTable (BodyObject creator, TableConfig tableConfig, GameConfig config)
|
||||||
throws InvocationException
|
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
|
// create a brand spanking new table
|
||||||
Table table;
|
Table table;
|
||||||
try {
|
try {
|
||||||
@@ -182,6 +187,11 @@ public class TableManager
|
|||||||
{
|
{
|
||||||
BodyObject joiner = (BodyObject)caller;
|
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
|
// look the table up
|
||||||
Table table = _tables.get(tableId);
|
Table table = _tables.get(tableId);
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user