Avoid redundant re-scans for AI and game script files

This commit is contained in:
Jonathan G Rennison
2019-09-23 18:34:11 +01:00
parent 66b32df7cc
commit 158f063a38
2 changed files with 6 additions and 14 deletions

View File

@@ -184,15 +184,10 @@
AI::KillAll(); AI::KillAll();
if (keepConfig) { if (keepConfig) {
/* Run a rescan, which indexes all AIInfos again, and check if we can /* Do not bother re-scanning AI files, just reset config */
* still load all the AIS, while keeping the configs in place */ ResetConfig();
Rescan();
} else { } else {
delete AI::scanner_info; /* Do not bother re-scanning AI files, just delete config */
delete AI::scanner_library;
AI::scanner_info = nullptr;
AI::scanner_library = nullptr;
for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
if (_settings_game.ai_config[c] != nullptr) { if (_settings_game.ai_config[c] != nullptr) {
delete _settings_game.ai_config[c]; delete _settings_game.ai_config[c];

View File

@@ -107,13 +107,10 @@
cur_company.Restore(); cur_company.Restore();
if (keepConfig) { if (keepConfig) {
Rescan(); /* Do not bother re-scanning game script files, just reset config */
ResetConfig();
} else { } else {
delete Game::scanner_info; /* Do not bother re-scanning game script, just delete config */
delete Game::scanner_library;
Game::scanner_info = nullptr;
Game::scanner_library = nullptr;
if (_settings_game.game_config != nullptr) { if (_settings_game.game_config != nullptr) {
delete _settings_game.game_config; delete _settings_game.game_config;
_settings_game.game_config = nullptr; _settings_game.game_config = nullptr;