Fri, 24 Jul 2026 12:44:42 +0200
rename INVALID_POSITION to PIECE_NOT_FOUND
because that is really what it is used for
| src/chess/rules.c | file | annotate | diff | comparison | revisions | |
| src/chess/rules.h | file | annotate | diff | comparison | revisions | |
| src/main.c | file | annotate | diff | comparison | revisions |
--- a/src/chess/rules.c Fri Jul 24 12:42:57 2026 +0200 +++ b/src/chess/rules.c Fri Jul 24 12:44:42 2026 +0200 @@ -350,7 +350,7 @@ /* does piece exist */ if ((msrc(gamestate->board, move)&(PIECE_MASK|COLOR_MASK)) != (move->piece&(PIECE_MASK|COLOR_MASK))) { - return INVALID_POSITION; + return PIECE_NOT_FOUND; } /* can't capture own pieces */ @@ -683,7 +683,7 @@ if (get_threats(gamestate, move->torow, move->tofile, color, threats, &threatcount)) { - int reason = INVALID_POSITION; + int reason = PIECE_NOT_FOUND; /* find threats for the specified position */ for (uint8_t i = 0 ; i < threatcount ; i++) { @@ -718,7 +718,7 @@ move->fromfile = threat->fromfile; return VALID_MOVE_SYNTAX; } else { - return INVALID_POSITION; + return PIECE_NOT_FOUND; } }
--- a/src/chess/rules.h Fri Jul 24 12:42:57 2026 +0200 +++ b/src/chess/rules.h Fri Jul 24 12:44:42 2026 +0200 @@ -36,7 +36,7 @@ #define VALID_MOVE_SYNTAX 0 #define VALID_MOVE_SEMANTICS 0 /* use same code for a success */ #define INVALID_MOVE_SYNTAX 1 -#define INVALID_POSITION 2 +#define PIECE_NOT_FOUND 2 #define AMBIGUOUS_MOVE 3 #define NEED_PROMOTION 4 #define PIECE_PINNED 5
--- a/src/main.c Fri Jul 24 12:42:57 2026 +0200 +++ b/src/main.c Fri Jul 24 12:44:42 2026 +0200 @@ -358,7 +358,7 @@ case AMBIGUOUS_MOVE: printw("Ambiguous move - please specify the piece to move."); break; - case INVALID_POSITION: + case PIECE_NOT_FOUND: printw("No piece can be moved this way."); break; case NEED_PROMOTION: