summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-09-18 20:22:07 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-09-18 20:22:07 +0000
commit89dbeaaee05a6ce7adc353f5676df211c1ed83fb (patch)
tree3f18e18af0248ae555d90f48f0217d3c5371505a /src/game.cpp
parent761c274a741869ef767d0db2cd8ef0eca149ce3d (diff)
downloadmana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.gz
mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.bz2
mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.tar.xz
mana-client-89dbeaaee05a6ce7adc353f5676df211c1ed83fb.zip
Applyed biggeruniverse's patch to fix memory leaks.
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)