summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-19 20:55:56 +0000
committertruebrain <truebrain@openttd.org>2011-12-19 20:55:56 +0000
commitc99950c21537f9c890e4eac6d077c0ec6f31b7aa (patch)
treec130b8aa9cf12c7c3a1c9ef014bb35df3f53035f /src/openttd.cpp
parentb4f832f29f44dcd48e8f0806d47ce78b1963d639 (diff)
downloadopenttd-c99950c21537f9c890e4eac6d077c0ec6f31b7aa.tar.xz
(svn r23606) -Add: GameScanner, to auto-detect game scripts, and wire it in the console
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 81c9dd443..76a1a416a 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -63,6 +63,7 @@
#include "newgrf.h"
#include "misc/getoptdata.h"
#include "game/game.hpp"
+#include "game/game_config.hpp"
#include "town.h"
@@ -204,6 +205,11 @@ static void ShowHelp()
p = AI::GetConsoleList(p, lastof(buf), true);
AI::Uninitialize(true);
+ /* We need to initialize the GameScript, so it finds the GSs */
+ Game::Initialize();
+ p = Game::GetConsoleList(p, lastof(buf), true);
+ Game::Uninitialize(true);
+
/* ShowInfo put output to stderr, but version information should go
* to stdout; this is the only exception */
#if !defined(WIN32) && !defined(WIN64)
@@ -287,7 +293,7 @@ static void ShutdownGame()
/* stop the scripts */
AI::Uninitialize(false);
- Game::Uninitialize();
+ Game::Uninitialize(false);
/* Uninitialize variables that are allocated dynamically */
GamelogReset();
@@ -347,6 +353,9 @@ void MakeNewgameSettingsLive()
delete _settings_game.ai_config[c];
}
}
+ if (_settings_game.game_config != NULL) {
+ delete _settings_game.game_config;
+ }
/* Copy newgame settings to active settings.
* Also initialise old settings needed for savegame conversion. */
@@ -359,6 +368,10 @@ void MakeNewgameSettingsLive()
_settings_game.ai_config[c] = new AIConfig(_settings_newgame.ai_config[c]);
}
}
+ _settings_game.game_config = NULL;
+ if (_settings_newgame.game_config != NULL) {
+ _settings_game.game_config = new GameConfig(_settings_newgame.game_config);
+ }
}
void OpenBrowser(const char *url)
@@ -402,6 +415,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
TarScanner::DoScan(TarScanner::SCENARIO);
AI::Initialize();
+ Game::Initialize();
/* We want the new (correct) NewGRF count to survive the loading. */
uint last_newgrf_count = _settings_client.gui.last_newgrf_count;
@@ -411,6 +425,7 @@ struct AfterNewGRFScan : NewGRFScanCallback {
* reading the configuration file, recalculate that now. */
UpdateNewGRFConfigPalette();
+ Game::Uninitialize(true);
AI::Uninitialize(true);
CheckConfig();
LoadFromHighScore();