Check that save file have the same amount of cities

This commit is contained in:
Vasilii Rogin 2024-04-18 23:02:22 +03:00
parent 196ad2267f
commit acd0413626
1 changed files with 9 additions and 0 deletions

View File

@ -1158,6 +1158,15 @@ int wmWorldMap_load(File* stream)
int numCities;
if (fileReadInt32(stream, &numCities) == -1) return -1;
bool isCitiesLimitFixEnabled = true;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITIES_LIMIT_FIX, &isCitiesLimitFixEnabled);
if (isCitiesLimitFixEnabled && numCities != wmMaxAreaNum) {
debugPrint("WorldMap Error: Cities limit fix is enabled, "
"but the number of cities in the save file is different from "
"the number of cities in the worldmap.txt file.");
return -1;
}
for (int areaIdx = 0; areaIdx < numCities; areaIdx++) {
CityInfo* city = &(wmAreaInfoList[areaIdx]);