diff --git a/src/openrct2-ui/windows/GameBottomToolbar.cpp b/src/openrct2-ui/windows/GameBottomToolbar.cpp index e24b98ee60..abf9833d25 100644 --- a/src/openrct2-ui/windows/GameBottomToolbar.cpp +++ b/src/openrct2-ui/windows/GameBottomToolbar.cpp @@ -273,7 +273,7 @@ namespace OpenRCT2::Ui::Windows auto clipCoords = ScreenCoordsXY{ 10, 19 }; auto* staff = peep->As(); - if (staff != nullptr && staff->AssignedStaffType == StaffType::Entertainer) + if (staff != nullptr && staff->isEntertainer()) { clipCoords.y += 3; } diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index 01afacf364..b6d155a1c2 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -518,7 +518,7 @@ namespace OpenRCT2::Ui::Windows if (auto* staff = peep->As(); staff != nullptr) { spriteType = staff->AnimationGroup; - if (staff->AssignedStaffType == StaffType::Entertainer) + if (staff->isEntertainer()) { clipCoords.y += 3; } diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index cc0b80491b..03351fd131 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -142,7 +142,7 @@ namespace OpenRCT2::Ui::Windows if (staff == nullptr) return; - if (staff->AssignedStaffType == StaffType::Entertainer) + if (staff->isEntertainer()) _availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer); ViewportInit(); @@ -164,7 +164,7 @@ namespace OpenRCT2::Ui::Windows if (staff == nullptr) return; - if (staff->AssignedStaffType == StaffType::Entertainer) + if (staff->isEntertainer()) _availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer); } @@ -601,7 +601,7 @@ namespace OpenRCT2::Ui::Windows return; } - if (staff->Is() && staff->AssignedStaffType == StaffType::Entertainer) + if (staff->isEntertainer()) screenCoords.y++; auto& objManager = GetContext()->GetObjectManager(); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 23cb4871a9..2998ed4a53 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -422,7 +422,7 @@ namespace OpenRCT2::Ui::Windows } auto staffOrderIcon_x = nameColumnSize + 20; - if (peep->AssignedStaffType != StaffType::Entertainer) + if (!peep->isEntertainer()) { auto staffOrders = peep->StaffOrders; auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType()); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 7415989291..85d5a9d3d3 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -1728,6 +1728,11 @@ bool Staff::IsMechanic() const return AssignedStaffType == StaffType::Mechanic; } +bool Staff::isEntertainer() const +{ + return AssignedStaffType == StaffType::Entertainer; +} + void Staff::Update() { if (PeepFlags & PEEP_FLAGS_POSITION_FROZEN) diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 3e031bb196..547e1e84d8 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -69,6 +69,7 @@ public: void Update(); void Tick128UpdateStaff(); bool IsMechanic() const; + bool isEntertainer() const; bool IsPatrolAreaSet(const CoordsXY& coords) const; bool IsLocationInPatrol(const CoordsXY& loc) const; bool IsLocationOnPatrolEdge(const CoordsXY& loc) const; @@ -85,7 +86,6 @@ public: void SetPatrolArea(const CoordsXY& coords, bool value); void SetPatrolArea(const MapRange& range, bool value); bool HasPatrolArea() const; - void SetPatrolArea(const std::vector& area); private: void UpdatePatrolling(); @@ -167,6 +167,5 @@ colour_t StaffGetColour(StaffType staffType); OpenRCT2::GameActions::Result StaffSetColour(StaffType staffType, colour_t value); money64 GetStaffWage(StaffType type); -PeepAnimationGroup EntertainerCostumeToSprite(EntertainerCostume entertainerType); const PatrolArea& GetMergedPatrolArea(const StaffType type); diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index c2e2b4f648..d39ef02078 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -525,7 +525,7 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t& console.WriteLineError("Invalid staff ID"); return; } - if (staff->AssignedStaffType != StaffType::Entertainer) + if (!staff->isEntertainer()) { console.WriteLineError("Specified staff is not entertainer"); return; diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.cpp b/src/openrct2/scripting/bindings/entity/ScStaff.cpp index 5f4a2902b8..a600ceb792 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.cpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.cpp @@ -81,7 +81,7 @@ namespace OpenRCT2::Scripting peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Handyman); peep->AnimationGroup = PeepAnimationGroup::Normal; } - else if (value == "mechanic" && peep->AssignedStaffType != StaffType::Mechanic) + else if (value == "mechanic" && !peep->IsMechanic()) { peep->AssignedStaffType = StaffType::Mechanic; peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Mechanic); @@ -93,7 +93,7 @@ namespace OpenRCT2::Scripting peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Security); peep->AnimationGroup = PeepAnimationGroup::Normal; } - else if (value == "entertainer" && peep->AssignedStaffType != StaffType::Entertainer) + else if (value == "entertainer" && !peep->isEntertainer()) { peep->AssignedStaffType = StaffType::Entertainer; peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Entertainer); @@ -510,7 +510,7 @@ namespace OpenRCT2::Scripting auto& scriptEngine = GetContext()->GetScriptEngine(); auto* ctx = scriptEngine.GetContext(); auto peep = GetMechanic(); - if (peep != nullptr && peep->AssignedStaffType == StaffType::Mechanic) + if (peep != nullptr && peep->IsMechanic()) { duk_push_uint(ctx, peep->StaffRidesFixed); } @@ -526,7 +526,7 @@ namespace OpenRCT2::Scripting auto& scriptEngine = GetContext()->GetScriptEngine(); auto* ctx = scriptEngine.GetContext(); auto peep = GetMechanic(); - if (peep != nullptr && peep->AssignedStaffType == StaffType::Mechanic) + if (peep != nullptr && peep->IsMechanic()) { duk_push_uint(ctx, peep->StaffRidesInspected); }