aboutsummaryrefslogtreecommitdiff
path: root/pearl.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-04-22 10:51:37 +0100
committerSimon Tatham <anakin@pobox.com>2023-04-23 13:25:06 +0100
commitea6be8f0af766ed15b19260ae17fa793d3d6d4d8 (patch)
tree5652d9ab037251583b672c55f91c8c40d6d42270 /pearl.c
parentd13ece698f02288c56cf46f3a20ecc1aaf8004f5 (diff)
downloadpuzzles-ea6be8f0af766ed15b19260ae17fa793d3d6d4d8.zip
puzzles-ea6be8f0af766ed15b19260ae17fa793d3d6d4d8.tar.gz
puzzles-ea6be8f0af766ed15b19260ae17fa793d3d6d4d8.tar.bz2
puzzles-ea6be8f0af766ed15b19260ae17fa793d3d6d4d8.tar.xz
Require games to accept new_ui(NULL) if they have preferences.
This will be necessary in the next commit, so that the midend can make a game_ui out of nothing in order to store preferences in it. The only game actually affected by this requirement is Pearl, which has a preference (GUI style) and also allocates space based on the game_state's grid size to store the coordinates of a path being dragged, so if there is no game_state, it can't do the latter - which is OK, because it also won't be expected to.
Diffstat (limited to 'pearl.c')
-rw-r--r--pearl.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/pearl.c b/pearl.c
index 7265c70..0e90044 100644
--- a/pearl.c
+++ b/pearl.c
@@ -1897,10 +1897,9 @@ static void legacy_prefs_override(struct game_ui *ui_out)
static game_ui *new_ui(const game_state *state)
{
game_ui *ui = snew(game_ui);
- int sz = state->shared->sz;
ui->ndragcoords = -1;
- ui->dragcoords = snewn(sz, int);
+ ui->dragcoords = state ? snewn(state->shared->sz, int) : NULL;
ui->cursor_active = getenv_bool("PUZZLES_SHOW_CURSOR", false);
ui->curx = ui->cury = 0;