(svn r9197) [NoAI] -Fix: std::map.end() is the item AFTER the last valid item, not the last item
--- a/src/ai/core/ai_factory.hpp Thu Mar 15 10:29:43 2007 +0000
+++ b/src/ai/core/ai_factory.hpp Thu Mar 15 11:53:41 2007 +0000
@@ -75,16 +75,16 @@
Factories::iterator first_it;
for (; i > 0; i--) it++;
first_it = it;
- AIFactoryBase *f = (*it).second;
+ AIFactoryBase *f = it->second;
if (!f->AllowStartup()) {
/* We can't start this AI, try to find the next best */
do {
+ it++;
if (it == GetFactories().end()) it = GetFactories().begin();
- else it++;
/* Back at the beginning? Drop out! */
if (first_it == it) break;
- f = (*it).second;
+ f = it->second;
} while (!f->AllowStartup());
/* Unable to start any AI */
if (first_it == it) return NULL;