diff --git a/src/gamestate.c b/src/gamestate.c index 6929ecd..0691123 100644 --- a/src/gamestate.c +++ b/src/gamestate.c @@ -197,6 +197,16 @@ SYMBOL_EXPORT void SwitchGamestate(struct Game *game, const char* current, const StartGamestate(game, n); } +SYMBOL_EXPORT void ChangeGamestate(struct Game *game, const char* current, const char* n) { + StopGamestate(game, current); + LoadGamestate(game, n); + StartGamestate(game, n); +} + SYMBOL_EXPORT void SwitchCurrentGamestate(struct Game *game, const char* n) { SwitchGamestate(game, game->_priv.current_gamestate->name, n); } + +SYMBOL_EXPORT void ChangeCurrentGamestate(struct Game *game, const char* n) { + ChangeGamestate(game, game->_priv.current_gamestate->name, n); +} diff --git a/src/gamestate.h b/src/gamestate.h index d391a91..58e3f58 100644 --- a/src/gamestate.h +++ b/src/gamestate.h @@ -64,5 +64,7 @@ void ResumeGamestate(struct Game *game, const char* name); void UnloadAllGamestates(struct Game *game); void SwitchGamestate(struct Game *game, const char* current, const char* n); void SwitchCurrentGamestate(struct Game *game, const char* n); +void ChangeGamestate(struct Game *game, const char* current, const char* n); +void ChangeCurrentGamestate(struct Game *game, const char* n); #endif