diff --git a/src/as/com/threerings/parlor/data/ParlorCodes.as b/src/as/com/threerings/parlor/data/ParlorCodes.as index 3dfa62c4..118dda49 100644 --- a/src/as/com/threerings/parlor/data/ParlorCodes.as +++ b/src/as/com/threerings/parlor/data/ParlorCodes.as @@ -40,27 +40,33 @@ public class ParlorCodes extends InvocationCodes /** The response code for a countered invitation. */ public static const INVITATION_COUNTERED :int = 2; - /** An error code explaining that an invitation was rejected because - * the invited user was not online at the time the invitation was - * received. */ + /** An error code explaining that an invitation was rejected because the invited user was not + * online at the time the invitation was received. */ public static const INVITEE_NOT_ONLINE :String = "m.invitee_not_online"; /** An error code returned when a user requests to join a table that * doesn't exist. */ public static const NO_SUCH_TABLE :String = "m.no_such_table"; - /** An error code returned when a user requests to join a table at a - * position that is not valid. */ - public static const INVALID_TABLE_POSITION :String = - "m.invalid_table_position"; + /** An error code returned by the table services. */ + public static const MUST_BE_CREATOR :String = "m.must_be_creator"; - /** An error code returned when a user requests to join a table in a - * position that is already occupied. */ - public static const TABLE_POSITION_OCCUPIED :String = - "m.table_position_occupied"; + /** An error code returned by the table services. */ + public static const NO_SELF_BOOT :String = "m.no_self_boot"; - /** An error code returned when a user requests to leave a table that + /** An error code returned by the table services. */ + public static const TABLE_POSITION_OCCUPIED :String = "m.table_position_occupied"; + + /** An error code returned by the table services when a user requests to create or join a table + * but they're already sitting at another table. */ + public static const ALREADY_AT_TABLE :String = "m.already_at_table"; + + /** An error code returned by the table services when a user requests to leave a table that * they were not sitting at in the first place. */ public static const NOT_AT_TABLE :String = "m.not_at_table"; + + /** An error code returned by the table services for a request to join a table that the + * requester been banned from. */ + public static const BANNED_FROM_TABLE :String = "m.banned_from_table"; } } diff --git a/src/java/com/threerings/parlor/data/ParlorCodes.java b/src/java/com/threerings/parlor/data/ParlorCodes.java index 3caee617..2d7b114b 100644 --- a/src/java/com/threerings/parlor/data/ParlorCodes.java +++ b/src/java/com/threerings/parlor/data/ParlorCodes.java @@ -44,25 +44,27 @@ public interface ParlorCodes extends InvocationCodes * online at the time the invitation was received. */ public static final String INVITEE_NOT_ONLINE = "m.invitee_not_online"; - /** An error code returned when a user requests to join a table that doesn't exist. */ + /** An error code returned by the table services. */ public static final String NO_SUCH_TABLE = "m.no_such_table"; - /** An error code returned when a user requests to join a table at a position that is not - * valid. */ - public static final String INVALID_TABLE_POSITION = "m.invalid_table_position"; + /** An error code returned by the table services. */ + public static final String MUST_BE_CREATOR = "m.must_be_creator"; - /** An error code returned when a user requests to join a table in a position that is already - * occupied. */ + /** An error code returned by the table services. */ + public static final String NO_SELF_BOOT = "m.no_self_boot"; + + /** An error code returned by the table services. */ public static final String TABLE_POSITION_OCCUPIED = "m.table_position_occupied"; - /** An error code returned when a user requests to create or join a table but they're already - * sitting at another table. */ + /** An error code returned by the table services when a user requests to create 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. */ + /** An error code returned by the table services 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"; - /** An error code returned when a user requests to join a table they've been banned from. */ + /** An error code returned by the table services for a request to join a table that the + * requester been banned from. */ public static final String BANNED_FROM_TABLE = "m.banned_from_table"; } diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index 557dc60f..03df94b9 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -278,7 +278,7 @@ public class TableManager if (table == null) { throw new InvocationException(NO_SUCH_TABLE); } else if (starter.getOid() != table.bodyOids[0]) { - throw new InvocationException(INVALID_TABLE_POSITION); + throw new InvocationException(MUST_BE_CREATOR); } else if (!table.mayBeStarted()) { throw new InvocationException(INTERNAL_ERROR); } @@ -302,10 +302,10 @@ public class TableManager int position = ListUtil.indexOf(table.players, target); if (position < 0) { throw new InvocationException(NOT_AT_TABLE); - } else if (booter.getOid() != table.bodyOids[0] || - booter.getOid() == table.bodyOids[position]) { - // Must be head of the table, and can't self-boot - throw new InvocationException(INVALID_TABLE_POSITION); + } else if (booter.getOid() != table.bodyOids[0]) { + throw new InvocationException(MUST_BE_CREATOR); + } else if (booter.getOid() == table.bodyOids[position]) { + throw new InvocationException(NO_SELF_BOOT); } // Remember to keep him banned