summaryrefslogtreecommitdiff
path: root/ttd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-03-09 19:48:20 +0000
committerDarkvater <darkvater@openttd.org>2005-03-09 19:48:20 +0000
commit9bd079d4257e9d49bb22244edd2d103620bc8896 (patch)
tree9e042e01e23d4efe4caed7b4bb0bd90ebaabc1eb /ttd.c
parent9bc68d209f77708554b72ecafa6318634d8b9f74 (diff)
downloadopenttd-9bd079d4257e9d49bb22244edd2d103620bc8896.tar.xz
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Diffstat (limited to 'ttd.c')
-rw-r--r--ttd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ttd.c b/ttd.c
index 7b85a59f5..eeb0c2452 100644
--- a/ttd.c
+++ b/ttd.c
@@ -447,6 +447,11 @@ static void UnInitializeDynamicVariables(void)
free(_industry_sort);
}
+static void UnInitializeGame(void)
+{
+ UnInitWindowSystem();
+ UnInitNewgrEngines();
+}
static void LoadIntroGame(void)
{
@@ -459,7 +464,7 @@ static void LoadIntroGame(void)
LoadStringWidthTable();
// Setup main window
- InitWindowSystem();
+ ResetWindowSystem();
SetupColorsAndInitialWindow();
// Generate a world.
@@ -699,6 +704,7 @@ int ttd_main(int argc, char* argv[])
/* Close all and any open filehandles */
FioCloseAll();
+ UnInitializeGame();
return 0;
}
@@ -725,7 +731,7 @@ static void MakeNewGame(void)
GfxLoadSprites();
// Reinitialize windows
- InitWindowSystem();
+ ResetWindowSystem();
LoadStringWidthTable();
SetupColorsAndInitialWindow();
@@ -757,7 +763,7 @@ static void MakeNewEditorWorld(void)
GfxLoadSprites();
// Re-init the windowing system
- InitWindowSystem();
+ ResetWindowSystem();
// Create toolbars
SetupColorsAndInitialWindow();
@@ -792,7 +798,7 @@ static void StartScenario(void)
GfxLoadSprites();
// Reinitialize windows
- InitWindowSystem();
+ ResetWindowSystem();
LoadStringWidthTable();
SetupColorsAndInitialWindow();
@@ -1327,7 +1333,7 @@ bool AfterLoadGame(uint version)
}
// Initialize windows
- InitWindowSystem();
+ ResetWindowSystem();
SetupColorsAndInitialWindow();
w = FindWindowById(WC_MAIN_WINDOW, 0);