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 "../network/network.h"
|
||||||
#include "../window_func.h"
|
#include "../window_func.h"
|
||||||
#include "../command_func.h"
|
#include "../command_func.h"
|
||||||
|
#include "../fileio_func.h"
|
||||||
#include "ai_scanner.hpp"
|
#include "ai_scanner.hpp"
|
||||||
#include "ai_instance.hpp"
|
#include "ai_instance.hpp"
|
||||||
#include "ai_config.hpp"
|
#include "ai_config.hpp"
|
||||||
|
@ -136,7 +137,10 @@
|
||||||
if (AI::ai_scanner != NULL) AI::Uninitialize(true);
|
if (AI::ai_scanner != NULL) AI::Uninitialize(true);
|
||||||
|
|
||||||
AI::frame_counter = 0;
|
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)
|
/* 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()
|
/* static */ void AI::Rescan()
|
||||||
{
|
{
|
||||||
|
TarScanner::DoScan(TarScanner::AI);
|
||||||
|
|
||||||
AI::ai_scanner->RescanAIDir();
|
AI::ai_scanner->RescanAIDir();
|
||||||
ResetConfig();
|
ResetConfig();
|
||||||
|
|
||||||
|
|
|
@ -1251,7 +1251,6 @@ DEF_CONSOLE_CMD(ConRescanAI)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TarScanner::DoScan(TarScanner::AI);
|
|
||||||
AI::Rescan();
|
AI::Rescan();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1265,7 +1264,6 @@ DEF_CONSOLE_CMD(ConRescanNewGRF)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TarScanner::DoScan(TarScanner::NEWGRF);
|
|
||||||
ScanNewGRFFiles(NULL);
|
ScanNewGRFFiles(NULL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
switch (*iter) {
|
switch (*iter) {
|
||||||
case CONTENT_TYPE_AI:
|
case CONTENT_TYPE_AI:
|
||||||
case CONTENT_TYPE_AI_LIBRARY:
|
case CONTENT_TYPE_AI_LIBRARY:
|
||||||
mode |= TarScanner::AI;
|
/* AI::Rescan calls the scanner. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONTENT_TYPE_BASE_GRAPHICS:
|
case CONTENT_TYPE_BASE_GRAPHICS:
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONTENT_TYPE_NEWGRF:
|
case CONTENT_TYPE_NEWGRF:
|
||||||
mode |= TarScanner::NEWGRF;
|
/* ScanNewGRFFiles calls the scanner. */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONTENT_TYPE_SCENARIO:
|
case CONTENT_TYPE_SCENARIO:
|
||||||
|
|
|
@ -635,6 +635,7 @@ void DoScanNewGRFFiles(void *callback)
|
||||||
_modal_progress_work_mutex->BeginCritical();
|
_modal_progress_work_mutex->BeginCritical();
|
||||||
|
|
||||||
ClearGRFConfigList(&_all_grfs);
|
ClearGRFConfigList(&_all_grfs);
|
||||||
|
TarScanner::DoScan(TarScanner::NEWGRF);
|
||||||
|
|
||||||
DEBUG(grf, 1, "Scanning for NewGRFs");
|
DEBUG(grf, 1, "Scanning for NewGRFs");
|
||||||
uint num = GRFFileScanner::DoScan();
|
uint num = GRFFileScanner::DoScan();
|
||||||
|
|
|
@ -1172,7 +1172,6 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
|
||||||
|
|
||||||
case SNGRFS_RESCAN_FILES:
|
case SNGRFS_RESCAN_FILES:
|
||||||
case SNGRFS_RESCAN_FILES2:
|
case SNGRFS_RESCAN_FILES2:
|
||||||
TarScanner::DoScan(TarScanner::NEWGRF);
|
|
||||||
ScanNewGRFFiles(this);
|
ScanNewGRFFiles(this);
|
||||||
break;
|
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
|
* 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. */
|
* because then we cannot show it on the debug console as that hasn't been configured yet. */
|
||||||
DeterminePaths(argv[0]);
|
DeterminePaths(argv[0]);
|
||||||
TarScanner::DoScan(TarScanner::AI | TarScanner::BASESET);
|
TarScanner::DoScan(TarScanner::BASESET);
|
||||||
BaseGraphics::FindSets();
|
BaseGraphics::FindSets();
|
||||||
BaseSounds::FindSets();
|
BaseSounds::FindSets();
|
||||||
BaseMusic::FindSets();
|
BaseMusic::FindSets();
|
||||||
|
@ -636,7 +636,7 @@ int ttd_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DeterminePaths(argv[0]);
|
DeterminePaths(argv[0]);
|
||||||
TarScanner::DoScan(TarScanner::ALL);
|
TarScanner::DoScan(TarScanner::BASESET | TarScanner::SCENARIO);
|
||||||
BaseGraphics::FindSets();
|
BaseGraphics::FindSets();
|
||||||
BaseSounds::FindSets();
|
BaseSounds::FindSets();
|
||||||
BaseMusic::FindSets();
|
BaseMusic::FindSets();
|
||||||
|
|
Loading…
Reference in New Issue