Mercurial > hg > openttd
changeset 18386:92710f39ec5c draft
(svn r23222) -Codechange: reduce tar scanning calls to the bare minimum
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 14 Nov 2011 21:40:39 +0000 |
parents | eef754fea9b8 |
children | 96c0b67e485c |
files | src/ai/ai_core.cpp src/console_cmds.cpp src/network/network_content_gui.cpp src/newgrf_config.cpp src/newgrf_gui.cpp src/openttd.cpp |
diffstat | 6 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ /* static */ void AI::Rescan() { + TarScanner::DoScan(TarScanner::AI); + AI::ai_scanner->RescanAIDir(); ResetConfig();
--- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1251,7 +1251,6 @@ return true; } - TarScanner::DoScan(TarScanner::AI); AI::Rescan(); return true; @@ -1265,7 +1264,6 @@ return true; } - TarScanner::DoScan(TarScanner::NEWGRF); ScanNewGRFFiles(NULL); return true;
--- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -91,7 +91,7 @@ switch (*iter) { case CONTENT_TYPE_AI: case CONTENT_TYPE_AI_LIBRARY: - mode |= TarScanner::AI; + /* AI::Rescan calls the scanner. */ break; case CONTENT_TYPE_BASE_GRAPHICS: @@ -101,7 +101,7 @@ break; case CONTENT_TYPE_NEWGRF: - mode |= TarScanner::NEWGRF; + /* ScanNewGRFFiles calls the scanner. */ break; case CONTENT_TYPE_SCENARIO:
--- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -635,6 +635,7 @@ _modal_progress_work_mutex->BeginCritical(); ClearGRFConfigList(&_all_grfs); + TarScanner::DoScan(TarScanner::NEWGRF); DEBUG(grf, 1, "Scanning for NewGRFs"); uint num = GRFFileScanner::DoScan();
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1172,7 +1172,6 @@ case SNGRFS_RESCAN_FILES: case SNGRFS_RESCAN_FILES2: - TarScanner::DoScan(TarScanner::NEWGRF); ScanNewGRFFiles(this); break; }
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -621,7 +621,7 @@ * The next two functions are needed to list the graphics sets. We can't do them earlier * because then we cannot show it on the debug console as that hasn't been configured yet. */ DeterminePaths(argv[0]); - TarScanner::DoScan(TarScanner::AI | TarScanner::BASESET); + TarScanner::DoScan(TarScanner::BASESET); BaseGraphics::FindSets(); BaseSounds::FindSets(); BaseMusic::FindSets(); @@ -636,7 +636,7 @@ #endif DeterminePaths(argv[0]); - TarScanner::DoScan(TarScanner::ALL); + TarScanner::DoScan(TarScanner::BASESET | TarScanner::SCENARIO); BaseGraphics::FindSets(); BaseSounds::FindSets(); BaseMusic::FindSets();