From 89dbeaaee05a6ce7adc353f5676df211c1ed83fb Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sun, 18 Sep 2005 20:22:07 +0000 Subject: Applyed biggeruniverse's patch to fix memory leaks. --- src/game.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/game.cpp') 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) -- cgit v1.2.3-70-g09d2