diff options
author | rubidium <rubidium@openttd.org> | 2010-11-18 23:31:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-18 23:31:06 +0000 |
commit | 924a924907c608cb168fdf3265f6e6f2e883fcf6 (patch) | |
tree | 443a0351c39c12094063f0cf0de9966122bc7cce /src/ai/ai_scanner.cpp | |
parent | 40258d927fecaf3c2e6683718ae7dfa6c0443212 (diff) | |
download | openttd-924a924907c608cb168fdf3265f6e6f2e883fcf6.tar.xz |
(svn r21250) -Fix [FS#3952]: Rescanning AIs didn't "forget" removed AIs
Diffstat (limited to 'src/ai/ai_scanner.cpp')
-rw-r--r-- | src/ai/ai_scanner.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp index 6971a6956..36607c217 100644 --- a/src/ai/ai_scanner.cpp +++ b/src/ai/ai_scanner.cpp @@ -22,6 +22,8 @@ void AIScanner::RescanAIDir() { + /* Get rid of information of old AIs. */ + this->Reset(); this->ScanScriptDir("info.nut", AI_DIR); this->ScanScriptDir("library.nut", AI_LIBRARY_DIR); } @@ -59,7 +61,7 @@ AIScanner::AIScanner() : AI_CreateAIInfoDummy(this->engine->GetVM()); } -AIScanner::~AIScanner() +void AIScanner::Reset() { AIInfoList::iterator it = this->info_list.begin(); for (; it != this->info_list.end(); it++) { @@ -76,6 +78,15 @@ AIScanner::~AIScanner() delete (*lit).second; } + this->info_list.clear(); + this->info_single_list.clear(); + this->library_list.clear(); +} + +AIScanner::~AIScanner() +{ + this->Reset(); + delete this->info_dummy; } |