summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-06-24 23:23:08 +0000
committeryexo <yexo@openttd.org>2009-06-24 23:23:08 +0000
commit2970b72e59f86f69ecdfb6c132a468fff2059323 (patch)
tree7dc384a65ad29b50472790abb2526f80727e1999
parent8bc9adde1940f6f312e5321717437ed13ec7f0ec (diff)
downloadopenttd-2970b72e59f86f69ecdfb6c132a468fff2059323.tar.xz
(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.
-rw-r--r--src/ai/ai_scanner.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp
index a588f5b9b..d84335d48 100644
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -310,7 +310,7 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam)
snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName());
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();
info = (*it).second;
}