mirror of https://github.com/OpenTTD/OpenTTD
(svn r22958) -Fix [FS#4778]: the savegame description and loading of savegames would crash with savegames from a patched stable (which didn't bump the savegame version)
parent
a6f9488ae4
commit
73a3708a9e
|
@ -349,8 +349,7 @@ static void Check_PLYR()
|
||||||
SaveLoad_PLYR_common(NULL, cprops);
|
SaveLoad_PLYR_common(NULL, cprops);
|
||||||
|
|
||||||
/* We do not load old custom names */
|
/* We do not load old custom names */
|
||||||
if (IsSavegameVersionBefore(84))
|
if (IsSavegameVersionBefore(84)) {
|
||||||
{
|
|
||||||
if (GB(cprops->name_1, 11, 5) == 15) {
|
if (GB(cprops->name_1, 11, 5) == 15) {
|
||||||
cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
|
cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
@ -360,6 +359,13 @@ static void Check_PLYR()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cprops->name == NULL && !IsInsideMM(cprops->name_1, SPECSTR_COMPANY_NAME_START, SPECSTR_COMPANY_NAME_LAST + 1) &&
|
||||||
|
cprops->name_1 != STR_GAME_SAVELOAD_NOT_AVAILABLE && cprops->name_1 != STR_SV_UNNAMED &&
|
||||||
|
cprops->name_1 != SPECSTR_ANDCO_NAME && cprops->name_1 != SPECSTR_PRESIDENT_NAME &&
|
||||||
|
cprops->name_1 != SPECSTR_SILLY_NAME) {
|
||||||
|
cprops->name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_load_check_data.companies.Insert(index, cprops)) delete cprops;
|
if (!_load_check_data.companies.Insert(index, cprops)) delete cprops;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,10 @@ static void Load_TOWN()
|
||||||
while ((index = SlIterateArray()) != -1) {
|
while ((index = SlIterateArray()) != -1) {
|
||||||
Town *t = new (index) Town();
|
Town *t = new (index) Town();
|
||||||
SlObject(t, _town_desc);
|
SlObject(t, _town_desc);
|
||||||
|
|
||||||
|
if (t->townnamegrfid == 0 && !IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST)) {
|
||||||
|
SlErrorCorrupt("Invalid town name generator");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue