From 4ae8bbea0706aa6c878d713489056ef634aa2d6d Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 14 Nov 2011 21:40:39 +0000 Subject: (svn r23222) -Codechange: reduce tar scanning calls to the bare minimum --- src/ai/ai_core.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ai') diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp index 18eeef3b0..0e7667ba4 100644 --- a/src/ai/ai_core.cpp +++ b/src/ai/ai_core.cpp @@ -17,6 +17,7 @@ #include "../network/network.h" #include "../window_func.h" #include "../command_func.h" +#include "../fileio_func.h" #include "ai_scanner.hpp" #include "ai_instance.hpp" #include "ai_config.hpp" @@ -136,7 +137,10 @@ if (AI::ai_scanner != NULL) AI::Uninitialize(true); AI::frame_counter = 0; - if (AI::ai_scanner == NULL) AI::ai_scanner = new AIScanner(); + if (AI::ai_scanner == NULL) { + TarScanner::DoScan(TarScanner::AI); + AI::ai_scanner = new AIScanner(); + } } /* static */ void AI::Uninitialize(bool keepConfig) @@ -325,6 +329,8 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) /* static */ void AI::Rescan() { + TarScanner::DoScan(TarScanner::AI); + AI::ai_scanner->RescanAIDir(); ResetConfig(); -- cgit v1.2.3-70-g09d2