From d85835a0a0ebe4e132205f919d1cd6d757961ef2 Mon Sep 17 00:00:00 2001 From: mgiannopoulos24 <79588074+mgiannopoulos24@users.noreply.github.com> Date: Thu, 28 May 2026 13:28:45 +0300 Subject: [PATCH] Rename Staff entity members (#26603) * Rename Staff entity member fields * Rename Staff entity methods for consistency * Remove unused EntertainerCostume enum class --- src/openrct2-ui/windows/PatrolArea.cpp | 2 +- src/openrct2-ui/windows/Ride.cpp | 4 +- src/openrct2-ui/windows/Staff.cpp | 30 +- src/openrct2-ui/windows/StaffList.cpp | 14 +- src/openrct2/GameStateSnapshots.cpp | 18 +- .../actions/peep/StaffHireNewAction.cpp | 20 +- .../actions/peep/StaffSetColourAction.cpp | 2 +- .../actions/peep/StaffSetCostumeAction.cpp | 2 +- .../actions/peep/StaffSetOrdersAction.cpp | 4 +- .../actions/peep/StaffSetPatrolAreaAction.cpp | 10 +- src/openrct2/entity/EntityRegistry.cpp | 2 +- src/openrct2/entity/Guest.cpp | 4 +- src/openrct2/entity/PatrolArea.cpp | 6 +- src/openrct2/entity/Peep.cpp | 12 +- src/openrct2/entity/Staff.cpp | 358 +++++++++--------- src/openrct2/entity/Staff.h | 153 ++++---- src/openrct2/interface/InteractiveConsole.cpp | 2 +- src/openrct2/management/Finance.cpp | 4 +- src/openrct2/paint/Paint.Entity.cpp | 2 +- .../paint/tile_element/Paint.Surface.cpp | 4 +- src/openrct2/park/ParkFile.cpp | 50 +-- src/openrct2/peep/GuestPathfinding.cpp | 12 +- src/openrct2/rct1/S4Importer.cpp | 20 +- src/openrct2/rct2/S6Importer.cpp | 20 +- src/openrct2/ride/Ride.cpp | 10 +- src/openrct2/scenario/Scenario.cpp | 2 +- .../scripting/bindings/entity/ScStaff.cpp | 78 ++-- .../scripting/bindings/world/ScMap.cpp | 6 +- src/openrct2/world/Map.cpp | 2 +- 29 files changed, 418 insertions(+), 435 deletions(-) diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index 40e47a7816..e13afb6cf3 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -204,7 +204,7 @@ namespace OpenRCT2::Ui::Windows auto staff = getGameState().entities.GetEntity(_staffId); if (staff != nullptr) { - _mode = staff->IsPatrolAreaSet(*mapTile) ? GameActions::StaffSetPatrolAreaMode::unset + _mode = staff->isPatrolAreaSet(*mapTile) ? GameActions::StaffSetPatrolAreaMode::unset : GameActions::StaffSetPatrolAreaMode::set; } } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 6df982b4f1..bee004d58a 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4134,7 +4134,7 @@ namespace OpenRCT2::Ui::Windows for (auto peep : EntityList()) { - 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(ride->mechanic); - if (staff != nullptr && staff->IsMechanic()) + if (staff != nullptr && staff->isMechanic()) { ft = Formatter(); staff->FormatNameTo(ft); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 7bf84cdaa0..110b0d3bf9 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -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(GetStaffWage(staff->AssignedStaffType)); + ft.Add(GetStaffWage(staff->assignedStaffType)); drawText(rt, screenCoords, STR_STAFF_STAT_WAGES, ft); screenCoords.y += kListRowHeight; } auto ft = Formatter(); - ft.Add(staff->GetHireDate()); + ft.Add(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(staff->StaffLawnsMown); + ft.Add(staff->staffLawnsMown); drawText(rt, screenCoords, STR_STAFF_STAT_LAWNS_MOWN, ft); screenCoords.y += kListRowHeight; ft = Formatter(); - ft.Add(staff->StaffGardensWatered); + ft.Add(staff->staffGardensWatered); drawText(rt, screenCoords, STR_STAFF_STAT_GARDENS_WATERED, ft); screenCoords.y += kListRowHeight; ft = Formatter(); - ft.Add(staff->StaffLitterSwept); + ft.Add(staff->staffLitterSwept); drawText(rt, screenCoords, STR_STAFF_STAT_LITTER_SWEPT, ft); screenCoords.y += kListRowHeight; ft = Formatter(); - ft.Add(staff->StaffBinsEmptied); + ft.Add(staff->staffBinsEmptied); drawText(rt, screenCoords, STR_STAFF_STAT_BINS_EMPTIED, ft); break; case StaffType::mechanic: ft = Formatter(); - ft.Add(staff->StaffRidesInspected); + ft.Add(staff->staffRidesInspected); drawText(rt, screenCoords, STR_STAFF_STAT_RIDES_INSPECTED, ft); screenCoords.y += kListRowHeight; ft = Formatter(); - ft.Add(staff->StaffRidesFixed); + ft.Add(staff->staffRidesFixed); drawText(rt, screenCoords, STR_STAFF_STAT_RIDES_FIXED, ft); break; case StaffType::security: ft = Formatter(); - ft.Add(staff->StaffVandalsStopped); + ft.Add(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()); } diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 53761c3b40..98132ea0d6 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -192,7 +192,7 @@ namespace OpenRCT2::Ui::Windows for (auto peep : EntityList()) { 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()) { 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::max(); for (auto peep : EntityList()) { - 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; } diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index a39a79b19b..2b9ed68f3d 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -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 diff --git a/src/openrct2/actions/peep/StaffHireNewAction.cpp b/src/openrct2/actions/peep/StaffHireNewAction.cpp index fa67bc5660..4518eebbed 100644 --- a/src/openrct2/actions/peep/StaffHireNewAction.cpp +++ b/src/openrct2/actions/peep/StaffHireNewAction.cpp @@ -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 usedStaffIds; for (auto searchPeep : EntityList()) { - if (static_cast(searchPeep->AssignedStaffType) != _staffType) + if (static_cast(searchPeep->assignedStaffType) != _staffType) continue; usedStaffIds.insert(searchPeep->PeepId); @@ -146,7 +146,7 @@ namespace OpenRCT2::GameActions } newPeep->PeepId = newStaffId; - newPeep->AssignedStaffType = static_cast(_staffType); + newPeep->assignedStaffType = static_cast(_staffType); auto animPeepType = AnimationPeepType(static_cast(_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 }); } diff --git a/src/openrct2/actions/peep/StaffSetColourAction.cpp b/src/openrct2/actions/peep/StaffSetColourAction.cpp index 4bdbdf2d40..5313367d14 100644 --- a/src/openrct2/actions/peep/StaffSetColourAction.cpp +++ b/src/openrct2/actions/peep/StaffSetColourAction.cpp @@ -67,7 +67,7 @@ namespace OpenRCT2::GameActions // Update each staff member's uniform for (auto peep : EntityList()) { - if (peep->AssignedStaffType == static_cast(_staffType)) + if (peep->assignedStaffType == static_cast(_staffType)) { peep->TshirtColour = _colour; peep->TrousersColour = _colour; diff --git a/src/openrct2/actions/peep/StaffSetCostumeAction.cpp b/src/openrct2/actions/peep/StaffSetCostumeAction.cpp index b7b163e448..ea493ca283 100644 --- a/src/openrct2/actions/peep/StaffSetCostumeAction.cpp +++ b/src/openrct2/actions/peep/StaffSetCostumeAction.cpp @@ -63,7 +63,7 @@ namespace OpenRCT2::GameActions auto& objManager = GetContext()->GetObjectManager(); auto* animObj = objManager.GetLoadedObject(_costume); - auto animPeepType = AnimationPeepType(static_cast(staff->AssignedStaffType) + 1); + auto animPeepType = AnimationPeepType(static_cast(staff->assignedStaffType) + 1); if (animObj->GetPeepType() != animPeepType) { LOG_ERROR("Invalid entertainer costume %u", _costume); diff --git a/src/openrct2/actions/peep/StaffSetOrdersAction.cpp b/src/openrct2/actions/peep/StaffSetOrdersAction.cpp index aa4698e99a..6eadad5279 100644 --- a/src/openrct2/actions/peep/StaffSetOrdersAction.cpp +++ b/src/openrct2/actions/peep/StaffSetOrdersAction.cpp @@ -54,7 +54,7 @@ namespace OpenRCT2::GameActions auto* staff = gameState.entities.TryGetEntity(_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); diff --git a/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp b/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp index 2b53f8718f..2b2c9c9354 100644 --- a/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp +++ b/src/openrct2/actions/peep/StaffSetPatrolAreaAction.cpp @@ -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; } diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index 4761bca87c..7a1bad3d04 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -435,7 +435,7 @@ namespace OpenRCT2 if (staff != nullptr) { staff->SetName({}); - staff->ClearPatrolArea(); + staff->clearPatrolArea(); } else if (guest != nullptr) { diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 45ee2a1c9f..1077f1e22f 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -6379,7 +6379,7 @@ namespace OpenRCT2 for (auto innerPeep : EntityList()) { - 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; } diff --git a/src/openrct2/entity/PatrolArea.cpp b/src/openrct2/entity/PatrolArea.cpp index b44154f6d5..238ce1a096 100644 --- a/src/openrct2/entity/PatrolArea.cpp +++ b/src/openrct2/entity/PatrolArea.cpp @@ -147,13 +147,13 @@ namespace OpenRCT2 for (auto staff : EntityList()) { - 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); } } } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index c398ccc86a..b8fb79c74a 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -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(staff->AssignedStaffType); + auto staffNameIndex = static_cast(staff->assignedStaffType); if (staffNameIndex >= std::size(kStaffNames)) { staffNameIndex = 0; @@ -2363,7 +2363,7 @@ namespace OpenRCT2 else { auto* staff = as(); - 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 }; diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index 500420e7f9..2ad1db4d0d 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -59,33 +59,33 @@ namespace OpenRCT2 * * rct2: 0x006C0905 */ - bool Staff::IsLocationInPatrol(const CoordsXY& loc) const + bool Staff::isLocationInPatrol(const CoordsXY& loc) const { // Check if location is in the park if (!MapIsLocationOwnedOrHasRights(loc)) return false; // Check if staff has patrol area - if (!HasPatrolArea()) + if (!hasPatrolArea()) return true; - return IsPatrolAreaSet(loc); + return isPatrolAreaSet(loc); } // Check whether the location x,y is inside and on the edge of the // patrol zone for mechanic. - bool Staff::IsLocationOnPatrolEdge(const CoordsXY& loc) const + bool Staff::isLocationOnPatrolEdge(const CoordsXY& loc) const { bool onZoneEdge = false; for (uint8_t neighbourDir = 0; !onZoneEdge && neighbourDir <= 7; neighbourDir++) { auto neighbourPos = loc + CoordsDirectionDelta[neighbourDir]; - onZoneEdge = !IsLocationInPatrol(neighbourPos); + onZoneEdge = !isLocationInPatrol(neighbourPos); } return onZoneEdge; } - bool Staff::CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) const + bool Staff::canIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) const { /* Wide flags can potentially wall off parts of a staff patrol zone * for the heuristic search. @@ -108,7 +108,7 @@ namespace OpenRCT2 * both of these tiles are connected wide paths, the wide flag can be * ignored. */ - if (!IsLocationOnPatrolEdge(staffPos)) + if (!isLocationOnPatrolEdge(staffPos)) { return false; } @@ -123,11 +123,11 @@ namespace OpenRCT2 auto adjacPos = staffPos + CoordsXYZ{ CoordsDirectionDelta[adjac_dir].x, CoordsDirectionDelta[adjac_dir].y, 0 }; /* Ignore adjacent tiles outside the patrol zone. */ - if (!IsLocationInPatrol(adjacPos)) + if (!isLocationInPatrol(adjacPos)) continue; /* Ignore adjacent tiles on the patrol zone edge. */ - if (IsLocationOnPatrolEdge(adjacPos)) + if (isLocationOnPatrolEdge(adjacPos)) continue; /* Adjacent tile is inside the patrol zone but not on the @@ -204,26 +204,26 @@ namespace OpenRCT2 * rct2: 0x006C095B * returns 0xF if not in a valid patrol area */ - uint8_t Staff::GetValidPatrolDirections(const CoordsXY& loc) const + uint8_t Staff::getValidPatrolDirections(const CoordsXY& loc) const { uint8_t directions = 0; - if (IsLocationInPatrol({ loc.x - kCoordsXYStep, loc.y })) + if (isLocationInPatrol({ loc.x - kCoordsXYStep, loc.y })) { directions |= (1 << 0); } - if (IsLocationInPatrol({ loc.x, loc.y + kCoordsXYStep })) + if (isLocationInPatrol({ loc.x, loc.y + kCoordsXYStep })) { directions |= (1 << 1); } - if (IsLocationInPatrol({ loc.x + kCoordsXYStep, loc.y })) + if (isLocationInPatrol({ loc.x + kCoordsXYStep, loc.y })) { directions |= (1 << 2); } - if (IsLocationInPatrol({ loc.x, loc.y - kCoordsXYStep })) + if (isLocationInPatrol({ loc.x, loc.y - kCoordsXYStep })) { directions |= (1 << 3); } @@ -240,38 +240,38 @@ namespace OpenRCT2 * * rct2: 0x006C1955 */ - void Staff::ResetStats() + void Staff::resetStats() { for (auto peep : EntityList()) { - peep->SetHireDate(GetDate().GetMonthsElapsed()); - peep->StaffLawnsMown = 0; - peep->StaffRidesFixed = 0; - peep->StaffGardensWatered = 0; - peep->StaffRidesInspected = 0; - peep->StaffLitterSwept = 0; - peep->StaffVandalsStopped = 0; - peep->StaffBinsEmptied = 0; + peep->setHireDate(GetDate().GetMonthsElapsed()); + peep->staffLawnsMown = 0; + peep->staffRidesFixed = 0; + peep->staffGardensWatered = 0; + peep->staffRidesInspected = 0; + peep->staffLitterSwept = 0; + peep->staffVandalsStopped = 0; + peep->staffBinsEmptied = 0; peep->staffGuestsEntertained = 0; } } - bool Staff::IsPatrolAreaSet(const CoordsXY& coords) const + bool Staff::isPatrolAreaSet(const CoordsXY& coords) const { - if (PatrolInfo != nullptr) + if (patrolInfo != nullptr) { - return PatrolInfo->Get(coords); + return patrolInfo->Get(coords); } return false; } - void Staff::SetPatrolArea(const CoordsXY& coords, bool value) + void Staff::setPatrolArea(const CoordsXY& coords, bool value) { - if (PatrolInfo == nullptr) + if (patrolInfo == nullptr) { if (value) { - PatrolInfo = new PatrolArea(); + patrolInfo = new PatrolArea(); } else { @@ -279,29 +279,29 @@ namespace OpenRCT2 } } - PatrolInfo->Set(coords, value); + patrolInfo->Set(coords, value); } - void Staff::SetPatrolArea(const MapRange& range, bool value) + void Staff::setPatrolArea(const MapRange& range, bool value) { for (int32_t yy = range.GetY1(); yy <= range.GetY2(); yy += kCoordsXYStep) { for (int32_t xx = range.GetX1(); xx <= range.GetX2(); xx += kCoordsXYStep) { - SetPatrolArea({ xx, yy }, value); + setPatrolArea({ xx, yy }, value); } } } - void Staff::ClearPatrolArea() + void Staff::clearPatrolArea() { - delete PatrolInfo; - PatrolInfo = nullptr; + delete patrolInfo; + patrolInfo = nullptr; } - bool Staff::HasPatrolArea() const + bool Staff::hasPatrolArea() const { - return PatrolInfo == nullptr ? false : !PatrolInfo->IsEmpty(); + return patrolInfo == nullptr ? false : !patrolInfo->IsEmpty(); } /** @@ -310,7 +310,7 @@ namespace OpenRCT2 * * Returns kInvalidDirection when no nearby litter or unpathable litter */ - Direction Staff::HandymanDirectionToNearestLitter() const + Direction Staff::handymanDirectionToNearestLitter() const { // Maximum manhattan distance that litter can be for a handyman to seek to it constexpr auto kTileRadius = 3; @@ -344,7 +344,7 @@ namespace OpenRCT2 auto litterTile = CoordsXY{ nearestLitter->x, nearestLitter->y }.ToTileStart(); - if (!IsLocationInPatrol(litterTile)) + if (!isLocationInPatrol(litterTile)) { return kInvalidDirection; } @@ -391,7 +391,7 @@ namespace OpenRCT2 * * rct2: 0x006BF931 */ - uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const + uint8_t Staff::handymanDirectionToUncutGrass(uint8_t valid_directions) const { if (!(GetNextIsSurface())) { @@ -445,7 +445,7 @@ namespace OpenRCT2 * * rct2: 0x006BFD9C */ - Direction Staff::HandymanDirectionRandSurface(uint8_t validDirections) const + Direction Staff::handymanDirectionRandSurface(uint8_t validDirections) const { Direction newDirection = ScenarioRand() % kNumOrthogonalDirections; for (int32_t i = 0; i < kNumOrthogonalDirections; ++i, ++newDirection) @@ -472,29 +472,29 @@ namespace OpenRCT2 * * rct2: 0x006BFBA8 */ - bool Staff::DoHandymanPathFinding() + bool Staff::doHandymanPathFinding() { - StaffMowingTimeout++; + staffMowingTimeout++; Direction litterDirection = kInvalidDirection; - uint8_t validDirections = GetValidPatrolDirections(NextLoc); + uint8_t validDirections = getValidPatrolDirections(NextLoc); - if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((getGameState().currentTicks + id.ToUnderlying()) & 0xFFF) > 110) + if ((staffOrders & STAFF_ORDERS_SWEEPING) && ((getGameState().currentTicks + id.ToUnderlying()) & 0xFFF) > 110) { - litterDirection = HandymanDirectionToNearestLitter(); + litterDirection = handymanDirectionToNearestLitter(); } Direction newDirection = kInvalidDirection; - if (litterDirection == kInvalidDirection && (StaffOrders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) + if (litterDirection == kInvalidDirection && (staffOrders & STAFF_ORDERS_MOWING) && staffMowingTimeout >= 12) { - newDirection = HandymanDirectionToUncutGrass(validDirections); + newDirection = handymanDirectionToUncutGrass(validDirections); } if (newDirection == kInvalidDirection) { if (GetNextIsSurface()) { - newDirection = HandymanDirectionRandSurface(validDirections); + newDirection = handymanDirectionRandSurface(validDirections); } else { @@ -506,7 +506,7 @@ namespace OpenRCT2 uint8_t pathDirections = (pathElement->GetEdges() & validDirections) & 0xF; if (pathDirections == 0) { - newDirection = HandymanDirectionRandSurface(validDirections); + newDirection = handymanDirectionRandSurface(validDirections); } else { @@ -551,7 +551,7 @@ namespace OpenRCT2 while (!MapIsLocationValid(chosenTile)) { - newDirection = HandymanDirectionRandSurface(validDirections); + newDirection = handymanDirectionRandSurface(validDirections); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } @@ -564,7 +564,7 @@ namespace OpenRCT2 return false; } - Direction Staff::DirectionSurface(Direction initialDirection) const + Direction Staff::directionSurface(Direction initialDirection) const { uint8_t direction = initialDirection; for (int32_t i = 0; i < 3; ++i) @@ -606,7 +606,7 @@ namespace OpenRCT2 * * rct2: 0x006BFF45 */ - Direction Staff::MechanicDirectionSurface() const + Direction Staff::mechanicDirectionSurface() const { Direction direction = ScenarioRand() & 3; @@ -623,14 +623,14 @@ namespace OpenRCT2 direction = DirectionFromTo(CoordsXY(x, y), location.ToCoordsXY()); } - return DirectionSurface(direction); + return directionSurface(direction); } /** * * rct2: 0x006C02D1 */ - Direction Staff::MechanicDirectionPathRand(uint8_t pathDirections) const + Direction Staff::mechanicDirectionPathRand(uint8_t pathDirections) const { if (ScenarioRand() & 1) { @@ -654,14 +654,14 @@ namespace OpenRCT2 * * rct2: 0x006C0121 */ - Direction Staff::MechanicDirectionPath(uint8_t validDirections, PathElement* pathElement) + Direction Staff::mechanicDirectionPath(uint8_t validDirections, PathElement* pathElement) { uint32_t pathDirections = pathElement->GetEdges(); pathDirections &= validDirections; if (pathDirections == 0) { - return MechanicDirectionSurface(); + return mechanicDirectionSurface(); } // Check if this is dead end - i.e. only way out is the reverse direction. @@ -703,7 +703,7 @@ namespace OpenRCT2 // If no entrance is present either. This is an incorrect state. if (location.IsNull()) { - return MechanicDirectionPathRand(pathDirections); + return mechanicDirectionPathRand(pathDirections); } } @@ -719,25 +719,25 @@ namespace OpenRCT2 * edited the path layout or the mechanic was already stuck in the * save game (e.g. with a worse version of the pathfinding). */ ResetPathfindGoal(); - return MechanicDirectionPathRand(pathDirections); + return mechanicDirectionPathRand(pathDirections); } return pathfindDirection; } - return MechanicDirectionPathRand(pathDirections); + return mechanicDirectionPathRand(pathDirections); } /** * * rct2: 0x006BFF2C */ - bool Staff::DoMechanicPathFinding() + bool Staff::doMechanicPathFinding() { - uint8_t validDirections = GetValidPatrolDirections(NextLoc); + uint8_t validDirections = getValidPatrolDirections(NextLoc); Direction newDirection = kInvalidDirection; if (GetNextIsSurface()) { - newDirection = MechanicDirectionSurface(); + newDirection = mechanicDirectionSurface(); } else { @@ -745,7 +745,7 @@ namespace OpenRCT2 if (pathElement == nullptr) return true; - newDirection = MechanicDirectionPath(validDirections, pathElement); + newDirection = mechanicDirectionPath(validDirections, pathElement); } // countof(CoordsDirectionDelta) @@ -755,7 +755,7 @@ namespace OpenRCT2 while (!MapIsLocationValid(chosenTile)) { - newDirection = MechanicDirectionSurface(); + newDirection = mechanicDirectionSurface(); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } @@ -770,7 +770,7 @@ namespace OpenRCT2 * * rct2: 0x006C050B */ - Direction Staff::DirectionPath(uint8_t validDirections, PathElement* pathElement) const + Direction Staff::directionPath(uint8_t validDirections, PathElement* pathElement) const { uint32_t pathDirections = pathElement->GetEdges(); if (State != PeepState::answering && State != PeepState::headingToInspection) @@ -780,7 +780,7 @@ namespace OpenRCT2 if (pathDirections == 0) { - return DirectionSurface(ScenarioRand() & 3); + return directionSurface(ScenarioRand() & 3); } pathDirections &= ~(1u << DirectionReverse(PeepDirection)); @@ -811,14 +811,14 @@ namespace OpenRCT2 * * rct2: 0x006C0351 */ - bool Staff::DoMiscPathFinding() + bool Staff::doMiscPathFinding() { - uint8_t validDirections = GetValidPatrolDirections(NextLoc); + uint8_t validDirections = getValidPatrolDirections(NextLoc); Direction newDirection = kInvalidDirection; if (GetNextIsSurface()) { - newDirection = DirectionSurface(ScenarioRand() & 3); + newDirection = directionSurface(ScenarioRand() & 3); } else { @@ -826,14 +826,14 @@ namespace OpenRCT2 if (pathElement == nullptr) return true; - newDirection = DirectionPath(validDirections, pathElement); + newDirection = directionPath(validDirections, pathElement); } CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; while (!MapIsLocationValid(chosenTile)) { - newDirection = DirectionSurface(ScenarioRand() & 3); + newDirection = directionSurface(ScenarioRand() & 3); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } @@ -844,9 +844,9 @@ namespace OpenRCT2 return false; } - bool Staff::IsMechanicHeadingToFixRideBlockingPath() + bool Staff::isMechanicHeadingToFixRideBlockingPath() { - if (!IsMechanic()) + if (!isMechanic()) return false; auto tileCoords = TileCoordsXYZ(CoordsXYZ{ GetDestination(), NextLoc.z }); @@ -866,7 +866,7 @@ namespace OpenRCT2 * * rct2: 0x006C086D */ - void Staff::EntertainerUpdateNearbyPeeps() + void Staff::entertainerUpdateNearbyPeeps() { // Iterate over tiles within a 3-tile radius (96 units) constexpr auto kTileRadius = 3; @@ -916,7 +916,7 @@ namespace OpenRCT2 * * rct2: 0x006C05AE */ - bool Staff::DoEntertainerPathFinding() + bool Staff::doEntertainerPathFinding() { if (((ScenarioRand() & 0xFFFF) <= 0x4000) && IsActionInterruptableSafely()) { @@ -925,28 +925,28 @@ namespace OpenRCT2 AnimationImageIdOffset = 0; UpdateCurrentAnimationType(); - EntertainerUpdateNearbyPeeps(); + entertainerUpdateNearbyPeeps(); } - return DoMiscPathFinding(); + return doMiscPathFinding(); } /** * * rct2: 0x006BF926 */ - bool Staff::DoPathFinding() + bool Staff::doPathFinding() { - switch (AssignedStaffType) + switch (assignedStaffType) { case StaffType::handyman: - return DoHandymanPathFinding(); + return doHandymanPathFinding(); case StaffType::mechanic: - return DoMechanicPathFinding(); + return doMechanicPathFinding(); case StaffType::security: - return DoMiscPathFinding(); + return doMiscPathFinding(); case StaffType::entertainer: - return DoEntertainerPathFinding(); + return doEntertainerPathFinding(); default: assert(false); @@ -954,14 +954,14 @@ namespace OpenRCT2 } } - void Staff::SetHireDate(int32_t hireDate) + void Staff::setHireDate(int32_t value) { - HireDate = hireDate; + this->hireDate = value; } - int32_t Staff::GetHireDate() const + int32_t Staff::getHireDate() const { - return HireDate; + return hireDate; } Drawing::Colour StaffGetColour(StaffType staffType) @@ -1014,7 +1014,7 @@ namespace OpenRCT2 * * rct2: 0x006BF567 */ - void Staff::UpdateMowing() + void Staff::updateMowing() { if (!CheckForPath()) return; @@ -1053,7 +1053,7 @@ namespace OpenRCT2 surfaceElement->SetGrassLength(GRASS_LENGTH_MOWED); MapInvalidateTileZoom0({ NextLoc, surfaceElement->getBaseZ(), surfaceElement->getBaseZ() + 16 }); } - StaffLawnsMown = AddClamp(StaffLawnsMown, 1u); + staffLawnsMown = AddClamp(staffLawnsMown, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; } } @@ -1062,9 +1062,9 @@ namespace OpenRCT2 * * rct2: 0x006BF7E6 */ - void Staff::UpdateWatering() + void Staff::updateWatering() { - StaffMowingTimeout = 0; + staffMowingTimeout = 0; if (SubState == 0) { if (!CheckForPath()) @@ -1112,7 +1112,7 @@ namespace OpenRCT2 tile_element->asSmallScenery()->SetAge(0); MapInvalidateTileZoom0({ actionLoc, tile_element->getBaseZ(), tile_element->getClearanceZ() }); - StaffGardensWatered = AddClamp(StaffGardensWatered, 1u); + staffGardensWatered = AddClamp(staffGardensWatered, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; } while (!(tile_element++)->isLastForTile()); @@ -1124,9 +1124,9 @@ namespace OpenRCT2 * * rct2: 0x006BF6C9 */ - void Staff::UpdateEmptyingBin() + void Staff::updateEmptyingBin() { - StaffMowingTimeout = 0; + staffMowingTimeout = 0; if (SubState == 0) { @@ -1195,7 +1195,7 @@ namespace OpenRCT2 tile_element->asPath()->SetAdditionStatus(additionStatus); MapInvalidateTileZoom0({ NextLoc, tile_element->getBaseZ(), tile_element->getClearanceZ() }); - StaffBinsEmptied = AddClamp(StaffBinsEmptied, 1u); + staffBinsEmptied = AddClamp(staffBinsEmptied, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; } } @@ -1204,9 +1204,9 @@ namespace OpenRCT2 * * rct2: 0x6BF641 */ - void Staff::UpdateSweeping() + void Staff::updateSweeping() { - StaffMowingTimeout = 0; + staffMowingTimeout = 0; if (!CheckForPath()) return; @@ -1214,7 +1214,7 @@ namespace OpenRCT2 { // Remove sick at this location Litter::RemoveAt(getLocation()); - StaffLitterSwept = AddClamp(StaffLitterSwept, 1u); + staffLitterSwept = AddClamp(staffLitterSwept, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; } if (auto loc = UpdateAction(); loc.has_value()) @@ -1240,7 +1240,7 @@ namespace OpenRCT2 * * rct2: 0x006C16D7 */ - void Staff::UpdateHeadingToInspect() + void Staff::updateHeadingToInspect() { auto ride = GetRide(CurrentRide); if (ride == nullptr) @@ -1264,15 +1264,15 @@ namespace OpenRCT2 if (SubState == 0) { - MechanicTimeSinceCall = 0; + mechanicTimeSinceCall = 0; ResetPathfindGoal(); SubState = 2; } if (SubState <= 3) { - MechanicTimeSinceCall++; - if (MechanicTimeSinceCall > 2500) + mechanicTimeSinceCall++; + if (mechanicTimeSinceCall > 2500) { if (ride->flags.has(RideFlag::dueInspection) && ride->mechanicStatus == MechanicStatus::heading) { @@ -1285,7 +1285,7 @@ namespace OpenRCT2 if (!CheckForPath()) return; - if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath()) + if (ShouldWaitForLevelCrossing() && !isMechanicHeadingToFixRideBlockingPath()) return; const auto [pathingResult, rideEntranceExitElement] = PerformNextAction(); @@ -1341,7 +1341,7 @@ namespace OpenRCT2 * * rct2: 0x006C0CB8 */ - void Staff::UpdateAnswering() + void Staff::updateAnswering() { auto ride = GetRide(CurrentRide); if (ride == nullptr || ride->mechanicStatus != MechanicStatus::heading) @@ -1368,7 +1368,7 @@ namespace OpenRCT2 { SubState = 2; PeepWindowStateUpdate(this); - MechanicTimeSinceCall = 0; + mechanicTimeSinceCall = 0; ResetPathfindGoal(); return; } @@ -1378,8 +1378,8 @@ namespace OpenRCT2 } if (SubState <= 3) { - MechanicTimeSinceCall++; - if (MechanicTimeSinceCall > 2500) + mechanicTimeSinceCall++; + if (mechanicTimeSinceCall > 2500) { ride->mechanicStatus = MechanicStatus::calling; ride->windowInvalidateFlags.set(RideInvalidateFlag::maintenance); @@ -1390,7 +1390,7 @@ namespace OpenRCT2 if (!CheckForPath()) return; - if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath()) + if (ShouldWaitForLevelCrossing() && !isMechanicHeadingToFixRideBlockingPath()) return; const auto [pathingResult, rideEntranceExitElement] = PerformNextAction(); @@ -1453,9 +1453,9 @@ namespace OpenRCT2 * * rct2: 0x006BF483 */ - bool Staff::UpdatePatrollingFindWatering() + bool Staff::updatePatrollingFindWatering() { - if (!(StaffOrders & STAFF_ORDERS_WATER_FLOWERS)) + if (!(staffOrders & STAFF_ORDERS_WATER_FLOWERS)) return false; uint8_t chosen_position = ScenarioRand() & 7; @@ -1524,9 +1524,9 @@ namespace OpenRCT2 * * rct2: 0x006BF3A1 */ - bool Staff::UpdatePatrollingFindBin() + bool Staff::updatePatrollingFindBin() { - if (!(StaffOrders & STAFF_ORDERS_EMPTY_BINS)) + if (!(staffOrders & STAFF_ORDERS_EMPTY_BINS)) return false; if (GetNextIsSurface()) @@ -1588,12 +1588,12 @@ namespace OpenRCT2 * * rct2: 0x006BF322 */ - bool Staff::UpdatePatrollingFindGrass() + bool Staff::updatePatrollingFindGrass() { - if (!(StaffOrders & STAFF_ORDERS_MOWING)) + if (!(staffOrders & STAFF_ORDERS_MOWING)) return false; - if (StaffMowingTimeout < 12) + if (staffMowingTimeout < 12) return false; if (!(GetNextIsSurface())) @@ -1620,9 +1620,9 @@ namespace OpenRCT2 * * rct2: 0x006BF295 */ - bool Staff::UpdatePatrollingFindSweeping() + bool Staff::updatePatrollingFindSweeping() { - if (!(StaffOrders & STAFF_ORDERS_SWEEPING)) + if (!(staffOrders & STAFF_ORDERS_SWEEPING)) return false; auto quad = EntityTileList({ x, y }); for (auto litter : quad) @@ -1642,7 +1642,7 @@ namespace OpenRCT2 return false; } - bool Staff::SecurityGuardPathIsCrowded() const + bool Staff::securityGuardPathIsCrowded() const { // Iterate over tiles within a 3-tile radius (96 units) constexpr auto kTileRadius = 3; @@ -1685,14 +1685,14 @@ namespace OpenRCT2 return false; } - void Staff::Tick128UpdateStaff() + void Staff::tick128UpdateStaff() { - if (AssignedStaffType != StaffType::security) + if (assignedStaffType != StaffType::security) return; // Alternate between walking animations based on crowd size auto newAnimationGroup = PeepAnimationGroup::normal; - if (State == PeepState::patrolling && SecurityGuardPathIsCrowded()) + if (State == PeepState::patrolling && securityGuardPathIsCrowded()) newAnimationGroup = PeepAnimationGroup::alternate; if (AnimationGroup == newAnimationGroup) @@ -1718,14 +1718,14 @@ namespace OpenRCT2 UpdateCurrentAnimationType(); } - bool Staff::IsMechanic() const + bool Staff::isMechanic() const { - return AssignedStaffType == StaffType::mechanic; + return assignedStaffType == StaffType::mechanic; } bool Staff::isEntertainer() const { - return AssignedStaffType == StaffType::entertainer; + return assignedStaffType == StaffType::entertainer; } void Staff::Update() @@ -1781,31 +1781,31 @@ namespace OpenRCT2 UpdatePicked(); break; case PeepState::patrolling: - UpdatePatrolling(); + updatePatrolling(); break; case PeepState::mowing: - UpdateMowing(); + updateMowing(); break; case PeepState::sweeping: - UpdateSweeping(); + updateSweeping(); break; case PeepState::answering: - UpdateAnswering(); + updateAnswering(); break; case PeepState::fixing: - UpdateFixing(stepsToTake); + updateFixing(stepsToTake); break; case PeepState::inspecting: - UpdateFixing(stepsToTake); + updateFixing(stepsToTake); break; case PeepState::emptyingBin: - UpdateEmptyingBin(); + updateEmptyingBin(); break; case PeepState::watering: - UpdateWatering(); + updateWatering(); break; case PeepState::headingToInspection: - UpdateHeadingToInspect(); + updateHeadingToInspect(); break; default: // TODO reset to default state @@ -1819,12 +1819,12 @@ namespace OpenRCT2 * * rct2: 0x006BF1FD */ - void Staff::UpdatePatrolling() + void Staff::updatePatrolling() { if (!CheckForPath()) return; - if (ShouldWaitForLevelCrossing() && !IsMechanicHeadingToFixRideBlockingPath()) + if (ShouldWaitForLevelCrossing() && !isMechanicHeadingToFixRideBlockingPath()) { UpdateWaitingAtCrossing(); return; @@ -1850,19 +1850,19 @@ namespace OpenRCT2 } } - if (AssignedStaffType != StaffType::handyman) + if (assignedStaffType != StaffType::handyman) return; - if (UpdatePatrollingFindSweeping()) + if (updatePatrollingFindSweeping()) return; - if (UpdatePatrollingFindGrass()) + if (updatePatrollingFindGrass()) return; - if (UpdatePatrollingFindBin()) + if (updatePatrollingFindBin()) return; - UpdatePatrollingFindWatering(); + updatePatrollingFindWatering(); } enum @@ -1970,7 +1970,7 @@ namespace OpenRCT2 * rct2: 0x006C0E8B * Also used by inspecting. */ - void Staff::UpdateFixing(int32_t steps) + void Staff::updateFixing(int32_t steps) { auto ride = GetRide(CurrentRide); if (ride == nullptr) @@ -1995,54 +1995,54 @@ namespace OpenRCT2 { case PEEP_FIXING_ENTER_STATION: NextFlags &= ~PEEP_NEXT_FLAG_IS_SLOPED; - progressToNextSubstate = UpdateFixingEnterStation(*ride); + progressToNextSubstate = updateFixingEnterStation(*ride); break; case PEEP_FIXING_MOVE_TO_BROKEN_DOWN_VEHICLE: - progressToNextSubstate = UpdateFixingMoveToBrokenDownVehicle(firstRun, *ride); + progressToNextSubstate = updateFixingMoveToBrokenDownVehicle(firstRun, *ride); break; case PEEP_FIXING_FIX_VEHICLE_CLOSED_RESTRAINTS: case PEEP_FIXING_FIX_VEHICLE_CLOSED_DOORS: case PEEP_FIXING_FIX_VEHICLE_OPEN_RESTRAINTS: case PEEP_FIXING_FIX_VEHICLE_OPEN_DOORS: - progressToNextSubstate = UpdateFixingFixVehicle(firstRun, *ride); + progressToNextSubstate = updateFixingFixVehicle(firstRun, *ride); break; case PEEP_FIXING_FIX_VEHICLE_MALFUNCTION: - progressToNextSubstate = UpdateFixingFixVehicleMalfunction(firstRun, *ride); + progressToNextSubstate = updateFixingFixVehicleMalfunction(firstRun, *ride); break; case PEEP_FIXING_MOVE_TO_STATION_END: - progressToNextSubstate = UpdateFixingMoveToStationEnd(firstRun, *ride); + progressToNextSubstate = updateFixingMoveToStationEnd(firstRun, *ride); break; case PEEP_FIXING_FIX_STATION_END: - progressToNextSubstate = UpdateFixingFixStationEnd(firstRun); + progressToNextSubstate = updateFixingFixStationEnd(firstRun); break; case PEEP_FIXING_MOVE_TO_STATION_START: - progressToNextSubstate = UpdateFixingMoveToStationStart(firstRun, *ride); + progressToNextSubstate = updateFixingMoveToStationStart(firstRun, *ride); break; case PEEP_FIXING_FIX_STATION_START: - progressToNextSubstate = UpdateFixingFixStationStart(firstRun, *ride); + progressToNextSubstate = updateFixingFixStationStart(firstRun, *ride); break; case PEEP_FIXING_FIX_STATION_BRAKES: - progressToNextSubstate = UpdateFixingFixStationBrakes(firstRun, *ride); + progressToNextSubstate = updateFixingFixStationBrakes(firstRun, *ride); break; case PEEP_FIXING_MOVE_TO_STATION_EXIT: - progressToNextSubstate = UpdateFixingMoveToStationExit(firstRun, *ride); + progressToNextSubstate = updateFixingMoveToStationExit(firstRun, *ride); break; case PEEP_FIXING_FINISH_FIX_OR_INSPECT: - progressToNextSubstate = UpdateFixingFinishFixOrInspect(firstRun, steps, *ride); + progressToNextSubstate = updateFixingFinishFixOrInspect(firstRun, steps, *ride); break; case PEEP_FIXING_LEAVE_BY_ENTRANCE_EXIT: - progressToNextSubstate = UpdateFixingLeaveByEntranceExit(firstRun, *ride); + progressToNextSubstate = updateFixingLeaveByEntranceExit(firstRun, *ride); break; default: @@ -2078,7 +2078,7 @@ namespace OpenRCT2 * rct2: 0x006C0EEC * fixing SubState: enter_station - applies to fixing all break down reasons and ride inspections. */ - bool Staff::UpdateFixingEnterStation(Ride& ride) const + bool Staff::updateFixingEnterStation(Ride& ride) const { ride.mechanicStatus = MechanicStatus::fixing; ride.windowInvalidateFlags.set(RideInvalidateFlag::maintenance); @@ -2091,7 +2091,7 @@ namespace OpenRCT2 * fixing SubState: move_to_broken_down_vehicle - applies to fixing all vehicle specific breakdown reasons * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride) + bool Staff::updateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2144,7 +2144,7 @@ namespace OpenRCT2 * 4. doors stuck open. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride) + bool Staff::updateFixingFixVehicle(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2186,7 +2186,7 @@ namespace OpenRCT2 * fixing SubState: fix_vehicle_malfunction - applies fixing to vehicle malfunction. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride) + bool Staff::updateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2236,7 +2236,7 @@ namespace OpenRCT2 * inspection. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingMoveToStationEnd(bool firstRun, const Ride& ride) + bool Staff::updateFixingMoveToStationEnd(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2292,7 +2292,7 @@ namespace OpenRCT2 * inspection. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFixStationEnd(bool firstRun) + bool Staff::updateFixingFixStationEnd(bool firstRun) { if (!firstRun) { @@ -2323,7 +2323,7 @@ namespace OpenRCT2 * 3. applies to inspection. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingMoveToStationStart(bool firstRun, const Ride& ride) + bool Staff::updateFixingMoveToStationStart(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2400,7 +2400,7 @@ namespace OpenRCT2 * 2. applies to inspection. * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride& ride) + bool Staff::updateFixingFixStationStart(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2434,7 +2434,7 @@ namespace OpenRCT2 * fixing SubState: fix_station_brakes - applies to fixing brake failure * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride& ride) + bool Staff::updateFixingFixStationBrakes(bool firstRun, Ride& ride) { if (!firstRun) { @@ -2475,7 +2475,7 @@ namespace OpenRCT2 * fixing SubState: move_to_station_exit - applies to fixing all failures & inspections * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingMoveToStationExit(bool firstRun, const Ride& ride) + bool Staff::updateFixingMoveToStationExit(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2513,21 +2513,21 @@ namespace OpenRCT2 * fixing SubState: finish_fix_or_inspect - applies to fixing all failures & inspections * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride) + bool Staff::updateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride) { if (!firstRun) { if (State == PeepState::inspecting) { - UpdateRideInspected(CurrentRide); + updateRideInspected(CurrentRide); - StaffRidesInspected = AddClamp(StaffRidesInspected, 1u); + staffRidesInspected = AddClamp(staffRidesInspected, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; ride.mechanicStatus = MechanicStatus::undefined; return true; } - StaffRidesFixed = AddClamp(StaffRidesFixed, 1u); + staffRidesFixed = AddClamp(staffRidesFixed, 1u); WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS; orientation = PeepDirection << 3; @@ -2555,7 +2555,7 @@ namespace OpenRCT2 * fixing SubState: leave_by_entrance_exit - applies to fixing all failures & inspections * - see FixingSubstatesForBreakdown[] */ - bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride) + bool Staff::updateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride) { if (!firstRun) { @@ -2599,7 +2599,7 @@ namespace OpenRCT2 /** * rct2: 0x6B7588 */ - void Staff::UpdateRideInspected(RideId rideIndex) + void Staff::updateRideInspected(RideId rideIndex) { auto ride = GetRide(rideIndex); if (ride != nullptr) @@ -2631,14 +2631,14 @@ namespace OpenRCT2 void Staff::serialise(DataSerialiser& stream) { Peep::serialise(stream); - stream << AssignedStaffType; - stream << MechanicTimeSinceCall; - stream << HireDate; - stream << StaffOrders; - stream << StaffMowingTimeout; - stream << StaffLawnsMown; // union with StaffRidesFixed, staffGuestsEntertained - stream << StaffGardensWatered; // union with StaffRidesInspected - stream << StaffLitterSwept; // union with StaffVandalsStopped - stream << StaffBinsEmptied; + stream << assignedStaffType; + stream << mechanicTimeSinceCall; + stream << hireDate; + stream << staffOrders; + stream << staffMowingTimeout; + stream << staffLawnsMown; // union with staffRidesFixed, staffGuestsEntertained + stream << staffGardensWatered; // union with staffRidesInspected + stream << staffLitterSwept; // union with staffVandalsStopped + stream << staffBinsEmptied; } } // namespace OpenRCT2 diff --git a/src/openrct2/entity/Staff.h b/src/openrct2/entity/Staff.h index 8e635a34f1..1d6a38ec5f 100644 --- a/src/openrct2/entity/Staff.h +++ b/src/openrct2/entity/Staff.h @@ -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); diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 9748077f89..d1b75d6cb1 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -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()); } } diff --git a/src/openrct2/management/Finance.cpp b/src/openrct2/management/Finance.cpp index 04bd9b3654..5cd1842faa 100644 --- a/src/openrct2/management/Finance.cpp +++ b/src/openrct2/management/Finance.cpp @@ -120,7 +120,7 @@ void FinancePayWages() for (auto peep : EntityList()) { - 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()) { - current_profit -= GetStaffWage(peep->AssignedStaffType); + current_profit -= GetStaffWage(peep->assignedStaffType); } // Research costs diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index 4139519153..499e402658 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -76,7 +76,7 @@ void EntityPaintSetup(PaintSession& session, const CoordsXY& pos) const auto staff = entity->as(); if (staff != nullptr) { - if (staff->AssignedStaffType != StaffType::handyman) + if (staff->assignedStaffType != StaffType::handyman) { continue; } diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 4c1ec1c0c0..5b2e6291d9 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -825,11 +825,11 @@ std::optional GetPatrolAreaTileColour(const CoordsXY& auto* staff = getGameState().entities.GetEntity(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; } diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index 5ce11d13ad..f6e5cb426c 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -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(); cs.ignore(); - cs.readWrite(staff->HireDate); + cs.readWrite(staff->hireDate); cs.ignore(); cs.ignore(); cs.ignore(); @@ -2072,7 +2072,7 @@ namespace OpenRCT2 else { cs.ignore(); - cs.readWrite(staff->StaffOrders); + cs.readWrite(staff->staffOrders); cs.ignore(); } } @@ -2128,12 +2128,12 @@ namespace OpenRCT2 else { cs.ignore(); - cs.readWrite(staff->StaffMowingTimeout); + cs.readWrite(staff->staffMowingTimeout); cs.ignore(); - 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(); cs.ignore(); cs.ignore(); @@ -2494,24 +2494,24 @@ namespace OpenRCT2 ReadWritePeep(os, cs, entity); std::vector 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(); } - 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<> diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 243885f0dc..4ef91831c5 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -732,7 +732,7 @@ namespace OpenRCT2::PathFinding if (currentElementIsWide) { const Staff* staff = peep.as(); - 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(); - 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(); - 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( diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c334d38d04..bbbebda3bb 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -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(EntityId::FromUnderlying(srcBase.EntityIndex)); auto* src = static_cast(&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); } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6f0f05fe06..9e6245900d 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -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(&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); } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index d7e6e37746..dde5417fe2 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1525,7 +1525,7 @@ Staff* FindClosestMechanic(const CoordsXY& entrancePosition, int32_t forInspecti for (auto peep : EntityList()) { - 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(ride.mechanic); - if (staff != nullptr && staff->IsMechanic()) + if (staff != nullptr && staff->isMechanic()) { return staff; } diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 7dbc27a347..c5b869fa91 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -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) diff --git a/src/openrct2/scripting/bindings/entity/ScStaff.cpp b/src/openrct2/scripting/bindings/entity/ScStaff.cpp index 3f2df9ffd2..3d49fec257 100644 --- a/src/openrct2/scripting/bindings/entity/ScStaff.cpp +++ b/src/openrct2/scripting/bindings/entity/ScStaff.cpp @@ -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); } diff --git a/src/openrct2/scripting/bindings/world/ScMap.cpp b/src/openrct2/scripting/bindings/world/ScMap.cpp index 129362f2b4..310b4d0fbf 100644 --- a/src/openrct2/scripting/bindings/world/ScMap.cpp +++ b/src/openrct2/scripting/bindings/world/ScMap.cpp @@ -192,7 +192,7 @@ namespace OpenRCT2::Scripting auto staff = getGameState().entities.GetEntity(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(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(spriteId); if (staff != nullptr) { - switch (staff->AssignedStaffType) + switch (staff->assignedStaffType) { case StaffType::handyman: return ScHandyman::New(ctx, spriteId); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index a2c153f5b5..521916767a 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -2314,7 +2314,7 @@ namespace OpenRCT2 auto staff = entity->as(); if (staff != nullptr) { - auto patrol = staff->PatrolInfo; + auto patrol = staff->patrolInfo; if (patrol != nullptr) { auto positions = patrol->ToVector();