mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
(svn r16651) -Fix: When there is no AI version that can load data from the savegame, load the latest version of the same AI instead of a random AI.
This commit is contained in:
parent
cc07a78577
commit
d45b27c46b
@ -69,6 +69,10 @@ static void Load_AIPL()
|
|||||||
config->ChangeAI(NULL);
|
config->ChangeAI(NULL);
|
||||||
} else {
|
} else {
|
||||||
config->ChangeAI(_ai_saveload_name, _ai_saveload_version);
|
config->ChangeAI(_ai_saveload_name, _ai_saveload_version);
|
||||||
|
if (!config->HasAI()) {
|
||||||
|
/* No version of the AI available that can load the data. Try to load the
|
||||||
|
* latest version of the AI instead. */
|
||||||
|
config->ChangeAI(_ai_saveload_name, -1);
|
||||||
if (!config->HasAI()) {
|
if (!config->HasAI()) {
|
||||||
if (strcmp(_ai_saveload_name, "%_dummy") != 0) {
|
if (strcmp(_ai_saveload_name, "%_dummy") != 0) {
|
||||||
DEBUG(ai, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name, _ai_saveload_version);
|
DEBUG(ai, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name, _ai_saveload_version);
|
||||||
@ -77,6 +81,10 @@ static void Load_AIPL()
|
|||||||
DEBUG(ai, 0, "The savegame had no AIs available at the time of saving.");
|
DEBUG(ai, 0, "The savegame had no AIs available at the time of saving.");
|
||||||
DEBUG(ai, 0, "A random available AI will be loaded now.");
|
DEBUG(ai, 0, "A random available AI will be loaded now.");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
DEBUG(ai, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name, _ai_saveload_version);
|
||||||
|
DEBUG(ai, 0, "The latest version of that AI has been loaded instead, but it'll not get the savegame data as it's incompatible.");
|
||||||
|
}
|
||||||
/* Make sure the AI doesn't get the saveload data, as he was not the
|
/* Make sure the AI doesn't get the saveload data, as he was not the
|
||||||
* writer of the saveload data in the first place */
|
* writer of the saveload data in the first place */
|
||||||
_ai_saveload_version = -1;
|
_ai_saveload_version = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user