From bd868a0137b47b49a678b0eff412c26be6d94598 Mon Sep 17 00:00:00 2001 From: alistair Date: Thu, 24 Jun 2021 18:18:11 +1000 Subject: [PATCH] bug fix --- src/controlscheme.c | 5 +++++ src/game.c | 1 + src/main.c | 6 ++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/controlscheme.c b/src/controlscheme.c index 99d699f..f27cde5 100644 --- a/src/controlscheme.c +++ b/src/controlscheme.c @@ -12,6 +12,7 @@ struct InputMap input_map; struct InputMap_Ser { unsigned int id; unsigned int ver; + size_t size; struct InputMap input_map; }; @@ -77,6 +78,9 @@ int load_controls(void) { struct InputMap_Ser *im = (struct InputMap_Ser *)b.data; + if (im->size != sizeof(struct InputMap_Ser)) + return 0; + if (im->id != INPUT_MAP_ID) return 0; @@ -93,6 +97,7 @@ void save_controls(void) { struct InputMap_Ser im; im.id = INPUT_MAP_ID; im.ver = INPUT_MAP_VERSION; + im.size = sizeof(struct InputMap_Ser); im.input_map = input_map; fwrite(&im, sizeof(unsigned char), sizeof(struct InputMap_Ser), f); diff --git a/src/game.c b/src/game.c index 694a084..ea9ff66 100644 --- a/src/game.c +++ b/src/game.c @@ -1754,6 +1754,7 @@ void handle_input_event(SDL_Event event) { if (sc == input_map.goto_level) { gameui.currently_bound_textbox = textboxes + TB_LEVEL_CHOOSER; + reset_textbox(gameui.currently_bound_textbox); }; if (sc == input_map.high_contrast_mode) { diff --git a/src/main.c b/src/main.c index a4227fa..1a8246a 100644 --- a/src/main.c +++ b/src/main.c @@ -168,15 +168,13 @@ int main (int argc, char** argv) { /* * TODO: - * - Fix open screen and pause screens * - Allow setting and saving/loading differnet control schemes - * - Allow starting a specific level * - Allow adjusging level lengths? - * - Ensure next_level doesn't leak memory * - fix that weird jitter * - Fix open screen and pause screens * - make the end of level look sane * - restart level - * - make sure goto level doesn't log an end-0f-level time + * - make sure goto level doesn't log an end-0f-level time? */ +