(svn r23606) -Add: GameScanner, to auto-detect game scripts, and wire it in the console
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user