]> git.lizzy.rs Git - nothing.git/commitdiff
(#1193) Move selection clean to game_switch_state
authorgooddoog <gooddoog@student.su>
Sun, 8 Dec 2019 17:09:25 +0000 (20:09 +0300)
committergooddoog <gooddoog@student.su>
Sun, 8 Dec 2019 17:09:25 +0000 (20:09 +0300)
src/game.c
src/ui/console.c

index 9c45c05d5c4d28cbd18da051b3d9cacfa5645445..70810f96d7eb8d6717bd4035d265f8762a707e8c 100644 (file)
@@ -40,6 +40,9 @@ typedef struct Game {
 
 void game_switch_state(Game *game, Game_state state)
 {
+    if (state == GAME_STATE_LEVEL_PICKER) {
+        level_picker_clean_selection(game->level_picker);
+    }
     game->camera = create_camera(game->renderer, game->font);
     game->state = state;
 }
index e38027226dd149eb072ab691ca5435d246673ed4..ce98256efc7e37ec6e940411a25464bad6f32e6d 100644 (file)
@@ -172,7 +172,6 @@ static int console_eval_input(Console *console)
         }
     } else if (token_equals_str(command, "menu")) {
         console_log_push_line(console->console_log, "Loading menu", NULL, CONSOLE_FOREGROUND);
-        level_picker_clean_selection(console->game->level_picker);
         game_switch_state(console->game, GAME_STATE_LEVEL_PICKER);
     } else {
         console_log_push_line(console->console_log, "Unknown command", NULL, CONSOLE_ERROR);