From: Richard Worth Date: Wed, 7 Dec 2005 12:48:54 +0000 (+0000) Subject: 2005-12-07 Richard D. Worth X-Git-Url: https://git.cworth.org/git?p=ttt;a=commitdiff_plain;h=78c696d4ed9578c3d1ece01b8e4667839ff5fb04;hp=259558bcd2a5734c9e527b68a301347ea8fc5e25 2005-12-07 Richard D. Worth * PROTOCOL: Remove unused error NOT_IN_GAME. Add error NOT_VALID_MOVE. * TODO: Add error NOT_VALID_MOVE. * src/ttt-error.h: * src/ttt-error.c: (ttt_error_string): Add section comments. Add error NOT_VALID_MOVE. --- diff --git a/ChangeLog b/ChangeLog index b3ce3c9..6a8bdf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-12-07 Richard D. Worth + + * PROTOCOL: Remove unused error NOT_IN_GAME. Add error + NOT_VALID_MOVE. + + * TODO: Add error NOT_VALID_MOVE. + + * src/ttt-error.h: + * src/ttt-error.c: (ttt_error_string): Add section comments. Add + error NOT_VALID_MOVE. + 2005-12-06 Bryan Worth * src/ttt-error.c: fixed missing errors (NO_INVITE, NO_GAME) diff --git a/PROTOCOL b/PROTOCOL index d765ba0..91c8545 100644 --- a/PROTOCOL +++ b/PROTOCOL @@ -201,7 +201,7 @@ Document Conventions _|X|_ X|O|O" - Possible errors: NO_NAME_SET, NO_GAME, NOT_IN_GAME + Possible errors: NO_NAME_SET, NO_GAME 1.4.2. Part @@ -213,7 +213,7 @@ Document Conventions Departs the specified game - Possible errors: NO_NAME_SET, NO_GAME, NOT_IN_GAME + Possible errors: NO_NAME_SET, NO_GAME 1.4.3. Making a move @@ -230,8 +230,8 @@ Document Conventions 3|4|5 6|7|8 - Possible errors: NO_NAME_SET, NO_GAME, NOT_IN_GAME, - NOT_PLAYING, NOT_YOUR_MOVE, NOT_GRID + Possible errors: NO_NAME_SET, NO_GAME, NOT_PLAYING, + NOT_YOUR_MOVE, NOT_GRID, NOT_VALID_MOVE 2. Asynchronous notification. @@ -376,7 +376,7 @@ Document Conventions number. Possibly returned by: MOVE - + 3.3. Global command errors. There are no global command errors from any of the global @@ -436,3 +436,11 @@ Document Conventions A move was submitted during the other player's turn. Possibly returned by: MOVE + + 3.6.2.2. Not a valid move + + ERROR NOT_VALID_MOVE + + A move was submitted for a cell that is occupied. + + Possibly returned by: MOVE diff --git a/TODO b/TODO index 25a1dd3..09463f7 100644 --- a/TODO +++ b/TODO @@ -59,4 +59,5 @@ S C 3.6.1.1. ERROR NOT_PLAYING 3.6.2. Moving errors 3.6.2.1. ERROR NOT_YOUR_TURN + 3.6.2.2. ERROR NOT_VALID_MOVE diff --git a/src/ttt-error.c b/src/ttt-error.c index 9022e93..5d331af 100644 --- a/src/ttt-error.c +++ b/src/ttt-error.c @@ -27,10 +27,14 @@ 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 NO_NAME_SET\r\n"; case TTT_ERROR_INVALID_NAME: return "ERROR INVALID_NAME\r\n"; + + /* 3.2. Command format errors */ case TTT_ERROR_COMMAND: return "ERROR COMMAND\r\n"; case TTT_ERROR_SYNTAX: @@ -39,19 +43,28 @@ ttt_error_string (ttt_error_t error) return "ERROR NOT_NUMBER\r\n"; case TTT_ERROR_NOT_GRID: 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 NO_USER\r\n"; - case TTT_ERROR_NOT_IN_GAME: - return "ERROR_NOT_IN_GAME\r\n"; + + /* 3.6. In-game errors */ case TTT_ERROR_NOT_PLAYING: return "ERROR_NOT_PLAYING\r\n"; case TTT_ERROR_NOT_YOUR_TURN: return "ERROR NOT_YOUR_TURN\r\n"; - /* Not an actual protocol errror, so this should never happen. */ + 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; diff --git a/src/ttt-error.h b/src/ttt-error.h index 3fb1dd9..fff3c14 100644 --- a/src/ttt-error.h +++ b/src/ttt-error.h @@ -26,19 +26,24 @@ typedef enum { TTT_ERROR_NONE, + /* 3.1. Connection setup errors */ TTT_ERROR_NO_NAME_SET, TTT_ERROR_INVALID_NAME, + /* 3.2. Command format errors */ TTT_ERROR_COMMAND, TTT_ERROR_SYNTAX, TTT_ERROR_NOT_NUMBER, TTT_ERROR_NOT_GRID, + /* 3.3. Global command errors */ + /* 3.4. Game management errors */ + TTT_ERROR_NO_INVITE, + TTT_ERROR_NO_GAME, + /* 3.5. User information errors */ TTT_ERROR_NO_USER, - TTT_ERROR_NOT_IN_GAME, + /* 3.6. In-game errors */ TTT_ERROR_NOT_PLAYING, TTT_ERROR_NOT_YOUR_TURN, - TTT_ERROR_NO_INVITE, - TTT_ERROR_NO_GAME, - + TTT_ERROR_NOT_VALID_MOVE, /* Here's a non-protocol pseudo-error used to implement QUIT. */ TTT_ERROR_QUIT_REQUESTED