Changeset - r18376:e66b27d1ff1d
[Not reviewed]
master
0 6 0
rubidium - 13 years ago 2011-11-14 21:40:39
rubidium@openttd.org
(svn r23222) -Codechange: reduce tar scanning calls to the bare minimum
6 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_core.cpp
Show inline comments
 
@@ -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, Til
 

	
 
/* static */ void AI::Rescan()
 
{
 
	TarScanner::DoScan(TarScanner::AI);
 

	
 
	AI::ai_scanner->RescanAIDir();
 
	ResetConfig();
 

	
src/console_cmds.cpp
Show inline comments
 
@@ -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;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -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:
src/newgrf_config.cpp
Show inline comments
 
@@ -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();
src/newgrf_gui.cpp
Show inline comments
 
@@ -1172,7 +1172,6 @@ struct NewGRFWindow : public QueryString
 

	
 
			case SNGRFS_RESCAN_FILES:
 
			case SNGRFS_RESCAN_FILES2:
 
				TarScanner::DoScan(TarScanner::NEWGRF);
 
				ScanNewGRFFiles(this);
 
				break;
 
		}
src/openttd.cpp
Show inline comments
 
@@ -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();
0 comments (0 inline, 0 general)