Use gCitiesLimitFix variable

This commit is contained in:
Vasilii Rogin 2024-04-18 23:10:56 +03:00
parent acd0413626
commit db07e95f5b
1 changed files with 6 additions and 7 deletions

View File

@ -813,6 +813,7 @@ static int wmMaxEncBaseTypes;
static int wmMaxEncounterInfoTables; static int wmMaxEncounterInfoTables;
static bool gTownMapHotkeysFix; static bool gTownMapHotkeysFix;
static bool gCitiesLimitFix;
static double gGameTimeIncRemainder = 0.0; static double gGameTimeIncRemainder = 0.0;
static FrmImage _backgroundFrmImage; static FrmImage _backgroundFrmImage;
static FrmImage _townFrmImage; static FrmImage _townFrmImage;
@ -869,6 +870,9 @@ int wmWorldMap_init()
gTownMapHotkeysFix = true; gTownMapHotkeysFix = true;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_TOWN_MAP_HOTKEYS_FIX_KEY, &gTownMapHotkeysFix); configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_TOWN_MAP_HOTKEYS_FIX_KEY, &gTownMapHotkeysFix);
gCitiesLimitFix = true;
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITIES_LIMIT_FIX, &gCitiesLimitFix);
// CE: City size fids should be initialized during startup. They are used // CE: City size fids should be initialized during startup. They are used
// during |wmTeleportToArea| to calculate worldmap position when jumping // during |wmTeleportToArea| to calculate worldmap position when jumping
// from Temple to Arroyo - before giving a chance to |wmInterfaceInit| to // from Temple to Arroyo - before giving a chance to |wmInterfaceInit| to
@ -1158,9 +1162,7 @@ int wmWorldMap_load(File* stream)
int numCities; int numCities;
if (fileReadInt32(stream, &numCities) == -1) return -1; if (fileReadInt32(stream, &numCities) == -1) return -1;
bool isCitiesLimitFixEnabled = true; if (gCitiesLimitFix && numCities != wmMaxAreaNum) {
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITIES_LIMIT_FIX, &isCitiesLimitFixEnabled);
if (isCitiesLimitFixEnabled && numCities != wmMaxAreaNum) {
debugPrint("WorldMap Error: Cities limit fix is enabled, " debugPrint("WorldMap Error: Cities limit fix is enabled, "
"but the number of cities in the save file is different from " "but the number of cities in the save file is different from "
"the number of cities in the worldmap.txt file."); "the number of cities in the worldmap.txt file.");
@ -2539,10 +2541,7 @@ static int wmAreaInit()
configFree(&cfg); configFree(&cfg);
bool isCitiesLimitFixEnabled = true; if (!gCitiesLimitFix && wmMaxAreaNum != CITY_COUNT) {
configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITIES_LIMIT_FIX, &isCitiesLimitFixEnabled);
if (!isCitiesLimitFixEnabled && wmMaxAreaNum != CITY_COUNT) {
showMesageBox("\nwmAreaInit::Error loading Cities!"); showMesageBox("\nwmAreaInit::Error loading Cities!");
exit(1); exit(1);
} }