mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-02 09:40:35 +00:00
(svn r23399) -Fix (r23362): a randomizer should return a random value, not always the first
This commit is contained in:
parent
f259e6bf5d
commit
5a9523bfa0
@ -81,13 +81,15 @@ AIInfo *AIScannerInfo::SelectRandomAI() const
|
||||
|
||||
/* Find the Nth item from the array */
|
||||
ScriptInfoList::const_iterator it = this->info_single_list.begin();
|
||||
AIInfo *i = static_cast<AIInfo *>((*it).second);
|
||||
while (!i->UseAsRandomAI()) it++;
|
||||
|
||||
#define GetAIInfo(it) static_cast<AIInfo *>((*it).second)
|
||||
while (!GetAIInfo(it)->UseAsRandomAI()) it++;
|
||||
for (; pos > 0; pos--) {
|
||||
it++;
|
||||
while (!i->UseAsRandomAI()) it++;
|
||||
while (!GetAIInfo(it)->UseAsRandomAI()) it++;
|
||||
}
|
||||
return i;
|
||||
return GetAIInfo(it);
|
||||
#undef GetAIInfo
|
||||
}
|
||||
|
||||
AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool force_exact_match)
|
||||
|
Loading…
Reference in New Issue
Block a user