]> git.cworth.org Git - ttt/blobdiff - src/ttt-error.c
2005-12-07 Richard D. Worth <richard@theworths.org>
[ttt] / src / ttt-error.c
index 21d30e687bc2b5c49e568b94fde9d9431df8bc4b..5d331afbef46d09c41663deafecd020ba89212c3 100644 (file)
@@ -27,27 +27,44 @@ ttt_error_string (ttt_error_t error)
     switch (error) {
     case TTT_ERROR_NONE:
        return "ERROR NONEi\r\n";
+
+    /* 3.1. Connection setup errors */
     case TTT_ERROR_NO_NAME_SET:
-       return "ERROR NONAMESET\r\n";
+       return "ERROR NO_NAME_SET\r\n";
     case TTT_ERROR_INVALID_NAME:
-       return "ERROR INVALIDNAME\r\n";
+       return "ERROR INVALID_NAME\r\n";
+
+    /* 3.2. Command format errors */
     case TTT_ERROR_COMMAND:
        return "ERROR COMMAND\r\n";
     case TTT_ERROR_SYNTAX:
        return "ERROR SYNTAX\r\n";
     case TTT_ERROR_NOT_NUMBER:
-       return "ERROR NOTNUMBER\r\n";
+       return "ERROR NOT_NUMBER\r\n";
     case TTT_ERROR_NOT_GRID:
-       return "ERROR NOTGRID\r\n";
+       return "ERROR NOT_GRID\r\n";
+
+    /* 3.3. Global command errors */
+
+    /* 3.4. Game management errors */
+    case TTT_ERROR_NO_INVITE:
+       return "ERROR NO_INVITE\r\n";
+    case TTT_ERROR_NO_GAME:
+       return "ERROR NO_GAME\r\n";
+
+    /* 3.5. User information errors */
     case TTT_ERROR_NO_USER:
-       return "ERROR NOUSER\r\n";
-    case TTT_ERROR_NOT_IN_GAME:
-       return "ERROR_NOTINGAME\r\n";
+       return "ERROR NO_USER\r\n";
+
+    /* 3.6. In-game errors */
     case TTT_ERROR_NOT_PLAYING:
-       return "ERROR_NOTPLAYING\r\n";
+       return "ERROR_NOT_PLAYING\r\n";
     case TTT_ERROR_NOT_YOUR_TURN:
-       return "ERROR NOTYOURTURN\r\n";
-    /* Not an actual protocol errror, so this should never happen. */
+       return "ERROR NOT_YOUR_TURN\r\n";
+    case TTT_ERROR_NOT_VALID_MOVE:
+       return "ERROR NOT_VALID_MOVE\r\n";
+
+    /* Here's a non-protocol pseudo-error used to implement QUIT. */
     case TTT_ERROR_QUIT_REQUESTED:
        ASSERT_NOT_REACHED;
        break;