diff libmlk-core/core/game.c @ 260:60a214ec1ab4

adventure: change the way states are stored
author David Demelier <markand@malikania.fr>
date Sun, 06 Dec 2020 22:50:48 +0100
parents 37771eaf4245
children bfde372bf152
line wrap: on
line diff
--- a/libmlk-core/core/game.c	Sun Dec 06 11:22:03 2020 +0100
+++ b/libmlk-core/core/game.c	Sun Dec 06 22:50:48 2020 +0100
@@ -51,6 +51,20 @@
 		game.state_next = state;
 }
 
+struct state *
+game_replace(struct state *state)
+{
+	assert(state);
+
+	struct state *save = game.state;
+
+	game.state = state;
+
+	state_start(state);
+
+	return save;
+}
+
 void
 game_handle(const union event *ev)
 {