Rename Staff entity members (#26603)

* Rename Staff entity member fields

* Rename Staff entity methods for consistency

* Remove unused EntertainerCostume enum class
This commit is contained in:
mgiannopoulos24 authored and GitHub committed 2026-05-28 12:28:45 +02:00
1 parent 6685f73c5f
commit d85835a0a0
29 files changed
+418 -435

No files matched your search

+1 -1
View File
@@ -204,7 +204,7 @@ namespace OpenRCT2::Ui::Windows
auto staff = getGameState().entities.GetEntity<Staff>(_staffId);
if (staff != nullptr)
{
_mode = staff->IsPatrolAreaSet(*mapTile) ? GameActions::StaffSetPatrolAreaMode::unset
_mode = staff->isPatrolAreaSet(*mapTile) ? GameActions::StaffSetPatrolAreaMode::unset
: GameActions::StaffSetPatrolAreaMode::set;
}
}
+2 -2
View File
@@ -4134,7 +4134,7 @@ namespace OpenRCT2::Ui::Windows
for (auto peep : EntityList<Staff>())
{
if (peep->IsMechanic())
if (peep->isMechanic())
{
stringId = STR_CALLING_MECHANIC;
break;
@@ -4163,7 +4163,7 @@ namespace OpenRCT2::Ui::Windows
else
{
auto staff = getGameState().entities.GetEntity<Staff>(ride->mechanic);
if (staff != nullptr && staff->IsMechanic())
if (staff != nullptr && staff->isMechanic())
{
ft = Formatter();
staff->FormatNameTo(ft);
+15 -15
View File
@@ -447,7 +447,7 @@ namespace OpenRCT2::Ui::Windows
}
// Disable clear patrol area if no area is set.
if (!staff->HasPatrolArea())
if (!staff->hasPatrolArea())
{
gDropdown.items[1].setDisabled(true);
}
@@ -832,7 +832,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
switch (staff->AssignedStaffType)
switch (staff->assignedStaffType)
{
case StaffType::entertainer:
{
@@ -906,7 +906,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
uint32_t staffOrders = staff->StaffOrders;
uint32_t staffOrders = staff->staffOrders;
for (auto index = Numerics::bitScanForward(staffOrders); index != -1; index = Numerics::bitScanForward(staffOrders))
{
staffOrders &= ~(1 << index);
@@ -940,51 +940,51 @@ namespace OpenRCT2::Ui::Windows
if (!(getGameState().park.flags & PARK_FLAGS_NO_MONEY))
{
auto ft = Formatter();
ft.Add<money64>(GetStaffWage(staff->AssignedStaffType));
ft.Add<money64>(GetStaffWage(staff->assignedStaffType));
drawText(rt, screenCoords, STR_STAFF_STAT_WAGES, ft);
screenCoords.y += kListRowHeight;
}
auto ft = Formatter();
ft.Add<int32_t>(staff->GetHireDate());
ft.Add<int32_t>(staff->getHireDate());
drawText(rt, screenCoords, STR_STAFF_STAT_EMPLOYED_FOR, ft);
screenCoords.y += kListRowHeight;
switch (staff->AssignedStaffType)
switch (staff->assignedStaffType)
{
case StaffType::handyman:
ft = Formatter();
ft.Add<uint32_t>(staff->StaffLawnsMown);
ft.Add<uint32_t>(staff->staffLawnsMown);
drawText(rt, screenCoords, STR_STAFF_STAT_LAWNS_MOWN, ft);
screenCoords.y += kListRowHeight;
ft = Formatter();
ft.Add<uint32_t>(staff->StaffGardensWatered);
ft.Add<uint32_t>(staff->staffGardensWatered);
drawText(rt, screenCoords, STR_STAFF_STAT_GARDENS_WATERED, ft);
screenCoords.y += kListRowHeight;
ft = Formatter();
ft.Add<uint32_t>(staff->StaffLitterSwept);
ft.Add<uint32_t>(staff->staffLitterSwept);
drawText(rt, screenCoords, STR_STAFF_STAT_LITTER_SWEPT, ft);
screenCoords.y += kListRowHeight;
ft = Formatter();
ft.Add<uint32_t>(staff->StaffBinsEmptied);
ft.Add<uint32_t>(staff->staffBinsEmptied);
drawText(rt, screenCoords, STR_STAFF_STAT_BINS_EMPTIED, ft);
break;
case StaffType::mechanic:
ft = Formatter();
ft.Add<uint32_t>(staff->StaffRidesInspected);
ft.Add<uint32_t>(staff->staffRidesInspected);
drawText(rt, screenCoords, STR_STAFF_STAT_RIDES_INSPECTED, ft);
screenCoords.y += kListRowHeight;
ft = Formatter();
ft.Add<uint32_t>(staff->StaffRidesFixed);
ft.Add<uint32_t>(staff->staffRidesFixed);
drawText(rt, screenCoords, STR_STAFF_STAT_RIDES_FIXED, ft);
break;
case StaffType::security:
ft = Formatter();
ft.Add<uint32_t>(staff->StaffVandalsStopped);
ft.Add<uint32_t>(staff->staffVandalsStopped);
drawText(rt, screenCoords, STR_STAFF_STAT_VANDALS_STOPPED, ft);
break;
case StaffType::entertainer:
@@ -1033,7 +1033,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetDisabled(widgetIndex, false);
}
if (staff->AssignedStaffType == StaffType::security)
if (staff->assignedStaffType == StaffType::security)
{
setWidgetDisabled(WIDX_TAB_2, true);
}
@@ -1107,7 +1107,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
uint8_t newOrders = staff->StaffOrders ^ (1 << orderId);
uint8_t newOrders = staff->staffOrders ^ (1 << orderId);
auto staffSetOrdersAction = GameActions::StaffSetOrdersAction(EntityId::FromUnderlying(number), newOrders);
GameActions::Execute(&staffSetOrdersAction, getGameState());
}
+7 -7
View File
@@ -192,7 +192,7 @@ namespace OpenRCT2::Ui::Windows
for (auto peep : EntityList<Staff>())
{
getGameState().entities.EntitySetFlashing(peep, false);
if (peep->AssignedStaffType == GetSelectedStaffType())
if (peep->assignedStaffType == GetSelectedStaffType())
{
getGameState().entities.EntitySetFlashing(peep, true);
}
@@ -421,7 +421,7 @@ namespace OpenRCT2::Ui::Windows
drawTextEllipsised(rt, { actionOffset, y }, actionColumnSize, format, ft);
// True if a patrol path is set for the worker
if (peep->HasPatrolArea())
if (peep->hasPatrolArea())
{
GfxDrawSprite(rt, ImageId(SPR_STAFF_PATROL_PATH), { nameColumnSize + 5, y });
}
@@ -429,7 +429,7 @@ namespace OpenRCT2::Ui::Windows
auto staffOrderIcon_x = nameColumnSize + 20;
if (!peep->isEntertainer())
{
auto staffOrders = peep->StaffOrders;
auto staffOrders = peep->staffOrders;
auto staffOrderSprite = GetStaffOrderBaseSprite(GetSelectedStaffType());
while (staffOrders != 0)
@@ -493,7 +493,7 @@ namespace OpenRCT2::Ui::Windows
for (auto* peep : EntityList<Staff>())
{
getGameState().entities.EntitySetFlashing(peep, false);
if (peep->AssignedStaffType == GetSelectedStaffType())
if (peep->assignedStaffType == GetSelectedStaffType())
{
getGameState().entities.EntitySetFlashing(peep, true);
@@ -666,16 +666,16 @@ namespace OpenRCT2::Ui::Windows
auto closestPeepDistance = std::numeric_limits<int32_t>::max();
for (auto peep : EntityList<Staff>())
{
if (peep->AssignedStaffType != GetSelectedStaffType())
if (peep->assignedStaffType != GetSelectedStaffType())
continue;
if (isPatrolAreaSet)
{
if (!peep->HasPatrolArea())
if (!peep->hasPatrolArea())
{
continue;
}
if (!peep->IsLocationInPatrol(footpathCoords))
if (!peep->isLocationInPatrol(footpathCoords))
{
continue;
}
+9 -9
View File
@@ -315,15 +315,15 @@ struct GameStateSnapshots final : public IGameStateSnapshots
{
CompareSpriteDataPeep(spriteBase, spriteCmp, changeData);
COMPARE_FIELD(Staff, AssignedStaffType);
COMPARE_FIELD(Staff, MechanicTimeSinceCall);
COMPARE_FIELD(Staff, HireDate);
COMPARE_FIELD(Staff, StaffOrders);
COMPARE_FIELD(Staff, StaffMowingTimeout);
COMPARE_FIELD(Staff, StaffRidesFixed);
COMPARE_FIELD(Staff, StaffRidesInspected);
COMPARE_FIELD(Staff, StaffLitterSwept);
COMPARE_FIELD(Staff, StaffBinsEmptied);
COMPARE_FIELD(Staff, assignedStaffType);
COMPARE_FIELD(Staff, mechanicTimeSinceCall);
COMPARE_FIELD(Staff, hireDate);
COMPARE_FIELD(Staff, staffOrders);
COMPARE_FIELD(Staff, staffMowingTimeout);
COMPARE_FIELD(Staff, staffRidesFixed);
COMPARE_FIELD(Staff, staffRidesInspected);
COMPARE_FIELD(Staff, staffLitterSwept);
COMPARE_FIELD(Staff, staffBinsEmptied);
}
void CompareSpriteDataGuest(const Guest& spriteBase, const Guest& spriteCmp, GameStateSpriteChange& changeData) const
@@ -122,18 +122,18 @@ namespace OpenRCT2::GameActions
newPeep->AnimationType = PeepAnimationType::walking;
newPeep->PathCheckOptimisation = 0;
newPeep->PeepFlags = 0;
newPeep->StaffLawnsMown = 0;
newPeep->StaffGardensWatered = 0;
newPeep->StaffLitterSwept = 0;
newPeep->StaffBinsEmptied = 0;
newPeep->StaffOrders = _staffOrders;
newPeep->staffLawnsMown = 0;
newPeep->staffGardensWatered = 0;
newPeep->staffLitterSwept = 0;
newPeep->staffBinsEmptied = 0;
newPeep->staffOrders = _staffOrders;
// We search for the first available Id for a given staff type
std::set<uint32_t> usedStaffIds;
for (auto searchPeep : EntityList<Staff>())
{
if (static_cast<uint8_t>(searchPeep->AssignedStaffType) != _staffType)
if (static_cast<uint8_t>(searchPeep->assignedStaffType) != _staffType)
continue;
usedStaffIds.insert(searchPeep->PeepId);
@@ -146,7 +146,7 @@ namespace OpenRCT2::GameActions
}
newPeep->PeepId = newStaffId;
newPeep->AssignedStaffType = static_cast<StaffType>(_staffType);
newPeep->assignedStaffType = static_cast<StaffType>(_staffType);
auto animPeepType = AnimationPeepType(static_cast<uint8_t>(_staffType) + 1);
ObjectEntryIndex animObjectIndex = _costumeIndex;
@@ -183,7 +183,7 @@ namespace OpenRCT2::GameActions
}
// Staff uses this
newPeep->SetHireDate(GetDate().GetMonthsElapsed());
newPeep->setHireDate(GetDate().GetMonthsElapsed());
newPeep->PathfindGoal.x = 0xFF;
newPeep->PathfindGoal.y = 0xFF;
newPeep->PathfindGoal.z = 0xFF;
@@ -212,8 +212,8 @@ namespace OpenRCT2::GameActions
break;
}
newPeep->StaffMowingTimeout = 0;
newPeep->PatrolInfo = nullptr;
newPeep->staffMowingTimeout = 0;
newPeep->patrolInfo = nullptr;
res.setData(StaffHireNewActionResult{ newPeep->id });
}
@@ -67,7 +67,7 @@ namespace OpenRCT2::GameActions
// Update each staff member's uniform
for (auto peep : EntityList<Staff>())
{
if (peep->AssignedStaffType == static_cast<StaffType>(_staffType))
if (peep->assignedStaffType == static_cast<StaffType>(_staffType))
{
peep->TshirtColour = _colour;
peep->TrousersColour = _colour;
@@ -63,7 +63,7 @@ namespace OpenRCT2::GameActions
auto& objManager = GetContext()->GetObjectManager();
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(_costume);
auto animPeepType = AnimationPeepType(static_cast<uint8_t>(staff->AssignedStaffType) + 1);
auto animPeepType = AnimationPeepType(static_cast<uint8_t>(staff->assignedStaffType) + 1);
if (animObj->GetPeepType() != animPeepType)
{
LOG_ERROR("Invalid entertainer costume %u", _costume);
@@ -54,7 +54,7 @@ namespace OpenRCT2::GameActions
auto* staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
if (staff == nullptr
|| (staff->AssignedStaffType != StaffType::handyman && staff->AssignedStaffType != StaffType::mechanic))
|| (staff->assignedStaffType != StaffType::handyman && staff->assignedStaffType != StaffType::mechanic))
{
LOG_ERROR("Staff orders can't be changed for staff of type %u", _spriteIndex);
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_ACTION_INVALID_FOR_THAT_STAFF_TYPE);
@@ -71,7 +71,7 @@ namespace OpenRCT2::GameActions
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_STAFF_NOT_FOUND);
}
staff->StaffOrders = _ordersId;
staff->staffOrders = _ordersId;
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByNumber(WindowClass::peep, _spriteIndex);
@@ -87,19 +87,19 @@ namespace OpenRCT2::GameActions
switch (_mode)
{
case StaffSetPatrolAreaMode::set:
staff->SetPatrolArea(_range, true);
staff->setPatrolArea(_range, true);
InvalidatePatrolTiles(_range);
break;
case StaffSetPatrolAreaMode::unset:
staff->SetPatrolArea(_range, false);
if (!staff->HasPatrolArea())
staff->setPatrolArea(_range, false);
if (!staff->hasPatrolArea())
{
staff->ClearPatrolArea();
staff->clearPatrolArea();
}
InvalidatePatrolTiles(_range);
break;
case StaffSetPatrolAreaMode::clearAll:
staff->ClearPatrolArea();
staff->clearPatrolArea();
GfxInvalidateScreen();
break;
}
+1 -1
View File
@@ -435,7 +435,7 @@ namespace OpenRCT2
if (staff != nullptr)
{
staff->SetName({});
staff->ClearPatrolArea();
staff->clearPatrolArea();
}
else if (guest != nullptr)
{
+2 -2
View File
@@ -6379,7 +6379,7 @@ namespace OpenRCT2
for (auto innerPeep : EntityList<Staff>())
{
if (innerPeep->AssignedStaffType != StaffType::security || innerPeep->x == kLocationNull)
if (innerPeep->assignedStaffType != StaffType::security || innerPeep->x == kLocationNull)
continue;
int32_t xDist = abs(innerPeep->x - guest.x);
@@ -6387,7 +6387,7 @@ namespace OpenRCT2
if (std::max(xDist, yDist) < 224)
{
innerPeep->StaffVandalsStopped = AddClamp(innerPeep->StaffVandalsStopped, 1u);
innerPeep->staffVandalsStopped = AddClamp(innerPeep->staffVandalsStopped, 1u);
innerPeep->WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS;
return;
}
+3 -3
View File
@@ -147,13 +147,13 @@ namespace OpenRCT2
for (auto staff : EntityList<Staff>())
{
if (EnumValue(staff->AssignedStaffType) != staffType)
if (EnumValue(staff->assignedStaffType) != staffType)
continue;
if (staff->PatrolInfo == nullptr)
if (staff->patrolInfo == nullptr)
continue;
mergedArea.Union(*staff->PatrolInfo);
mergedArea.Union(*staff->patrolInfo);
}
}
}
+6 -6
View File
@@ -225,7 +225,7 @@ namespace OpenRCT2
{
if ((index & kTicks128Mask) == currentTicksMasked)
{
staff->Tick128UpdateStaff();
staff->tick128UpdateStaff();
}
staff->Update();
@@ -741,7 +741,7 @@ namespace OpenRCT2
}
else
{
staff->ClearPatrolArea();
staff->clearPatrolArea();
UpdateConsolidatedPatrolAreas();
News::DisableNewsItems(News::ItemType::peep, staff->id.ToUnderlying());
@@ -1489,7 +1489,7 @@ namespace OpenRCT2
if (isStaff)
{
// Prevent staff from getting the same names by offsetting the name table based on staff type.
nameId *= 256 * EnumValue(staff->AssignedStaffType) + 1;
nameId *= 256 * EnumValue(staff->assignedStaffType) + 1;
}
auto realNameStringId = GetRealNameStringIDFromPeepID(nameId);
@@ -1497,7 +1497,7 @@ namespace OpenRCT2
}
else if (isStaff)
{
auto staffNameIndex = static_cast<uint8_t>(staff->AssignedStaffType);
auto staffNameIndex = static_cast<uint8_t>(staff->assignedStaffType);
if (staffNameIndex >= std::size(kStaffNames))
{
staffNameIndex = 0;
@@ -2363,7 +2363,7 @@ namespace OpenRCT2
else
{
auto* staff = as<Staff>();
result = staff->DoPathFinding();
result = staff->doPathFinding();
}
if (result != 0)
@@ -2470,7 +2470,7 @@ namespace OpenRCT2
if (staff != nullptr && !GetNextIsSurface())
{
// Prevent staff from leaving the path on their own unless they're allowed to mow.
if (!((staff->StaffOrders & STAFF_ORDERS_MOWING) && staff->StaffMowingTimeout >= 12))
if (!((staff->staffOrders & STAFF_ORDERS_MOWING) && staff->staffMowingTimeout >= 12))
{
PeepReturnToCentreOfTile(staff);
return { pathingResult, tileResult };
File diff suppressed because it is too large. Load diff
+68 -85
View File
@@ -47,101 +47,101 @@ namespace OpenRCT2
static constexpr auto cEntityType = EntityType::staff;
public:
PatrolArea* PatrolInfo;
StaffType AssignedStaffType;
uint16_t MechanicTimeSinceCall; // time getting to ride to fix
int32_t HireDate;
uint8_t StaffOrders;
uint8_t StaffMowingTimeout;
PatrolArea* patrolInfo;
StaffType assignedStaffType;
uint16_t mechanicTimeSinceCall; // time getting to ride to fix
int32_t hireDate;
uint8_t staffOrders;
uint8_t staffMowingTimeout;
union // 1st statistic
{
uint32_t StaffLawnsMown;
uint32_t StaffRidesFixed;
uint32_t staffLawnsMown;
uint32_t staffRidesFixed;
uint32_t staffGuestsEntertained;
};
union // 2nd statistic
{
uint32_t StaffGardensWatered;
uint32_t StaffRidesInspected;
uint32_t staffGardensWatered;
uint32_t staffRidesInspected;
};
union // 3rd statistic
{
uint32_t StaffLitterSwept;
uint32_t StaffVandalsStopped;
uint32_t staffLitterSwept;
uint32_t staffVandalsStopped;
};
union // 4th statistic
{
uint32_t StaffBinsEmptied;
uint32_t staffBinsEmptied;
};
void Update();
void Tick128UpdateStaff();
bool IsMechanic() const;
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;
bool DoPathFinding();
void SetHireDate(int32_t hireDate);
int32_t GetHireDate() const;
bool isPatrolAreaSet(const CoordsXY& coords) const;
bool isLocationInPatrol(const CoordsXY& loc) const;
bool isLocationOnPatrolEdge(const CoordsXY& loc) const;
bool doPathFinding();
void setHireDate(int32_t value);
int32_t getHireDate() const;
bool CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) const;
bool canIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) const;
static void ResetStats();
static void resetStats();
void serialise(DataSerialiser& stream);
void ClearPatrolArea();
void SetPatrolArea(const CoordsXY& coords, bool value);
void SetPatrolArea(const MapRange& range, bool value);
bool HasPatrolArea() const;
void clearPatrolArea();
void setPatrolArea(const CoordsXY& coords, bool value);
void setPatrolArea(const MapRange& range, bool value);
bool hasPatrolArea() const;
private:
void UpdatePatrolling();
void UpdateMowing();
void UpdateSweeping();
void UpdateEmptyingBin();
void UpdateWatering();
void UpdateAnswering();
void UpdateFixing(int32_t steps);
bool UpdateFixingEnterStation(Ride& ride) const;
bool UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride);
bool UpdateFixingFixVehicle(bool firstRun, const Ride& ride);
bool UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride);
bool UpdateFixingMoveToStationEnd(bool firstRun, const Ride& ride);
bool UpdateFixingFixStationEnd(bool firstRun);
bool UpdateFixingMoveToStationStart(bool firstRun, const Ride& ride);
bool UpdateFixingFixStationStart(bool firstRun, const Ride& ride);
bool UpdateFixingFixStationBrakes(bool firstRun, Ride& ride);
bool UpdateFixingMoveToStationExit(bool firstRun, const Ride& ride);
bool UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride);
bool UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride);
void UpdateRideInspected(RideId rideIndex);
void UpdateHeadingToInspect();
void updatePatrolling();
void updateMowing();
void updateSweeping();
void updateEmptyingBin();
void updateWatering();
void updateAnswering();
void updateFixing(int32_t steps);
bool updateFixingEnterStation(Ride& ride) const;
bool updateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride);
bool updateFixingFixVehicle(bool firstRun, const Ride& ride);
bool updateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride);
bool updateFixingMoveToStationEnd(bool firstRun, const Ride& ride);
bool updateFixingFixStationEnd(bool firstRun);
bool updateFixingMoveToStationStart(bool firstRun, const Ride& ride);
bool updateFixingFixStationStart(bool firstRun, const Ride& ride);
bool updateFixingFixStationBrakes(bool firstRun, Ride& ride);
bool updateFixingMoveToStationExit(bool firstRun, const Ride& ride);
bool updateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride);
bool updateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride);
void updateRideInspected(RideId rideIndex);
void updateHeadingToInspect();
bool DoHandymanPathFinding();
bool DoMechanicPathFinding();
bool DoEntertainerPathFinding();
bool DoMiscPathFinding();
bool IsMechanicHeadingToFixRideBlockingPath();
bool doHandymanPathFinding();
bool doMechanicPathFinding();
bool doEntertainerPathFinding();
bool doMiscPathFinding();
bool isMechanicHeadingToFixRideBlockingPath();
Direction HandymanDirectionRandSurface(uint8_t validDirections) const;
Direction handymanDirectionRandSurface(uint8_t validDirections) const;
void EntertainerUpdateNearbyPeeps();
bool SecurityGuardPathIsCrowded() const;
void entertainerUpdateNearbyPeeps();
bool securityGuardPathIsCrowded() const;
uint8_t GetValidPatrolDirections(const CoordsXY& loc) const;
Direction HandymanDirectionToNearestLitter() const;
uint8_t HandymanDirectionToUncutGrass(uint8_t valid_directions) const;
Direction DirectionSurface(Direction initialDirection) const;
Direction DirectionPath(uint8_t validDirections, PathElement* pathElement) const;
Direction MechanicDirectionSurface() const;
Direction MechanicDirectionPathRand(uint8_t pathDirections) const;
Direction MechanicDirectionPath(uint8_t validDirections, PathElement* pathElement);
bool UpdatePatrollingFindWatering();
bool UpdatePatrollingFindBin();
bool UpdatePatrollingFindSweeping();
bool UpdatePatrollingFindGrass();
uint8_t getValidPatrolDirections(const CoordsXY& loc) const;
Direction handymanDirectionToNearestLitter() const;
uint8_t handymanDirectionToUncutGrass(uint8_t valid_directions) const;
Direction directionSurface(Direction initialDirection) const;
Direction directionPath(uint8_t validDirections, PathElement* pathElement) const;
Direction mechanicDirectionSurface() const;
Direction mechanicDirectionPathRand(uint8_t pathDirections) const;
Direction mechanicDirectionPath(uint8_t validDirections, PathElement* pathElement);
bool updatePatrollingFindWatering();
bool updatePatrollingFindBin();
bool updatePatrollingFindSweeping();
bool updatePatrollingFindGrass();
};
static_assert(sizeof(Staff) <= 512);
@@ -155,23 +155,6 @@ namespace OpenRCT2
STAFF_ORDERS_FIX_RIDES = (1 << 1)
};
enum class EntertainerCostume : uint8_t
{
Panda,
Tiger,
Elephant,
Roman,
Gorilla,
Snowman,
Knight,
Astronaut,
Bandit,
Sheriff,
Pirate,
Count
};
Drawing::Colour StaffGetColour(StaffType staffType);
GameActions::Result StaffSetColour(StaffType staffType, Drawing::Colour value);
@@ -466,7 +466,7 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t&
{
auto name = peep->GetName();
console.WriteFormatLine(
"staff id %03d type: %02u energy %03u name %s", peep->id, peep->AssignedStaffType, peep->Energy,
"staff id %03d type: %02u energy %03u name %s", peep->id, peep->assignedStaffType, peep->Energy,
name.c_str());
}
}
+2 -2
View File
@@ -120,7 +120,7 @@ void FinancePayWages()
for (auto peep : EntityList<Staff>())
{
FinancePayment(GetStaffWage(peep->AssignedStaffType) / 4, ExpenditureType::wages);
FinancePayment(GetStaffWage(peep->assignedStaffType) / 4, ExpenditureType::wages);
}
}
@@ -274,7 +274,7 @@ void FinanceUpdateDailyProfit()
// Staff costs
for (auto peep : EntityList<Staff>())
{
current_profit -= GetStaffWage(peep->AssignedStaffType);
current_profit -= GetStaffWage(peep->assignedStaffType);
}
// Research costs
+1 -1
View File
@@ -76,7 +76,7 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos)
const auto staff = entity->as<Staff>();
if (staff != nullptr)
{
if (staff->AssignedStaffType != StaffType::handyman)
if (staff->assignedStaffType != StaffType::handyman)
{
continue;
}
@@ -825,11 +825,11 @@ std::optional<OpenRCT2::Drawing::Colour> GetPatrolAreaTileColour(const CoordsXY&
auto* staff = getGameState().entities.GetEntity<Staff>(staffId);
if (staff != nullptr)
{
if (staff->IsPatrolAreaSet(pos))
if (staff->isPatrolAreaSet(pos))
{
return selected ? OpenRCT2::Drawing::Colour::icyBlue : OpenRCT2::Drawing::Colour::lightBlue;
}
else if (IsPatrolAreaSetForStaffType(staff->AssignedStaffType, pos))
else if (IsPatrolAreaSetForStaffType(staff->assignedStaffType, pos))
{
return selected ? OpenRCT2::Drawing::Colour::white : OpenRCT2::Drawing::Colour::grey;
}
+25 -25
View File
@@ -1843,7 +1843,7 @@ namespace OpenRCT2
}
else
{
cs.readWrite(staff->AssignedStaffType);
cs.readWrite(staff->assignedStaffType);
}
}
@@ -1972,7 +1972,7 @@ namespace OpenRCT2
}
else
{
cs.readWrite(staff->MechanicTimeSinceCall);
cs.readWrite(staff->mechanicTimeSinceCall);
}
}
@@ -2043,7 +2043,7 @@ namespace OpenRCT2
{
cs.ignore<money32>();
cs.ignore<money32>();
cs.readWrite(staff->HireDate);
cs.readWrite(staff->hireDate);
cs.ignore<int8_t>();
cs.ignore<RideId>();
cs.ignore<uint16_t>();
@@ -2072,7 +2072,7 @@ namespace OpenRCT2
else
{
cs.ignore<RideId>();
cs.readWrite(staff->StaffOrders);
cs.readWrite(staff->staffOrders);
cs.ignore<RideId>();
}
}
@@ -2128,12 +2128,12 @@ namespace OpenRCT2
else
{
cs.ignore<uint8_t>();
cs.readWrite(staff->StaffMowingTimeout);
cs.readWrite(staff->staffMowingTimeout);
cs.ignore<uint8_t>();
cs.readWrite(staff->StaffLawnsMown);
cs.readWrite(staff->StaffGardensWatered);
cs.readWrite(staff->StaffLitterSwept);
cs.readWrite(staff->StaffBinsEmptied);
cs.readWrite(staff->staffLawnsMown);
cs.readWrite(staff->staffGardensWatered);
cs.readWrite(staff->staffLitterSwept);
cs.readWrite(staff->staffBinsEmptied);
cs.ignore<uint8_t>();
cs.ignore<uint8_t>();
cs.ignore<uint8_t>();
@@ -2494,24 +2494,24 @@ namespace OpenRCT2
ReadWritePeep(os, cs, entity);
std::vector<TileCoordsXY> patrolArea;
if (cs.getMode() == OrcaStream::Mode::writing && entity.PatrolInfo != nullptr)
if (cs.getMode() == OrcaStream::Mode::writing && entity.patrolInfo != nullptr)
{
patrolArea = entity.PatrolInfo->ToVector();
patrolArea = entity.patrolInfo->ToVector();
}
cs.readWriteVector(patrolArea, [&cs](TileCoordsXY& value) { cs.readWrite(value); });
if (cs.getMode() == OrcaStream::Mode::reading)
{
if (patrolArea.empty())
{
entity.ClearPatrolArea();
entity.clearPatrolArea();
}
else
{
if (entity.PatrolInfo == nullptr)
entity.PatrolInfo = new PatrolArea();
if (entity.patrolInfo == nullptr)
entity.patrolInfo = new PatrolArea();
else
entity.PatrolInfo->Clear();
entity.PatrolInfo->Union(patrolArea);
entity.patrolInfo->Clear();
entity.patrolInfo->Union(patrolArea);
}
}
@@ -2520,19 +2520,19 @@ namespace OpenRCT2
return;
}
cs.readWrite(entity.AssignedStaffType);
cs.readWrite(entity.MechanicTimeSinceCall);
cs.readWrite(entity.HireDate);
cs.readWrite(entity.assignedStaffType);
cs.readWrite(entity.mechanicTimeSinceCall);
cs.readWrite(entity.hireDate);
if (os.getHeader().targetVersion <= 4)
{
cs.ignore<uint8_t>();
}
cs.readWrite(entity.StaffOrders);
cs.readWrite(entity.StaffMowingTimeout);
cs.readWrite(entity.StaffLawnsMown);
cs.readWrite(entity.StaffGardensWatered);
cs.readWrite(entity.StaffLitterSwept);
cs.readWrite(entity.StaffBinsEmptied);
cs.readWrite(entity.staffOrders);
cs.readWrite(entity.staffMowingTimeout);
cs.readWrite(entity.staffLawnsMown);
cs.readWrite(entity.staffGardensWatered);
cs.readWrite(entity.staffLitterSwept);
cs.readWrite(entity.staffBinsEmptied);
}
template<>
+6 -6
View File
@@ -732,7 +732,7 @@ namespace OpenRCT2::PathFinding
if (currentElementIsWide)
{
const Staff* staff = peep.as<Staff>();
if (staff != nullptr && staff->CanIgnoreWideFlag(loc.ToCoordsXYZ(), currentTileElement))
if (staff != nullptr && staff->canIgnoreWideFlag(loc.ToCoordsXYZ(), currentTileElement))
currentElementIsWide = false;
}
@@ -752,9 +752,9 @@ namespace OpenRCT2::PathFinding
bool nextInPatrolArea = inPatrolArea;
auto* staff = peep.as<Staff>();
if (staff != nullptr && staff->IsMechanic())
if (staff != nullptr && staff->isMechanic())
{
nextInPatrolArea = staff->IsLocationInPatrol(loc.ToCoordsXY());
nextInPatrolArea = staff->isLocationInPatrol(loc.ToCoordsXY());
if (inPatrolArea && !nextInPatrolArea)
{
/* The mechanic will leave his patrol area by taking
@@ -859,7 +859,7 @@ namespace OpenRCT2::PathFinding
if (pathElement->IsWide())
{
/* Check if staff can ignore this wide flag. */
if (staff == nullptr || !staff->CanIgnoreWideFlag(loc.ToCoordsXYZ(), tileElement))
if (staff == nullptr || !staff->canIgnoreWideFlag(loc.ToCoordsXYZ(), tileElement))
{
searchResult = PathSearchResult::Wide;
found = true;
@@ -1450,12 +1450,12 @@ namespace OpenRCT2::PathFinding
bool inPatrolArea = false;
auto* staff = peep.as<Staff>();
if (staff != nullptr && staff->IsMechanic())
if (staff != nullptr && staff->isMechanic())
{
/* Mechanics are the only staff type that
* pathfind to a destination. Determine if the
* mechanic is in their patrol area. */
inPatrolArea = staff->IsLocationInPatrol(peep.NextLoc);
inPatrolArea = staff->isLocationInPatrol(peep.NextLoc);
}
LogPathfinding(
+10 -10
View File
@@ -1421,7 +1421,7 @@ namespace OpenRCT2::RCT1
x <<= 7;
int32_t y = val & 0x3E0;
y <<= 2;
staffmember->SetPatrolArea(MapRange(x, y, x + (4 * kCoordsXYStep) - 1, y + (4 * kCoordsXYStep) - 1), true);
staffmember->setPatrolArea(MapRange(x, y, x + (4 * kCoordsXYStep) - 1, y + (4 * kCoordsXYStep) - 1), true);
}
}
}
@@ -3020,15 +3020,15 @@ namespace OpenRCT2::RCT1
auto* dst = getGameState().entities.CreateEntityAt<Staff>(EntityId::FromUnderlying(srcBase.EntityIndex));
auto* src = static_cast<const Peep*>(&srcBase);
ImportPeep(dst, src);
dst->AssignedStaffType = StaffType(src->StaffType);
dst->MechanicTimeSinceCall = src->MechanicTimeSinceCall;
dst->HireDate = src->ParkEntryTime;
dst->StaffOrders = src->StaffOrders;
dst->StaffMowingTimeout = src->StaffMowingTimeout;
dst->StaffLawnsMown = src->PaidToEnter;
dst->StaffGardensWatered = src->PaidOnRides;
dst->StaffLitterSwept = src->PaidOnFood;
dst->StaffBinsEmptied = src->PaidOnSouvenirs;
dst->assignedStaffType = StaffType(src->StaffType);
dst->mechanicTimeSinceCall = src->MechanicTimeSinceCall;
dst->hireDate = src->ParkEntryTime;
dst->staffOrders = src->StaffOrders;
dst->staffMowingTimeout = src->StaffMowingTimeout;
dst->staffLawnsMown = src->PaidToEnter;
dst->staffGardensWatered = src->PaidOnRides;
dst->staffLitterSwept = src->PaidOnFood;
dst->staffBinsEmptied = src->PaidOnSouvenirs;
ImportStaffPatrolArea(dst, src->StaffID);
}
+10 -10
View File
@@ -1656,7 +1656,7 @@ namespace OpenRCT2::RCT2
x <<= 7;
int32_t y = val & 0xFC0;
y <<= 1;
staffmember->SetPatrolArea(MapRange(x, y, x + (4 * kCoordsXYStep) - 1, y + (4 * kCoordsXYStep) - 1), true);
staffmember->setPatrolArea(MapRange(x, y, x + (4 * kCoordsXYStep) - 1, y + (4 * kCoordsXYStep) - 1), true);
}
}
}
@@ -2187,16 +2187,16 @@ namespace OpenRCT2::RCT2
auto src = static_cast<const Peep*>(&baseSrc);
ImportEntityPeep(dst, src);
dst->AssignedStaffType = StaffType(src->StaffType);
dst->MechanicTimeSinceCall = src->MechanicTimeSinceCall;
dst->assignedStaffType = StaffType(src->StaffType);
dst->mechanicTimeSinceCall = src->MechanicTimeSinceCall;
dst->HireDate = src->ParkEntryTime;
dst->StaffOrders = src->StaffOrders;
dst->StaffMowingTimeout = src->StaffMowingTimeout;
dst->StaffLawnsMown = src->PaidToEnter;
dst->StaffGardensWatered = src->PaidOnRides;
dst->StaffLitterSwept = src->PaidOnFood;
dst->StaffBinsEmptied = src->PaidOnSouvenirs;
dst->hireDate = src->ParkEntryTime;
dst->staffOrders = src->StaffOrders;
dst->staffMowingTimeout = src->StaffMowingTimeout;
dst->staffLawnsMown = src->PaidToEnter;
dst->staffGardensWatered = src->PaidOnRides;
dst->staffLitterSwept = src->PaidOnFood;
dst->staffBinsEmptied = src->PaidOnSouvenirs;
ImportStaffPatrolArea(dst, src->StaffId);
}
+5 -5
View File
@@ -1525,7 +1525,7 @@ Staff* FindClosestMechanic(const CoordsXY& entrancePosition, int32_t forInspecti
for (auto peep : EntityList<Staff>())
{
if (!peep->IsMechanic())
if (!peep->isMechanic())
continue;
if (!forInspection)
@@ -1538,18 +1538,18 @@ Staff* FindClosestMechanic(const CoordsXY& entrancePosition, int32_t forInspecti
else if (peep->State != PeepState::patrolling)
continue;
if (!(peep->StaffOrders & STAFF_ORDERS_FIX_RIDES))
if (!(peep->staffOrders & STAFF_ORDERS_FIX_RIDES))
continue;
}
else
{
if (peep->State != PeepState::patrolling || !(peep->StaffOrders & STAFF_ORDERS_INSPECT_RIDES))
if (peep->State != PeepState::patrolling || !(peep->staffOrders & STAFF_ORDERS_INSPECT_RIDES))
continue;
}
auto location = entrancePosition.ToTileStart();
if (MapIsLocationInPark(location))
if (!peep->IsLocationInPatrol(location))
if (!peep->isLocationInPatrol(location))
continue;
if (peep->x == kLocationNull)
@@ -1570,7 +1570,7 @@ Staff* FindClosestMechanic(const CoordsXY& entrancePosition, int32_t forInspecti
Staff* RideGetMechanic(const Ride& ride)
{
auto staff = getGameState().entities.GetEntity<Staff>(ride.mechanic);
if (staff != nullptr && staff->IsMechanic())
if (staff != nullptr && staff->isMechanic())
{
return staff;
}
+1 -1
View File
@@ -140,7 +140,7 @@ void ScenarioReset(GameState_t& gameState)
Duck::RemoveAll();
Park::UpdateSize(park);
MapCountRemainingLandRights();
Staff::ResetStats();
Staff::resetStats();
gameState.lastEntranceStyle = objManager.GetLoadedObjectEntryIndex("rct2.station.plain");
if (gameState.lastEntranceStyle == kObjectEntryIndexNull)
@@ -58,7 +58,7 @@ namespace OpenRCT2::Scripting
auto peep = GetStaff(thisVal);
if (peep != nullptr)
{
switch (peep->AssignedStaffType)
switch (peep->assignedStaffType)
{
case StaffType::handyman:
return JSFromStdString(ctx, "handyman");
@@ -82,27 +82,27 @@ namespace OpenRCT2::Scripting
auto peep = GetStaff(thisVal);
if (peep != nullptr)
{
if (value == "handyman" && peep->AssignedStaffType != StaffType::handyman)
if (value == "handyman" && peep->assignedStaffType != StaffType::handyman)
{
peep->AssignedStaffType = StaffType::handyman;
peep->assignedStaffType = StaffType::handyman;
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::handyman);
peep->AnimationGroup = PeepAnimationGroup::normal;
}
else if (value == "mechanic" && !peep->IsMechanic())
else if (value == "mechanic" && !peep->isMechanic())
{
peep->AssignedStaffType = StaffType::mechanic;
peep->assignedStaffType = StaffType::mechanic;
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::mechanic);
peep->AnimationGroup = PeepAnimationGroup::normal;
}
else if (value == "security" && peep->AssignedStaffType != StaffType::security)
else if (value == "security" && peep->assignedStaffType != StaffType::security)
{
peep->AssignedStaffType = StaffType::security;
peep->assignedStaffType = StaffType::security;
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::security);
peep->AnimationGroup = PeepAnimationGroup::normal;
}
else if (value == "entertainer" && !peep->isEntertainer())
{
peep->AssignedStaffType = StaffType::entertainer;
peep->assignedStaffType = StaffType::entertainer;
peep->AnimationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::entertainer);
peep->AnimationGroup = PeepAnimationGroup::normal;
}
@@ -148,7 +148,7 @@ namespace OpenRCT2::Scripting
if (peep != nullptr)
{
auto idx = 0;
for (auto& costume : costumesByStaffType(peep->AssignedStaffType))
for (auto& costume : costumesByStaffType(peep->assignedStaffType))
{
JS_SetPropertyInt64(ctx, availableCostumes, idx++, JSFromStdString(ctx, costume.scriptName));
}
@@ -159,7 +159,7 @@ namespace OpenRCT2::Scripting
JSValue ScStaff::getCostumeStrings(JSContext* ctx, JSValue thisVal, int argc, JSValue* argv)
{
auto peep = GetStaff(thisVal);
auto animPeepType = getAnimationPeepType(peep->AssignedStaffType);
auto animPeepType = getAnimationPeepType(peep->assignedStaffType);
JSValue availableCostumes = JS_NewArray(ctx);
auto idx = 0;
@@ -179,7 +179,7 @@ namespace OpenRCT2::Scripting
return JS_UNDEFINED;
}
auto& costumes = costumesByStaffType(peep->AssignedStaffType);
auto& costumes = costumesByStaffType(peep->assignedStaffType);
auto costume = std::find_if(costumes.begin(), costumes.end(), [peep](auto& candidate) {
return candidate.objectId == peep->AnimationObjectIndex;
@@ -203,7 +203,7 @@ namespace OpenRCT2::Scripting
return JS_UNDEFINED;
}
auto& costumes = costumesByStaffType(peep->AssignedStaffType);
auto& costumes = costumesByStaffType(peep->assignedStaffType);
auto costume = costumes.end();
// Split by type passed so as to not break old plugins
@@ -243,7 +243,7 @@ namespace OpenRCT2::Scripting
JSValue ScStaff::orders_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
return JS_NewUint32(ctx, peep != nullptr ? peep->StaffOrders : 0);
return JS_NewUint32(ctx, peep != nullptr ? peep->staffOrders : 0);
}
JSValue ScStaff::orders_set(JSContext* ctx, JSValue thisVal, JSValue jsValue)
@@ -253,7 +253,7 @@ namespace OpenRCT2::Scripting
auto peep = GetStaff(thisVal);
if (peep != nullptr)
{
peep->StaffOrders = value;
peep->staffOrders = value;
}
return JS_UNDEFINED;
}
@@ -287,7 +287,7 @@ namespace OpenRCT2::Scripting
if (peep != nullptr)
{
auto idx = 0;
for (auto& animation : animationsByStaffType(peep->AssignedStaffType))
for (auto& animation : animationsByStaffType(peep->assignedStaffType))
{
JS_SetPropertyInt64(ctx, availableAnimations, idx++, JSFromStdString(ctx, animation.first));
}
@@ -308,7 +308,7 @@ namespace OpenRCT2::Scripting
return spriteIds;
}
auto animationGroups = animationsByStaffType(peep->AssignedStaffType);
auto animationGroups = animationsByStaffType(peep->assignedStaffType);
auto animationType = animationGroups.TryGet(groupKey);
if (animationType == std::nullopt)
{
@@ -342,7 +342,7 @@ namespace OpenRCT2::Scripting
return JSFromStdString(ctx, "");
}
auto animationGroups = animationsByStaffType(peep->AssignedStaffType);
auto animationGroups = animationsByStaffType(peep->assignedStaffType);
return JSFromStdString(ctx, animationGroups[peep->AnimationType]);
}
@@ -352,7 +352,7 @@ namespace OpenRCT2::Scripting
JS_THROW_IF_GAME_STATE_NOT_MUTABLE();
auto* peep = GetStaff(thisVal);
auto animationGroups = animationsByStaffType(peep->AssignedStaffType);
auto animationGroups = animationsByStaffType(peep->assignedStaffType);
auto newType = animationGroups.TryGet(groupKey);
if (newType == std::nullopt)
{
@@ -454,9 +454,9 @@ namespace OpenRCT2::Scripting
JSValue ScHandyman::lawnsMown_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->AssignedStaffType == StaffType::handyman)
if (peep != nullptr && peep->assignedStaffType == StaffType::handyman)
{
return JS_NewUint32(ctx, peep->StaffLawnsMown);
return JS_NewUint32(ctx, peep->staffLawnsMown);
}
else
{
@@ -467,9 +467,9 @@ namespace OpenRCT2::Scripting
JSValue ScHandyman::gardensWatered_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->AssignedStaffType == StaffType::handyman)
if (peep != nullptr && peep->assignedStaffType == StaffType::handyman)
{
return JS_NewUint32(ctx, peep->StaffGardensWatered);
return JS_NewUint32(ctx, peep->staffGardensWatered);
}
else
{
@@ -480,9 +480,9 @@ namespace OpenRCT2::Scripting
JSValue ScHandyman::litterSwept_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->AssignedStaffType == StaffType::handyman)
if (peep != nullptr && peep->assignedStaffType == StaffType::handyman)
{
return JS_NewUint32(ctx, peep->StaffLitterSwept);
return JS_NewUint32(ctx, peep->staffLitterSwept);
}
else
{
@@ -493,9 +493,9 @@ namespace OpenRCT2::Scripting
JSValue ScHandyman::binsEmptied_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->AssignedStaffType == StaffType::handyman)
if (peep != nullptr && peep->assignedStaffType == StaffType::handyman)
{
return JS_NewUint32(ctx, peep->StaffBinsEmptied);
return JS_NewUint32(ctx, peep->staffBinsEmptied);
}
else
{
@@ -522,9 +522,9 @@ namespace OpenRCT2::Scripting
JSValue ScMechanic::ridesFixed_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->IsMechanic())
if (peep != nullptr && peep->isMechanic())
{
return JS_NewUint32(ctx, peep->StaffRidesFixed);
return JS_NewUint32(ctx, peep->staffRidesFixed);
}
else
{
@@ -535,9 +535,9 @@ namespace OpenRCT2::Scripting
JSValue ScMechanic::ridesInspected_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->IsMechanic())
if (peep != nullptr && peep->isMechanic())
{
return JS_NewUint32(ctx, peep->StaffRidesInspected);
return JS_NewUint32(ctx, peep->staffRidesInspected);
}
else
{
@@ -563,9 +563,9 @@ namespace OpenRCT2::Scripting
JSValue ScSecurity::vandalsStopped_get(JSContext* ctx, JSValue thisVal)
{
auto peep = GetStaff(thisVal);
if (peep != nullptr && peep->AssignedStaffType == StaffType::security)
if (peep != nullptr && peep->assignedStaffType == StaffType::security)
{
return JS_NewUint32(ctx, peep->StaffVandalsStopped);
return JS_NewUint32(ctx, peep->staffVandalsStopped);
}
else
{
@@ -617,7 +617,7 @@ namespace OpenRCT2::Scripting
{
JSIterateArray(ctx, coordsOrRange, [staff, reset](JSContext* ctx2, JSValue v) {
auto coord = JSToCoordsXY(ctx2, v);
staff->SetPatrolArea(coord, reset);
staff->setPatrolArea(coord, reset);
MapInvalidateTileFull(coord);
});
}
@@ -630,7 +630,7 @@ namespace OpenRCT2::Scripting
for (int32_t x = mapRange.GetX1(); x <= mapRange.GetX2(); x += kCoordsXYStep)
{
CoordsXY coord(x, y);
staff->SetPatrolArea(coord, reset);
staff->setPatrolArea(coord, reset);
MapInvalidateTileFull(coord);
}
}
@@ -644,9 +644,9 @@ namespace OpenRCT2::Scripting
auto array = JS_NewArray(ctx);
auto staff = GetStaff(thisVal);
if (staff != nullptr && staff->PatrolInfo != nullptr)
if (staff != nullptr && staff->patrolInfo != nullptr)
{
auto tiles = staff->PatrolInfo->ToVector();
auto tiles = staff->patrolInfo->ToVector();
auto index = 0;
for (const auto& tile : tiles)
@@ -667,7 +667,7 @@ namespace OpenRCT2::Scripting
auto staff = GetStaff(thisVal);
if (staff != nullptr)
{
staff->ClearPatrolArea();
staff->clearPatrolArea();
if (JS_IsArray(value))
{
ModifyArea(ctx, thisVal, value, true);
@@ -683,7 +683,7 @@ namespace OpenRCT2::Scripting
auto staff = GetStaff(thisVal);
if (staff != nullptr)
{
staff->ClearPatrolArea();
staff->clearPatrolArea();
UpdateConsolidatedPatrolAreas();
}
return JS_UNDEFINED;
@@ -712,7 +712,7 @@ namespace OpenRCT2::Scripting
if (staff != nullptr)
{
auto pos = JSToCoordsXY(ctx, coord);
return JS_NewBool(ctx, staff->IsLocationInPatrol(pos));
return JS_NewBool(ctx, staff->isLocationInPatrol(pos));
}
return JS_NewBool(ctx, false);
}
@@ -192,7 +192,7 @@ namespace OpenRCT2::Scripting
auto staff = getGameState().entities.GetEntity<Staff>(sprite->id);
if (staff != nullptr)
{
switch (staff->AssignedStaffType)
switch (staff->assignedStaffType)
{
case StaffType::handyman:
JS_SetPropertyInt64(ctx, result, idx++, ScHandyman::New(ctx, sprite->id));
@@ -292,7 +292,7 @@ namespace OpenRCT2::Scripting
auto staff = getGameState().entities.GetEntity<Staff>(sprite->id);
if (staff != nullptr)
{
switch (staff->AssignedStaffType)
switch (staff->assignedStaffType)
{
case StaffType::handyman:
JS_SetPropertyInt64(ctx, result, idx++, ScHandyman::New(ctx, sprite->id));
@@ -484,7 +484,7 @@ namespace OpenRCT2::Scripting
auto staff = getGameState().entities.GetEntity<Staff>(spriteId);
if (staff != nullptr)
{
switch (staff->AssignedStaffType)
switch (staff->assignedStaffType)
{
case StaffType::handyman:
return ScHandyman::New(ctx, spriteId);
+1 -1
View File
@@ -2314,7 +2314,7 @@ namespace OpenRCT2
auto staff = entity->as<Staff>();
if (staff != nullptr)
{
auto patrol = staff->PatrolInfo;
auto patrol = staff->patrolInfo;
if (patrol != nullptr)
{
auto positions = patrol->ToVector();