From 26843776a2f60180120a0fa9463394223288e475 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sun, 4 Sep 2016 01:26:41 +0200 Subject: [PATCH] gamestates: mark gamestate as started before launching Gamestate_Start This change allows to stop the current gamestate from Gamestate_Start. --- src/libsuperderpy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsuperderpy.c b/src/libsuperderpy.c index bb6fa8a..5ceda4f 100644 --- a/src/libsuperderpy.c +++ b/src/libsuperderpy.c @@ -344,10 +344,10 @@ SYMBOL_EXPORT int libsuperderpy_run(struct Game *game) { PrintConsole(game, "Starting gamestate \"%s\"...", tmp->name); al_stop_timer(game->_priv.timer); game->_priv.current_gamestate = tmp; - (*tmp->api->Gamestate_Start)(game, tmp->data); - al_resume_timer(game->_priv.timer); tmp->started = true; tmp->pending_start = false; + (*tmp->api->Gamestate_Start)(game, tmp->data); + al_resume_timer(game->_priv.timer); } if ((tmp->started) || (tmp->pending_start) || (tmp->pending_load)) gameActive = true;