From a56781bb695b11f8afdd012c703b4d6930d4aca8 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sun, 25 Jun 2023 14:30:20 +0100 Subject: [PATCH] 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. --- galaxies.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/galaxies.c b/galaxies.c index 0841994..7f1d605 100644 --- a/galaxies.c +++ b/galaxies.c @@ -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