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.
This commit is contained in:
Ben Harris
2023-06-25 14:30:20 +01:00
parent 0d005b526e
commit a56781bb69

View File

@ -2810,15 +2810,15 @@ static char *interpret_move(const game_state *state, game_ui *ui,
} }
if (button == LEFT_BUTTON || button == RIGHT_BUTTON) { 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); 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", sprintf(buf, "%c%d,%d",
(char)((button == LEFT_BUTTON) ? 'D' : 'd'), px, py); (char)((button == LEFT_BUTTON) ? 'D' : 'd'), px, py);
return dupstr(buf); return dupstr(buf);
} }
return NULL; return MOVE_UNUSED;
} }
#else #else
static bool edge_placement_legal(const game_state *state, int x, int y) 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), coord_round_to_edge(FROMCOORD((float)x), FROMCOORD((float)y),
&px, &py); &px, &py);
if (!INUI(state, px, py)) return NULL; if (!INUI(state, px, py)) return MOVE_UNUSED;
if (!edge_placement_legal(state, px, py)) if (!edge_placement_legal(state, px, py))
return NULL; return MOVE_NO_EFFECT;
sprintf(buf, "E%d,%d", px, py); sprintf(buf, "E%d,%d", px, py);
return dupstr(buf); return dupstr(buf);
@ -2965,6 +2965,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
ui->doty = dot->y; ui->doty = dot->y;
return MOVE_UI_UPDATE; return MOVE_UI_UPDATE;
} }
return MOVE_NO_EFFECT;
} else if (button == RIGHT_DRAG && ui->dragging) { } else if (button == RIGHT_DRAG && ui->dragging) {
/* just move the drag coords. */ /* just move the drag coords. */
ui->dx = x; ui->dx = x;
@ -3062,7 +3063,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
} }
} }
return NULL; return MOVE_UNUSED;
} }
#endif #endif