From 45d653b47dd1bf471a79a85a707dcee2246ac8fa Mon Sep 17 00:00:00 2001 From: captainurist <73941350+captainurist@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:35:00 +0900 Subject: [PATCH] More isPeasant usage --- src/Engine/Engine.cpp | 5 +---- src/Engine/Objects/MonsterEnums.h | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Engine/Engine.cpp b/src/Engine/Engine.cpp index 3768c251c427..ef3cc6e1b01d 100644 --- a/src/Engine/Engine.cpp +++ b/src/Engine/Engine.cpp @@ -997,10 +997,7 @@ void Engine::_461103_load_level_sub() { //{ // v3 = pActors[i].pMonsterInfo.uID; v17 = 0; - if (pActors[i].monsterInfo.uID >= MONSTER_PEASANT_DWARF_FEMALE_A_A && - pActors[i].monsterInfo.uID <= MONSTER_PEASANT_HUMAN2_FEMALE_C_C || - pActors[i].monsterInfo.uID >= MONSTER_PEASANT_GOBLIN_FEMALE_A_A && - pActors[i].monsterInfo.uID <= MONSTER_PEASANT_GOBLIN_MALE_C_C) + if (isPeasant(pActors[i].monsterInfo.uID)) v17 = 1; // v1 = 0; v4 = (std::to_underlying(pActors[i].monsterInfo.uID) - 1) % 3; // TODO(captainurist): encapsulate monster tier calculation. diff --git a/src/Engine/Objects/MonsterEnums.h b/src/Engine/Objects/MonsterEnums.h index b8e6ba103179..6110c3596c35 100644 --- a/src/Engine/Objects/MonsterEnums.h +++ b/src/Engine/Objects/MonsterEnums.h @@ -449,6 +449,10 @@ inline bool isPeasant(MonsterType monsterType) { (monsterType >= MONSTER_TYPE_FIRST_PEASANT_GOBLIN && monsterType <= MONSTER_TYPE_LAST_PEASANT_GOBLIN); } +inline bool isPeasant(MonsterId monsterId) { + return isPeasant(monsterTypeForMonsterId(monsterId)); +} + CharacterSex sexForMonsterType(MonsterType monsterType); Race raceForMonsterType(MonsterType monsterType);