mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Add isEntertainer method to Staff class, small cleanup
This commit is contained in:
@@ -273,7 +273,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
|
|
||||||
auto clipCoords = ScreenCoordsXY{ 10, 19 };
|
auto clipCoords = ScreenCoordsXY{ 10, 19 };
|
||||||
auto* staff = peep->As<Staff>();
|
auto* staff = peep->As<Staff>();
|
||||||
if (staff != nullptr && staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff != nullptr && staff->isEntertainer())
|
||||||
{
|
{
|
||||||
clipCoords.y += 3;
|
clipCoords.y += 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
if (auto* staff = peep->As<Staff>(); staff != nullptr)
|
if (auto* staff = peep->As<Staff>(); staff != nullptr)
|
||||||
{
|
{
|
||||||
spriteType = staff->AnimationGroup;
|
spriteType = staff->AnimationGroup;
|
||||||
if (staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff->isEntertainer())
|
||||||
{
|
{
|
||||||
clipCoords.y += 3;
|
clipCoords.y += 3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
if (staff == nullptr)
|
if (staff == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff->isEntertainer())
|
||||||
_availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer);
|
_availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer);
|
||||||
|
|
||||||
ViewportInit();
|
ViewportInit();
|
||||||
@@ -164,7 +164,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
if (staff == nullptr)
|
if (staff == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff->isEntertainer())
|
||||||
_availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer);
|
_availableCostumes = getAvailableCostumeStrings(AnimationPeepType::Entertainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -601,7 +601,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (staff->Is<Staff>() && staff->AssignedStaffType == StaffType::Entertainer)
|
if (staff->isEntertainer())
|
||||||
screenCoords.y++;
|
screenCoords.y++;
|
||||||
|
|
||||||
auto& objManager = GetContext()->GetObjectManager();
|
auto& objManager = GetContext()->GetObjectManager();
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto staffOrderIcon_x = nameColumnSize + 20;
|
auto staffOrderIcon_x = nameColumnSize + 20;
|
||||||
if (peep->AssignedStaffType != StaffType::Entertainer)
|
if (!peep->isEntertainer())
|
||||||
{
|
{
|
||||||
auto staffOrders = peep->StaffOrders;
|
auto staffOrders = peep->StaffOrders;
|
||||||
auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType());
|
auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType());
|
||||||
|
|||||||
@@ -1728,6 +1728,11 @@ bool Staff::IsMechanic() const
|
|||||||
return AssignedStaffType == StaffType::Mechanic;
|
return AssignedStaffType == StaffType::Mechanic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Staff::isEntertainer() const
|
||||||
|
{
|
||||||
|
return AssignedStaffType == StaffType::Entertainer;
|
||||||
|
}
|
||||||
|
|
||||||
void Staff::Update()
|
void Staff::Update()
|
||||||
{
|
{
|
||||||
if (PeepFlags & PEEP_FLAGS_POSITION_FROZEN)
|
if (PeepFlags & PEEP_FLAGS_POSITION_FROZEN)
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public:
|
|||||||
void Update();
|
void Update();
|
||||||
void Tick128UpdateStaff();
|
void Tick128UpdateStaff();
|
||||||
bool IsMechanic() const;
|
bool IsMechanic() const;
|
||||||
|
bool isEntertainer() const;
|
||||||
bool IsPatrolAreaSet(const CoordsXY& coords) const;
|
bool IsPatrolAreaSet(const CoordsXY& coords) const;
|
||||||
bool IsLocationInPatrol(const CoordsXY& loc) const;
|
bool IsLocationInPatrol(const CoordsXY& loc) const;
|
||||||
bool IsLocationOnPatrolEdge(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 CoordsXY& coords, bool value);
|
||||||
void SetPatrolArea(const MapRange& range, bool value);
|
void SetPatrolArea(const MapRange& range, bool value);
|
||||||
bool HasPatrolArea() const;
|
bool HasPatrolArea() const;
|
||||||
void SetPatrolArea(const std::vector<TileCoordsXY>& area);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdatePatrolling();
|
void UpdatePatrolling();
|
||||||
@@ -167,6 +167,5 @@ colour_t StaffGetColour(StaffType staffType);
|
|||||||
OpenRCT2::GameActions::Result StaffSetColour(StaffType staffType, colour_t value);
|
OpenRCT2::GameActions::Result StaffSetColour(StaffType staffType, colour_t value);
|
||||||
|
|
||||||
money64 GetStaffWage(StaffType type);
|
money64 GetStaffWage(StaffType type);
|
||||||
PeepAnimationGroup EntertainerCostumeToSprite(EntertainerCostume entertainerType);
|
|
||||||
|
|
||||||
const PatrolArea& GetMergedPatrolArea(const StaffType type);
|
const PatrolArea& GetMergedPatrolArea(const StaffType type);
|
||||||
|
|||||||
@@ -525,7 +525,7 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t&
|
|||||||
console.WriteLineError("Invalid staff ID");
|
console.WriteLineError("Invalid staff ID");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (staff->AssignedStaffType != StaffType::Entertainer)
|
if (!staff->isEntertainer())
|
||||||
{
|
{
|
||||||
console.WriteLineError("Specified staff is not entertainer");
|
console.WriteLineError("Specified staff is not entertainer");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace OpenRCT2::Scripting
|
|||||||
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Handyman);
|
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Handyman);
|
||||||
peep->AnimationGroup = PeepAnimationGroup::Normal;
|
peep->AnimationGroup = PeepAnimationGroup::Normal;
|
||||||
}
|
}
|
||||||
else if (value == "mechanic" && peep->AssignedStaffType != StaffType::Mechanic)
|
else if (value == "mechanic" && !peep->IsMechanic())
|
||||||
{
|
{
|
||||||
peep->AssignedStaffType = StaffType::Mechanic;
|
peep->AssignedStaffType = StaffType::Mechanic;
|
||||||
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Mechanic);
|
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Mechanic);
|
||||||
@@ -93,7 +93,7 @@ namespace OpenRCT2::Scripting
|
|||||||
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Security);
|
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Security);
|
||||||
peep->AnimationGroup = PeepAnimationGroup::Normal;
|
peep->AnimationGroup = PeepAnimationGroup::Normal;
|
||||||
}
|
}
|
||||||
else if (value == "entertainer" && peep->AssignedStaffType != StaffType::Entertainer)
|
else if (value == "entertainer" && !peep->isEntertainer())
|
||||||
{
|
{
|
||||||
peep->AssignedStaffType = StaffType::Entertainer;
|
peep->AssignedStaffType = StaffType::Entertainer;
|
||||||
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Entertainer);
|
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::Entertainer);
|
||||||
@@ -510,7 +510,7 @@ namespace OpenRCT2::Scripting
|
|||||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||||
auto* ctx = scriptEngine.GetContext();
|
auto* ctx = scriptEngine.GetContext();
|
||||||
auto peep = GetMechanic();
|
auto peep = GetMechanic();
|
||||||
if (peep != nullptr && peep->AssignedStaffType == StaffType::Mechanic)
|
if (peep != nullptr && peep->IsMechanic())
|
||||||
{
|
{
|
||||||
duk_push_uint(ctx, peep->StaffRidesFixed);
|
duk_push_uint(ctx, peep->StaffRidesFixed);
|
||||||
}
|
}
|
||||||
@@ -526,7 +526,7 @@ namespace OpenRCT2::Scripting
|
|||||||
auto& scriptEngine = GetContext()->GetScriptEngine();
|
auto& scriptEngine = GetContext()->GetScriptEngine();
|
||||||
auto* ctx = scriptEngine.GetContext();
|
auto* ctx = scriptEngine.GetContext();
|
||||||
auto peep = GetMechanic();
|
auto peep = GetMechanic();
|
||||||
if (peep != nullptr && peep->AssignedStaffType == StaffType::Mechanic)
|
if (peep != nullptr && peep->IsMechanic())
|
||||||
{
|
{
|
||||||
duk_push_uint(ctx, peep->StaffRidesInspected);
|
duk_push_uint(ctx, peep->StaffRidesInspected);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user