From 158f063a383ed6033e3dfd29af59f5565da7848d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 23 Sep 2019 18:34:11 +0100 Subject: [PATCH] Avoid redundant re-scans for AI and game script files --- src/ai/ai_core.cpp | 11 +++-------- src/game/game_core.cpp | 9 +++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index f896e294c6..45631d9ab5 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -184,15 +184,10 @@ AI::KillAll(); if (keepConfig) { - /* Run a rescan, which indexes all AIInfos again, and check if we can - * still load all the AIS, while keeping the configs in place */ - Rescan(); + /* Do not bother re-scanning AI files, just reset config */ + ResetConfig(); } else { - delete AI::scanner_info; - delete AI::scanner_library; - AI::scanner_info = nullptr; - AI::scanner_library = nullptr; - + /* Do not bother re-scanning AI files, just delete config */ for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) { if (_settings_game.ai_config[c] != nullptr) { delete _settings_game.ai_config[c]; diff --git a/src/game/game_core.cpp b/src/game/game_core.cpp index 394b77fb83..096368130a 100644 --- a/src/game/game_core.cpp +++ b/src/game/game_core.cpp @@ -107,13 +107,10 @@ cur_company.Restore(); if (keepConfig) { - Rescan(); + /* Do not bother re-scanning game script files, just reset config */ + ResetConfig(); } else { - delete Game::scanner_info; - delete Game::scanner_library; - Game::scanner_info = nullptr; - Game::scanner_library = nullptr; - + /* Do not bother re-scanning game script, just delete config */ if (_settings_game.game_config != nullptr) { delete _settings_game.game_config; _settings_game.game_config = nullptr;