diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-25 14:30:20 +0100 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-06-26 09:17:01 +0100 |
| commit | a56781bb695b11f8afdd012c703b4d6930d4aca8 (patch) | |
| tree | c63f21be64a929ed3da44d9980296be3b516c3bf | |
| parent | 0d005b526ed554a165a83557512e745c8de335d6 (diff) | |
| download | puzzles-a56781bb695b11f8afdd012c703b4d6930d4aca8.zip puzzles-a56781bb695b11f8afdd012c703b4d6930d4aca8.tar.gz puzzles-a56781bb695b11f8afdd012c703b4d6930d4aca8.tar.bz2 puzzles-a56781bb695b11f8afdd012c703b4d6930d4aca8.tar.xz | |
Distinguish MOVE_UNUSED from MOVE_NO_EFFECT in Galaxies
The boundary between them for mouse clicks probably wants to be
revisited because at the moment it's slightly inside the edge of the
grid. I tried using INUI() instead of INGRID() but that just gives a
different wrong answer, so I may need to actually understand what's
going on here.
| -rw-r--r-- | galaxies.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -2810,15 +2810,15 @@ static char *interpret_move(const game_state *state, game_ui *ui, } if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { - if (!INUI(state, px, py)) return NULL; + if (!INUI(state, px, py)) return MOVE_UNUSED; sp = &SPACE(state, px, py); - if (!dot_is_possible(state, sp, 1)) return NULL; + if (!dot_is_possible(state, sp, 1)) return MOVE_NO_EFFECT; sprintf(buf, "%c%d,%d", (char)((button == LEFT_BUTTON) ? 'D' : 'd'), px, py); return dupstr(buf); } - return NULL; + return MOVE_UNUSED; } #else static bool edge_placement_legal(const game_state *state, int x, int y) @@ -2899,9 +2899,9 @@ static char *interpret_move(const game_state *state, game_ui *ui, coord_round_to_edge(FROMCOORD((float)x), FROMCOORD((float)y), &px, &py); - if (!INUI(state, px, py)) return NULL; + if (!INUI(state, px, py)) return MOVE_UNUSED; if (!edge_placement_legal(state, px, py)) - return NULL; + return MOVE_NO_EFFECT; sprintf(buf, "E%d,%d", px, py); return dupstr(buf); @@ -2965,6 +2965,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, ui->doty = dot->y; return MOVE_UI_UPDATE; } + return MOVE_NO_EFFECT; } else if (button == RIGHT_DRAG && ui->dragging) { /* just move the drag coords. */ ui->dx = x; @@ -3062,7 +3063,7 @@ static char *interpret_move(const game_state *state, game_ui *ui, } } - return NULL; + return MOVE_UNUSED; } #endif |