From db07e95f5b4d2972f24dfb18ce175d91848d4a4c Mon Sep 17 00:00:00 2001 From: Vasilii Rogin Date: Thu, 18 Apr 2024 23:10:56 +0300 Subject: [PATCH] Use gCitiesLimitFix variable --- src/worldmap.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/worldmap.cc b/src/worldmap.cc index a840354..f281dea 100644 --- a/src/worldmap.cc +++ b/src/worldmap.cc @@ -813,6 +813,7 @@ static int wmMaxEncBaseTypes; static int wmMaxEncounterInfoTables; static bool gTownMapHotkeysFix; +static bool gCitiesLimitFix; static double gGameTimeIncRemainder = 0.0; static FrmImage _backgroundFrmImage; static FrmImage _townFrmImage; @@ -869,6 +870,9 @@ int wmWorldMap_init() gTownMapHotkeysFix = true; 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 // during |wmTeleportToArea| to calculate worldmap position when jumping // from Temple to Arroyo - before giving a chance to |wmInterfaceInit| to @@ -1158,9 +1162,7 @@ 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) { + if (gCitiesLimitFix && 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."); @@ -2539,10 +2541,7 @@ static int wmAreaInit() configFree(&cfg); - bool isCitiesLimitFixEnabled = true; - configGetBool(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CITIES_LIMIT_FIX, &isCitiesLimitFixEnabled); - - if (!isCitiesLimitFixEnabled && wmMaxAreaNum != CITY_COUNT) { + if (!gCitiesLimitFix && wmMaxAreaNum != CITY_COUNT) { showMesageBox("\nwmAreaInit::Error loading Cities!"); exit(1); }