src/ai/ai_squirrel.cpp
branchnoai
changeset 10891 5ebb6f9068d0
parent 10889 ecb77cfc4a10
child 10898 cf5ee9ede576
--- a/src/ai/ai_squirrel.cpp	Tue Jun 10 14:24:14 2008 +0000
+++ b/src/ai/ai_squirrel.cpp	Tue Jun 10 14:40:32 2008 +0000
@@ -110,6 +110,26 @@
 	closedir(dir);
 }
 
+void AISquirrel::ScanAIDir()
+{
+	char buf[MAX_PATH];
+	Searchpath sp;
+
+	FOR_ALL_SEARCHPATHS(sp) {
+		FioAppendDirectory(buf, MAX_PATH, sp, AI_DIR);
+		if (FileExists(buf)) this->ScanDir(buf, false);
+		ttd_strlcat(buf, "library" PATHSEP, MAX_PATH);
+		if (FileExists(buf)) this->ScanDir(buf, true);
+	}
+}
+
+void AISquirrel::RescanAIDir()
+{
+	extern void ScanForTarFiles();
+	ScanForTarFiles();
+	this->ScanAIDir();
+}
+
 AISquirrel::AISquirrel()
 {
 	this->library_instance_count = 0;
@@ -128,15 +148,7 @@
 	this->engine->SetGlobalPointer(this);
 
 	/* Scan the AI dir for scripts */
-	char buf[MAX_PATH];
-	Searchpath sp;
-
-	FOR_ALL_SEARCHPATHS(sp) {
-		FioAppendDirectory(buf, MAX_PATH, sp, AI_DIR);
-		if (FileExists(buf)) this->ScanDir(buf, false);
-		ttd_strlcat(buf, "library" PATHSEP, MAX_PATH);
-		if (FileExists(buf)) this->ScanDir(buf, true);
-	}
+	this->ScanAIDir();
 }
 
 AISquirrel::~AISquirrel()