(svn r16649) -Fix: When the exact AI version a game was saved with is no longer available and the latest version of the AI can't load data from that AI version, use the latest available version of the AI that can load the data instead of the first found version that can load the data.

This commit is contained in:
yexo 2009-06-24 23:23:08 +00:00
parent 8bc9adde19
commit 2970b72e59

View File

@ -310,7 +310,7 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam)
snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName()); snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName());
strtolower(ai_name_compare); strtolower(ai_name_compare);
if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam)) { if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam) && version == -1 || (*it).second->GetVersion() > version) {
version = (*it).second->GetVersion(); version = (*it).second->GetVersion();
info = (*it).second; info = (*it).second;
} }