# HG changeset patch # User truelight # Date 1173959621 0 # Node ID 45581b218c983fbf85c10679ff87861d3ed1dd19 # Parent 04502c3557f2a9d2ac0553a9df3fe9a9ff9f3bd5 (svn r9197) [NoAI] -Fix: std::map.end() is the item AFTER the last valid item, not the last item diff -r 04502c3557f2 -r 45581b218c98 src/ai/core/ai_factory.hpp --- 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;