From f5a8fbb5a89a4bd7749f1b7f5cec42e535f7d249 Mon Sep 17 00:00:00 2001 From: Gynt Date: Fri, 4 Dec 2026 17:09:48 +0100 Subject: [PATCH 1/6] build: compile processFoodConsumption, updateSection1034Info and its callees with /GL processFoodConsumption: the original keeps this in edx across the call to updateFoodTypesInStockForAllPlayers (already /GL on main); 96.5% without the entry. updateSection1034Info with hasAdjacentCellWithField24Or25, isAttackStagingCandidateCell and floodFillZoneProximityFromCell (those three .cpp files come with #549): LTCG has to see the callees, 70.9% without them. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- cmake/compiler-flags-gl.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/compiler-flags-gl.txt b/cmake/compiler-flags-gl.txt index cc2e343848..1c2844ac57 100644 --- a/cmake/compiler-flags-gl.txt +++ b/cmake/compiler-flags-gl.txt @@ -20,6 +20,7 @@ src/OpenSHC/Input/MouseState/updateRightDragCameraControl.cpp src/OpenSHC/Text/FontSizeClass/setupFontSizeClassObject.cpp src/OpenSHC/Text/TextManager/setupFontSizeClassObjects.cpp src/OpenSHC/Game/GameStateStructures/updateFoodTypesInStockForAllPlayers.cpp +src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp src/OpenSHC/Game/GameStateStructures/clearEnemyRelatedStructures.cpp src/OpenSHC/Game/GameStateStructures/fillWith0xFF.cpp src/OpenSHC/Game/GameStateStructures/computeSignPostEntryData.cpp @@ -280,6 +281,10 @@ src/OpenSHC/Map/Units/UpdateMinerIronFetcher.cpp src/OpenSHC/Map/Units/UpdateWorker_ConsiderTakingABreakUnk.cpp src/OpenSHC/Map/Units/UnitsState/isWorkplaceBuildingOnAdjacentTile.cpp src/OpenSHC/Map/Units/ConsiderHavingABreakNowUnk.cpp +src/OpenSHC/Map/WildlifeState/hasAdjacentCellWithField24Or25.cpp +src/OpenSHC/Map/WildlifeState/isAttackStagingCandidateCell.cpp +src/OpenSHC/Map/WildlifeState/floodFillZoneProximityFromCell.cpp +src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp src/OpenSHC/Map/Units/UnitsState/acquireShootTarget.cpp src/OpenSHC/Map/Units/UnitsState/calculateUnitMovementSpeed.cpp src/OpenSHC/Map/Units/UnitsState/chooseHusbandAndWife.cpp From eefcf7216ec323133e0906f77319fdc706d8bb7b Mon Sep 17 00:00:00 2001 From: Gynt Date: Fri, 4 Dec 2026 17:09:49 +0100 Subject: [PATCH 2/6] reimplement: SHC_3BB0A8C1_0x0052E020 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- .../WildlifeState/updateSection1034Info.cpp | 46 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp diff --git a/src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp b/src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp new file mode 100644 index 0000000000..8ddc47689d --- /dev/null +++ b/src/OpenSHC/Map/WildlifeState/updateSection1034Info.cpp @@ -0,0 +1,46 @@ +#include "../WildlifeState.func.hpp" + +#include "OpenSHC/Game/GameMode.hpp" + +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" + +namespace OpenSHC { +namespace Map { + + // FUNCTION: STRONGHOLDCRUSADER 0x0052E020 + void WildlifeState::updateSection1034Info() + { + if (DAT_GameSynchronyState::instance.currentGameMode != Game::GM_SOLITARY) { + return; + } + for (int pass = 0; pass < 20; pass = *(int volatile*)&pass + 1) { + for (int y = 0; y < countof(this->grid[0]); y++) { + for (int x = 0; x < countof(this->grid); x++) { + this->grid[x][y].unknownNonZero01 = 0; + this->grid[x][y].field_0x6c = 0; + if (this->grid[x][y].castlebuildings != 0 + && MACRO_CALL_MEMBER(Map::WildlifeState_Func::hasAdjacentCellWithField24Or25, this)(x, y)) { + this->grid[x][y].field_0x64++; + } + } + } + } + for (int y = 0; y < countof(this->grid[0]); y++) { + for (int x = 0; x < countof(this->grid); x++) { + if (this->grid[x][y].field_0x60 != 0 || this->grid[x][y].field_0x64 != 0) { + MACRO_CALL_MEMBER(Map::WildlifeState_Func::floodFillZoneProximityFromCell, this)(x, y, 6); + } + } + } + for (int y = 0; y < countof(this->grid[0]); y++) { + for (int x = 0; x < countof(this->grid); x++) { + if (this->grid[x][y].unknownNonZero01 == 0 + && MACRO_CALL_MEMBER(Map::WildlifeState_Func::isAttackStagingCandidateCell, this)(x, y)) { + this->grid[x][y].field_0x6c++; + } + } + } + } + +} // namespace Map +} // namespace OpenSHC diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index b31ea5fc2b..349182ff30 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -49297,7 +49297,7 @@ SHC_3BB0A8C1_0x0052DF50 | 0.0% | Pending SHC_3BB0A8C1_0x0052DF60 | 0.0% | Pending -SHC_3BB0A8C1_0x0052E020 | 0.0% | Pending +SHC_3BB0A8C1_0x0052E020 | 100.0% | Reimplemented SHC_3BB0A8C1_0x0052E120 | 0.0% | Pending From 603a284813be0f7b63f067a106d57f7f1117c227 Mon Sep 17 00:00:00 2001 From: Gynt Date: Fri, 4 Dec 2026 17:09:49 +0100 Subject: [PATCH 3/6] reimplement: SHC_3BB0A8C1_0x00458AD0 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- .../processFoodConsumption.cpp | 155 ++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp diff --git a/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp new file mode 100644 index 0000000000..b4131a41eb --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp @@ -0,0 +1,155 @@ +#include "../GameStateStructures.func.hpp" + +#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp" +#include "OpenSHC/Audio/SFX/SFXState.func.hpp" +#include "OpenSHC/Map/Buildings/BuildingsState.func.hpp" +#include "OpenSHC/Synchrony/GameSynchronyState.func.hpp" +#include "OpenSHC/Game/GameMode.hpp" +#include "OpenSHC/Game/GameMode2.hpp" +#include "OpenSHC/Game/Player/Enums/BuildingEntryInfoEnum.hpp" +#include "OpenSHC/Game/Resources/ResourceType.hpp" +#include "OpenSHC/Map/MapType2.hpp" +#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" +#include "OpenSHC/string-literals.hpp" + +#include "OpenSHC/Globals/DAT_BuildingsState.hpp" +#include "OpenSHC/Globals/DAT_CounterFoodWarningInterval.hpp" +#include "OpenSHC/Globals/DAT_GameCore.hpp" +#include "OpenSHC/Globals/DAT_GameState.hpp" +#include "OpenSHC/Globals/DAT_GameSynchronyState.hpp" +#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp" +#include "OpenSHC/Globals/DAT_SFXState.hpp" +#include "OpenSHC/Globals/DAT_SoundSystemState.hpp" + +namespace OpenSHC { +namespace Game { + +#define PLAYER_FIELD(type, field) \ + (*(type*)((char*)foodClockSpeed + offsetof(PlayerData, field) - offsetof(PlayerData, foodClockSpeed))) + + // FUNCTION: STRONGHOLDCRUSADER 0x00458AD0 + void GameStateStructures::processFoodConsumption() + { + if (DAT_GameCore::instance.gameMode_2 == GM_EDITOR) { + return; + } + if (DAT_GameCore::instance.gameMode_2 == GM_SIEGE_THAT) { + return; + } + if (DAT_GameCore::instance.gameMode_2 == GM_BUILDERUnk + && DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == Map::MT_SIEGE) { + return; + } + MACRO_CALL_MEMBER(GameStateStructures_Func::updateFoodTypesInStockForAllPlayers, this)(); + int playerID = 1; + int* foodClockSpeed = &this->playerDataArray[1].foodClockSpeed; + for (; playerID < countof(this->playerDataArray); + ++playerID, foodClockSpeed += sizeof(PlayerData) / sizeof(int)) { + if (PLAYER_FIELD(int, buildingEntryInfos[Player::Enums::BEIE_KEEP].id) <= 0 + || PLAYER_FIELD(int, buildingEntryInfos[Player::Enums::BEIE_CAMPGROUND].id) <= 0) { + continue; + } + PLAYER_FIELD(int, foodStorageLevel) = -1; + if (PLAYER_FIELD(int, foodTypesInStock) <= 0) { + PLAYER_FIELD(int, foodTypesCurrentlyEaten) = 0; + continue; + } + int const clockSpeed = PLAYER_FIELD(int, currentPopulation) * 3; + PLAYER_FIELD(int, foodClockSpeed) = clockSpeed; + if (DAT_GameSynchronyState::instance.currentGameMode != GM_SOLITARY + && MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::isAIPlayer, DAT_GameSynchronyState::ptr)( + playerID)) { + PLAYER_FIELD(int, foodClockSpeed) = (clockSpeed * 60) / 100; + } + switch (PLAYER_FIELD(int, rationsSetting)) { + case 0: + PLAYER_FIELD(int, foodClockSpeed) = 0; + PLAYER_FIELD(int, foodTypesCurrentlyEaten) = 0; + break; + case 1: + PLAYER_FIELD(int, foodClockSpeed) = PLAYER_FIELD(int, foodClockSpeed) / 2; + break; + case 3: + PLAYER_FIELD(int, foodClockSpeed) = (PLAYER_FIELD(int, foodClockSpeed) * 3) / 2; + break; + case 4: + PLAYER_FIELD(int, foodClockSpeed) = PLAYER_FIELD(int, foodClockSpeed) * 2; + } + if (PLAYER_FIELD(int, foodClockSpeed) != 0) { + PLAYER_FIELD(int, foodStorageLevel) + = ((15000 / PLAYER_FIELD(int, foodClockSpeed)) * PLAYER_FIELD(int, totalFood)) / 800; + } + if (DAT_GameState::instance.mapAndTime.monthChanged != 0) { + short const leftover = (short)PLAYER_FIELD(int, foodStorageLevel); + PLAYER_FIELD(short, foodStorageLevelLastLastMonth) = PLAYER_FIELD(short, foodStorageLevelLastMonth); + PLAYER_FIELD(short, foodStorageLevelLastMonth) = leftover; + if (playerID == DAT_GameSynchronyState::instance.currentPlayerSlotID + && DAT_GameState::instance.mapAndTime.singlePlayerHasKeepAndGranary) { + if (PLAYER_FIELD(int, totalFood) == 0) { + if (DAT_CounterFoodWarningInterval::instance == 0 + && !MACRO_CALL_MEMBER( + Audio::MSS::SoundSystem_Func::shouldSoundXNotBePlaying, DAT_SoundSystemState::ptr)()) { + // "No food distributed this month" + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)( + s_food_warning4_wav_005a509c); + } + ++DAT_CounterFoodWarningInterval::instance; + if (DAT_CounterFoodWarningInterval::instance > 2) { + DAT_CounterFoodWarningInterval::instance = 0; + } + } else if (leftover < 2 && leftover != PLAYER_FIELD(short, foodStorageLevelLastLastMonth) + && PLAYER_FIELD(int, rationsSetting) != 0) { + if (leftover == 1) { + if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::shouldSoundXNotBePlaying, + DAT_SoundSystemState::ptr)()) { + // "Granary stocks are very low sire" + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)( + s_food_warning2_wav_005a5088); + } + } else if (!MACRO_CALL_MEMBER(Audio::MSS::SoundSystem_Func::shouldSoundXNotBePlaying, + DAT_SoundSystemState::ptr)()) { + // "We are almost out of food sire" + MACRO_CALL_MEMBER(Audio::SFX::SFXState_Func::playWAVSFX, DAT_SFXState::ptr)( + s_food_warning3_wav_005a5074); + } + } + } + } + PLAYER_FIELD(int, foodClock) += PLAYER_FIELD(int, foodClockSpeed); + if (PLAYER_FIELD(int, foodClock) > 15000) { + PLAYER_FIELD(int, foodClock) = 0; + PLAYER_FIELD(int, foodTypesCurrentlyEaten) = PLAYER_FIELD(int, foodTypesInStock); + for (;;) { + ++PLAYER_FIELD(int, foodTypeToBeEatenNext); + if (PLAYER_FIELD(int, foodTypeToBeEatenNext) > 3) { + PLAYER_FIELD(int, foodTypeToBeEatenNext) = 0; + } + if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 0 && PLAYER_FIELD(int, breadCount) > 0) { + MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, + DAT_BuildingsState::ptr)(playerID, Resources::RT_BREAD, 1, 0); + break; + } + if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 1 && PLAYER_FIELD(int, cheeseCount) > 0) { + MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, + DAT_BuildingsState::ptr)(playerID, Resources::RT_CHEESE, 1, 0); + break; + } + if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 2 && PLAYER_FIELD(int, meatCount) > 0) { + MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, + DAT_BuildingsState::ptr)(playerID, Resources::RT_MEAT, 1, 0); + break; + } + if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 3 && PLAYER_FIELD(int, appleCount) > 0) { + MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, + DAT_BuildingsState::ptr)(playerID, Resources::RT_APPLE, 1, 0); + break; + } + } + } + } + } + +#undef PLAYER_FIELD + +} // namespace Game +} // namespace OpenSHC diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 349182ff30..1217f75d89 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -17733,7 +17733,7 @@ SHC_3BB0A8C1_0x00458A70 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00458A80 | 0.0% | Pending -SHC_3BB0A8C1_0x00458AD0 | 0.0% | Pending +SHC_3BB0A8C1_0x00458AD0 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00458D38 | 0.0% | Pending From 332ee1b966b54951301b74330c7b9fb952ee6020 Mon Sep 17 00:00:00 2001 From: Gynt Date: Fri, 4 Dec 2026 17:09:50 +0100 Subject: [PATCH 4/6] reimplement: SHC_3BB0A8C1_0x00458E60 100.00% Reimplemented Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- .../GameStateStructures/updateCrowding.cpp | 35 +++++++++++++++++++ status/addresses-SHC-3BB0A8C1.txt | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/OpenSHC/Game/GameStateStructures/updateCrowding.cpp diff --git a/src/OpenSHC/Game/GameStateStructures/updateCrowding.cpp b/src/OpenSHC/Game/GameStateStructures/updateCrowding.cpp new file mode 100644 index 0000000000..99ab672aa0 --- /dev/null +++ b/src/OpenSHC/Game/GameStateStructures/updateCrowding.cpp @@ -0,0 +1,35 @@ +#include "../GameStateStructures.func.hpp" + +namespace OpenSHC { +namespace Game { + +#define PLAYER_FIELD(type, field) \ + (*(type*)((char*)currentPopulation + offsetof(PlayerData, field) - offsetof(PlayerData, currentPopulation))) + + // FUNCTION: STRONGHOLDCRUSADER 0x00458E60 + void GameStateStructures::updateCrowding() + { + int* currentPopulation = &this->playerDataArray[1].currentPopulation; + for (int playerID = 1; playerID != countof(this->playerDataArray); ++playerID) { + int const populationCap = PLAYER_FIELD(int, populationCap); + int const population = PLAYER_FIELD(int, currentPopulation); + if (population <= populationCap) { + PLAYER_FIELD(int, crowding) = 0; + currentPopulation += sizeof(PlayerData) / sizeof(int); + continue; + } + if (population <= 0) { + PLAYER_FIELD(int, crowding) = 0; + } else if (populationCap <= 0) { + PLAYER_FIELD(int, crowding) = 150; + } else { + PLAYER_FIELD(int, crowding) = (population * 100) / populationCap; + } + currentPopulation += sizeof(PlayerData) / sizeof(int); + } + } + +#undef PLAYER_FIELD + +} // namespace Game +} // namespace OpenSHC diff --git a/status/addresses-SHC-3BB0A8C1.txt b/status/addresses-SHC-3BB0A8C1.txt index 1217f75d89..9308e1a145 100644 --- a/status/addresses-SHC-3BB0A8C1.txt +++ b/status/addresses-SHC-3BB0A8C1.txt @@ -17749,7 +17749,7 @@ SHC_3BB0A8C1_0x00458D50 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00458E20 | 100.0% | Reimplemented -SHC_3BB0A8C1_0x00458E60 | 0.0% | Pending +SHC_3BB0A8C1_0x00458E60 | 100.0% | Reimplemented SHC_3BB0A8C1_0x00458EC0 | 100.0% | Reimplemented From 8ad6d165e21768039a9a2ded4c0aee97c84b6d28 Mon Sep 17 00:00:00 2001 From: Gynt Date: Sat, 5 Dec 2026 00:55:37 +0100 Subject: [PATCH 5/6] review: drop redundant casts The removed cast was checked on its own: the file's /FA listing is identical without it and no new warning appears. The volatile and macro forms stay. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp index b4131a41eb..6b8ef9b36e 100644 --- a/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp +++ b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp @@ -80,7 +80,7 @@ namespace Game { = ((15000 / PLAYER_FIELD(int, foodClockSpeed)) * PLAYER_FIELD(int, totalFood)) / 800; } if (DAT_GameState::instance.mapAndTime.monthChanged != 0) { - short const leftover = (short)PLAYER_FIELD(int, foodStorageLevel); + short const leftover = PLAYER_FIELD(int, foodStorageLevel); PLAYER_FIELD(short, foodStorageLevelLastLastMonth) = PLAYER_FIELD(short, foodStorageLevelLastMonth); PLAYER_FIELD(short, foodStorageLevelLastMonth) = leftover; if (playerID == DAT_GameSynchronyState::instance.currentPlayerSlotID From 29427b47ad1fe05a5fb7ab3a4f798375322f3c0b Mon Sep 17 00:00:00 2001 From: Gynt Date: Sat, 5 Dec 2026 01:37:34 +0100 Subject: [PATCH 6/6] review: use FoodTypeEnum for foodTypeToBeEatenNext in processFoodConsumption Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01XmXCmXCVBvESeaU1djQFjp --- .../processFoodConsumption.cpp | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp index 6b8ef9b36e..94fbd6e3b6 100644 --- a/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp +++ b/src/OpenSHC/Game/GameStateStructures/processFoodConsumption.cpp @@ -7,6 +7,8 @@ #include "OpenSHC/Game/GameMode.hpp" #include "OpenSHC/Game/GameMode2.hpp" #include "OpenSHC/Game/Player/Enums/BuildingEntryInfoEnum.hpp" +#include "OpenSHC/Game/Resources/FoodTypeEnum.hpp" +#include "OpenSHC/Game/Resources/FoodTypeEnumInt.hpp" #include "OpenSHC/Game/Resources/ResourceType.hpp" #include "OpenSHC/Map/MapType2.hpp" #include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp" @@ -120,26 +122,30 @@ namespace Game { PLAYER_FIELD(int, foodClock) = 0; PLAYER_FIELD(int, foodTypesCurrentlyEaten) = PLAYER_FIELD(int, foodTypesInStock); for (;;) { - ++PLAYER_FIELD(int, foodTypeToBeEatenNext); - if (PLAYER_FIELD(int, foodTypeToBeEatenNext) > 3) { - PLAYER_FIELD(int, foodTypeToBeEatenNext) = 0; + ++PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext); + if (PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) > Resources::FTE_APPLE) { + PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) = Resources::FTE_BREAD; } - if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 0 && PLAYER_FIELD(int, breadCount) > 0) { + if (PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) == Resources::FTE_BREAD + && PLAYER_FIELD(int, breadCount) > 0) { MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, DAT_BuildingsState::ptr)(playerID, Resources::RT_BREAD, 1, 0); break; } - if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 1 && PLAYER_FIELD(int, cheeseCount) > 0) { + if (PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) == Resources::FTE_CHEESE + && PLAYER_FIELD(int, cheeseCount) > 0) { MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, DAT_BuildingsState::ptr)(playerID, Resources::RT_CHEESE, 1, 0); break; } - if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 2 && PLAYER_FIELD(int, meatCount) > 0) { + if (PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) == Resources::FTE_MEAT + && PLAYER_FIELD(int, meatCount) > 0) { MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, DAT_BuildingsState::ptr)(playerID, Resources::RT_MEAT, 1, 0); break; } - if (PLAYER_FIELD(int, foodTypeToBeEatenNext) == 3 && PLAYER_FIELD(int, appleCount) > 0) { + if (PLAYER_FIELD(Resources::FoodTypeEnumInt, foodTypeToBeEatenNext) == Resources::FTE_APPLE + && PLAYER_FIELD(int, appleCount) > 0) { MACRO_CALL_MEMBER(Map::Buildings::BuildingsState_Func::processResourceLoss, DAT_BuildingsState::ptr)(playerID, Resources::RT_APPLE, 1, 0); break;