summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 88990ee1..95c502c3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -88,6 +88,7 @@ int fps = 0, frame = 0, current_npc = 0;
bool displayPathToMouse = false;
unsigned short startX = 0, startY = 0;
Being *autoTarget = NULL;
+Map *tiledMap = NULL;
Engine *engine = NULL;
SDL_Joystick *joypad = NULL; /**< Joypad object */
@@ -405,14 +406,17 @@ void game()
do_parse();
flush();
}
+
+ do_exit();
+}
+void do_exit()
+{
delete engine;
+ delete tiledMap;
destroyGuiWindows();
close_session();
-}
-void do_exit()
-{
if (joypad != NULL)
{
SDL_JoystickClose(joypad);
@@ -920,7 +924,7 @@ void do_input()
Direction = Being::NE;
}
- Map *tiledMap = engine->getCurrentMap();
+ tiledMap = engine->getCurrentMap();
// Allow keyboard control to interrupt an existing path
if ((xDirection != 0 || yDirection != 0) && player_node->action == Being::WALK)