Codechange: Use EnumBitSet for TownActions. (#13542)

This commit is contained in:
Peter Nelson
2025-02-13 18:02:39 +00:00
committed by GitHub
parent b2c5712319
commit 7975145080
6 changed files with 91 additions and 82 deletions

View File

@@ -258,7 +258,7 @@
EnforceCompanyModeValid(false);
if (!IsValidTown(town_id)) return false;
return HasBit(::GetMaskOfTownActions(ScriptObject::GetCompany(), ::Town::Get(town_id)), town_action);
return ::GetMaskOfTownActions(ScriptObject::GetCompany(), ::Town::Get(town_id)).Test(::TownAction(town_action));
}
/* static */ bool ScriptTown::PerformTownAction(TownID town_id, TownAction town_action)
@@ -267,7 +267,7 @@
EnforcePrecondition(false, IsValidTown(town_id));
EnforcePrecondition(false, IsActionAvailable(town_id, town_action));
return ScriptObject::Command<CMD_DO_TOWN_ACTION>::Do(town_id, town_action);
return ScriptObject::Command<CMD_DO_TOWN_ACTION>::Do(town_id, ::TownAction(town_action));
}
/* static */ bool ScriptTown::ExpandTown(TownID town_id, SQInteger houses)