diff --git a/src/java/com/threerings/parlor/data/ParlorCodes.java b/src/java/com/threerings/parlor/data/ParlorCodes.java index 477abe2f..e687706b 100644 --- a/src/java/com/threerings/parlor/data/ParlorCodes.java +++ b/src/java/com/threerings/parlor/data/ParlorCodes.java @@ -70,4 +70,8 @@ public interface ParlorCodes extends InvocationCodes /** 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"; + + /** An error code returned by the table services when a user requests to leave a table for + * which the game is already in progress. */ + public static final String GAME_ALREADY_STARTED = "m.game_already_started"; } diff --git a/src/java/com/threerings/parlor/server/TableManager.java b/src/java/com/threerings/parlor/server/TableManager.java index 03df94b9..f4aa2e39 100644 --- a/src/java/com/threerings/parlor/server/TableManager.java +++ b/src/java/com/threerings/parlor/server/TableManager.java @@ -245,6 +245,11 @@ public class TableManager throw new InvocationException(NO_SUCH_TABLE); } + // if the table is in play, the user is not allowed to leave (he must leave the game) + if (table.inPlay()) { + throw new InvocationException(GAME_ALREADY_STARTED); + } + // request that the user be removed from the table if (!table.clearPlayer(leaver.getVisibleName())) { throw new InvocationException(NOT_AT_TABLE);