mirror of https://github.com/OpenTTD/OpenTTD
(svn r23222) -Codechange: reduce tar scanning calls to the bare minimum
parent
387e410f3e
commit
4ae8bbea07
|
@ -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();
|
||||
|
||||
|
|
|
@ -1251,7 +1251,6 @@ DEF_CONSOLE_CMD(ConRescanAI)
|
|||
return true;
|
||||
}
|
||||
|
||||
TarScanner::DoScan(TarScanner::AI);
|
||||
AI::Rescan();
|
||||
|
||||
return true;
|
||||
|
@ -1265,7 +1264,6 @@ DEF_CONSOLE_CMD(ConRescanNewGRF)
|
|||
return true;
|
||||
}
|
||||
|
||||
TarScanner::DoScan(TarScanner::NEWGRF);
|
||||
ScanNewGRFFiles(NULL);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
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 @@ public:
|
|||
break;
|
||||
|
||||
case CONTENT_TYPE_NEWGRF:
|
||||
mode |= TarScanner::NEWGRF;
|
||||
/* ScanNewGRFFiles calls the scanner. */
|
||||
break;
|
||||
|
||||
case CONTENT_TYPE_SCENARIO:
|
||||
|
|
|
@ -635,6 +635,7 @@ void DoScanNewGRFFiles(void *callback)
|
|||
_modal_progress_work_mutex->BeginCritical();
|
||||
|
||||
ClearGRFConfigList(&_all_grfs);
|
||||
TarScanner::DoScan(TarScanner::NEWGRF);
|
||||
|
||||
DEBUG(grf, 1, "Scanning for NewGRFs");
|
||||
uint num = GRFFileScanner::DoScan();
|
||||
|
|
|
@ -1172,7 +1172,6 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
|
|||
|
||||
case SNGRFS_RESCAN_FILES:
|
||||
case SNGRFS_RESCAN_FILES2:
|
||||
TarScanner::DoScan(TarScanner::NEWGRF);
|
||||
ScanNewGRFFiles(this);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -621,7 +621,7 @@ int ttd_main(int argc, char *argv[])
|
|||
* 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 @@ int ttd_main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
DeterminePaths(argv[0]);
|
||||
TarScanner::DoScan(TarScanner::ALL);
|
||||
TarScanner::DoScan(TarScanner::BASESET | TarScanner::SCENARIO);
|
||||
BaseGraphics::FindSets();
|
||||
BaseSounds::FindSets();
|
||||
BaseMusic::FindSets();
|
||||
|
|
Loading…
Reference in New Issue