From 0e170d40d43bbe5a93d303fbf761de93b1878f21 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:21:06 -0300 Subject: [PATCH 01/16] Rename Peep::staff_mowing_timeout to StaffMowingTimeout --- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index 1101d5c9c5..053fa36d31 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -244,7 +244,7 @@ private: // Staff energy determines their walking speed newPeep->energy = 0x60; newPeep->energy_target = 0x60; - newPeep->staff_mowing_timeout = 0; + newPeep->StaffMowingTimeout = 0; newPeep->staff_id = staffIndex; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index e4fe95fd4a..35fa391ba3 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -3170,7 +3170,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) if (type == PEEP_TYPE_STAFF && !GetNextIsSurface()) { // Prevent staff from leaving the path on their own unless they're allowed to mow. - if (!((this->staff_orders & STAFF_ORDERS_MOWING) && this->staff_mowing_timeout >= 12)) + if (!((this->staff_orders & STAFF_ORDERS_MOWING) && this->StaffMowingTimeout >= 12)) { peep_return_to_centre_of_tile(this); return; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 07d85a1084..571f99b5d9 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -706,7 +706,7 @@ struct Peep : SpriteBase union { uint8_t time_on_ride; - uint8_t staff_mowing_timeout; + uint8_t StaffMowingTimeout; }; // 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t DisgustingCount; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index aeeeaf543a..ae3bc74793 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -611,7 +611,7 @@ int32_t Staff::HandymanDirectionRandSurface(uint8_t validDirections) */ bool Staff::DoHandymanPathFinding() { - staff_mowing_timeout++; + StaffMowingTimeout++; uint8_t litterDirection = INVALID_DIRECTION; uint8_t validDirections = staff_get_valid_patrol_directions(this, NextLoc); @@ -622,7 +622,7 @@ bool Staff::DoHandymanPathFinding() } Direction newDirection = INVALID_DIRECTION; - if (litterDirection == INVALID_DIRECTION && (staff_orders & STAFF_ORDERS_MOWING) && staff_mowing_timeout >= 12) + if (litterDirection == INVALID_DIRECTION && (staff_orders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) { newDirection = staff_handyman_direction_to_uncut_grass(this, validDirections); } @@ -1242,7 +1242,7 @@ void Staff::UpdateMowing() */ void Staff::UpdateWatering() { - staff_mowing_timeout = 0; + StaffMowingTimeout = 0; if (sub_state == 0) { if (!CheckForPath()) @@ -1305,7 +1305,7 @@ void Staff::UpdateWatering() */ void Staff::UpdateEmptyingBin() { - staff_mowing_timeout = 0; + StaffMowingTimeout = 0; if (sub_state == 0) { @@ -1386,7 +1386,7 @@ void Staff::UpdateEmptyingBin() */ void Staff::UpdateSweeping() { - staff_mowing_timeout = 0; + StaffMowingTimeout = 0; if (!CheckForPath()) return; @@ -1785,7 +1785,7 @@ static int32_t peep_update_patrolling_find_grass(Peep* peep) if (!(peep->staff_orders & STAFF_ORDERS_MOWING)) return 0; - if (peep->staff_mowing_timeout < 12) + if (peep->StaffMowingTimeout < 12) return 0; if (!(peep->GetNextIsSurface())) From 7665d1386fe9ba6fecdedad5cf4e290ee657d45c Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:25:34 -0300 Subject: [PATCH 02/16] Rename Peep:time_on_ride to TimeOnRide --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 12 ++++++------ src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 826db59a94..970bd1e6f9 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -292,7 +292,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots } COMPARE_FIELD(Peep, no_action_frame_num); COMPARE_FIELD(Peep, litter_count); - COMPARE_FIELD(Peep, time_on_ride); + COMPARE_FIELD(Peep, TimeOnRide); COMPARE_FIELD(Peep, DisgustingCount); COMPARE_FIELD(Peep, PaidToEnter); COMPARE_FIELD(Peep, PaidOnRides); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 6588106aeb..befe288de4 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -776,18 +776,18 @@ void Guest::Tick128UpdateGuest(int32_t index) if (state == PEEP_STATE_ON_RIDE || state == PEEP_STATE_ENTERING_RIDE) { - time_on_ride = std::min(255, time_on_ride + 1); + TimeOnRide = std::min(255, TimeOnRide + 1); if (peep_flags & PEEP_FLAGS_WOW) { InsertNewThought(PEEP_THOUGHT_TYPE_WOW2, PEEP_THOUGHT_ITEM_NONE); } - if (time_on_ride > 15) + if (TimeOnRide > 15) { happiness_target = std::max(0, happiness_target - 5); - if (time_on_ride > 22) + if (TimeOnRide > 22) { auto ride = get_ride(current_ride); if (ride != nullptr) @@ -2548,7 +2548,7 @@ void Guest::GoToRideEntrance(Ride* ride) sub_state = PEEP_RIDE_IN_ENTRANCE; rejoin_queue_timeout = 0; - time_on_ride = 0; + TimeOnRide = 0; RemoveFromQueue(); } @@ -4079,7 +4079,7 @@ void Guest::UpdateRideEnterVehicle() vehicle->mass += seatedPeepAsGuest->mass; seatedPeepAsGuest->MoveTo({ LOCATION_NULL, 0, 0 }); seatedPeepAsGuest->SetState(PEEP_STATE_ON_RIDE); - seatedPeepAsGuest->time_on_ride = 0; + seatedPeepAsGuest->TimeOnRide = 0; seatedPeepAsGuest->sub_state = PEEP_RIDE_ON_RIDE; seatedPeepAsGuest->OnEnterRide(current_ride); } @@ -4095,7 +4095,7 @@ void Guest::UpdateRideEnterVehicle() SetState(PEEP_STATE_ON_RIDE); - time_on_ride = 0; + TimeOnRide = 0; sub_state = PEEP_RIDE_ON_RIDE; OnEnterRide(current_ride); } diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 35fa391ba3..aaa05dd10a 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2976,7 +2976,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen peep->SetState(PEEP_STATE_ENTERING_RIDE); peep->sub_state = PEEP_SHOP_APPROACH; - peep->time_on_ride = 0; + peep->TimeOnRide = 0; ride->cur_num_customers++; if (peep->peep_flags & PEEP_FLAGS_TRACKING) { diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 571f99b5d9..3fef87181a 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -705,7 +705,7 @@ struct Peep : SpriteBase uint8_t litter_count; union { - uint8_t time_on_ride; + uint8_t TimeOnRide; uint8_t StaffMowingTimeout; }; // 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index bb6a9a765c..ff7fea37b1 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1471,7 +1471,7 @@ private: dst->current_train = src->current_train; dst->current_car = src->current_car; dst->current_seat = src->current_seat; - dst->time_on_ride = src->time_on_ride; + dst->TimeOnRide = src->time_on_ride; dst->DaysInQueue = src->days_in_queue; dst->interaction_ride_index = src->interaction_ride_index; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index cf9563d244..4bf3048b0c 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1219,7 +1219,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } dst->no_action_frame_num = src->no_action_frame_num; dst->litter_count = src->litter_count; - dst->time_on_ride = src->time_on_ride; + dst->time_on_ride = src->TimeOnRide; dst->disgusting_count = src->DisgustingCount; dst->paid_to_enter = src->PaidToEnter; dst->paid_on_rides = src->PaidOnRides; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 58cfd0c5f4..480885794e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1484,7 +1484,7 @@ public: } dst->no_action_frame_num = src->no_action_frame_num; dst->litter_count = src->litter_count; - dst->time_on_ride = src->time_on_ride; + dst->TimeOnRide = src->time_on_ride; dst->DisgustingCount = src->disgusting_count; dst->PaidToEnter = src->paid_to_enter; dst->PaidOnRides = src->paid_on_rides; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index c3186b1ec5..a99c2419c4 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -245,7 +245,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) } COMPARE_FIELD(no_action_frame_num); COMPARE_FIELD(litter_count); - COMPARE_FIELD(time_on_ride); + COMPARE_FIELD(TimeOnRide); COMPARE_FIELD(DisgustingCount); COMPARE_FIELD(PaidToEnter); COMPARE_FIELD(PaidOnRides); From 0933cd4e5701f1c739b183f62efbd4eb90d65c9c Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:29:44 -0300 Subject: [PATCH 03/16] Rename Peep::litter_count to LitterCount --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/Peep.cpp | 12 ++++++------ src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 970bd1e6f9..ce5e9bcfdf 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -291,7 +291,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, pathfind_history[i]); } COMPARE_FIELD(Peep, no_action_frame_num); - COMPARE_FIELD(Peep, litter_count); + COMPARE_FIELD(Peep, LitterCount); COMPARE_FIELD(Peep, TimeOnRide); COMPARE_FIELD(Peep, DisgustingCount); COMPARE_FIELD(Peep, PaidToEnter); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index befe288de4..e81267205e 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -6212,7 +6212,7 @@ static void peep_update_walking_break_scenery(Peep* peep) if (peep->state != PEEP_STATE_WALKING) return; - if ((peep->litter_count & 0xC0) != 0xC0 && (peep->DisgustingCount & 0xC0) != 0xC0) + if ((peep->LitterCount & 0xC0) != 0xC0 && (peep->DisgustingCount & 0xC0) != 0xC0) return; if ((scenario_rand() & 0xFFFF) > 3276) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index aaa05dd10a..fc52954cb2 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1761,7 +1761,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->ItemStandardFlags = 0; peep->item_extra_flags = 0; peep->guest_heading_to_ride_id = RIDE_ID_NULL; - peep->litter_count = 0; + peep->LitterCount = 0; peep->DisgustingCount = 0; peep->VandalismSeen = 0; peep->PaidToEnter = 0; @@ -2753,14 +2753,14 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle } } - uint8_t litter_time = peep->litter_count & 0xC0; - litter_count = ((peep->litter_count & 0xF) << 2) | litter_count; - peep->litter_count = litter_count | litter_time; + uint8_t litter_time = peep->LitterCount & 0xC0; + litter_count = ((peep->LitterCount & 0xF) << 2) | litter_count; + peep->LitterCount = litter_count | litter_time; if (litter_time & 0xC0 && (scenario_rand() & 0xFFFF) <= 4369) { // Reduce the litter time - peep->litter_count -= 0x40; + peep->LitterCount -= 0x40; } else { @@ -2775,7 +2775,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle peep->InsertNewThought(PEEP_THOUGHT_TYPE_BAD_LITTER, PEEP_THOUGHT_ITEM_NONE); peep->happiness_target = std::max(0, peep->happiness_target - 17); // Reset litter time - peep->litter_count |= 0xC0; + peep->LitterCount |= 0xC0; } } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 3fef87181a..a58ae9aec0 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -702,7 +702,7 @@ struct Peep : SpriteBase rct12_xyzd8 pathfind_history[4]; uint8_t no_action_frame_num; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc - uint8_t litter_count; + uint8_t LitterCount; union { uint8_t TimeOnRide; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index ff7fea37b1..a08ebc2989 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1459,7 +1459,7 @@ private: dst->toilet = src->toilet; dst->mass = src->mass; - dst->litter_count = src->litter_count; + dst->LitterCount = src->litter_count; dst->DisgustingCount = src->disgusting_count; dst->intensity = static_cast(src->intensity); diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 4bf3048b0c..d67f45e482 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1218,7 +1218,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->pathfind_history[i] = src->pathfind_history[i]; } dst->no_action_frame_num = src->no_action_frame_num; - dst->litter_count = src->litter_count; + dst->litter_count = src->LitterCount; dst->time_on_ride = src->TimeOnRide; dst->disgusting_count = src->DisgustingCount; dst->paid_to_enter = src->PaidToEnter; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 480885794e..cc18fa0553 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1483,7 +1483,7 @@ public: dst->pathfind_history[i] = src->pathfind_history[i]; } dst->no_action_frame_num = src->no_action_frame_num; - dst->litter_count = src->litter_count; + dst->LitterCount = src->litter_count; dst->TimeOnRide = src->time_on_ride; dst->DisgustingCount = src->disgusting_count; dst->PaidToEnter = src->paid_to_enter; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index a99c2419c4..391edd0260 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -244,7 +244,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(pathfind_history[i].direction); } COMPARE_FIELD(no_action_frame_num); - COMPARE_FIELD(litter_count); + COMPARE_FIELD(LitterCount); COMPARE_FIELD(TimeOnRide); COMPARE_FIELD(DisgustingCount); COMPARE_FIELD(PaidToEnter); From f2808eecbebaf47bad533f8a1b96fe6653a99b3e Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:34:49 -0300 Subject: [PATCH 04/16] Rename Peep:no_action_frame_num to NoActionFrameNum --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/Peep.cpp | 10 +++++----- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index ce5e9bcfdf..e367a5773d 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -290,7 +290,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots { COMPARE_FIELD(Peep, pathfind_history[i]); } - COMPARE_FIELD(Peep, no_action_frame_num); + COMPARE_FIELD(Peep, NoActionFrameNum); COMPARE_FIELD(Peep, LitterCount); COMPARE_FIELD(Peep, TimeOnRide); COMPARE_FIELD(Peep, DisgustingCount); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index 053fa36d31..a59c86f5a7 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -163,7 +163,7 @@ private: newPeep->action = PEEP_ACTION_NONE_2; newPeep->special_sprite = 0; newPeep->action_sprite_image_offset = 0; - newPeep->no_action_frame_num = 0; + newPeep->NoActionFrameNum = 0; newPeep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; newPeep->path_check_optimisation = 0; newPeep->type = PEEP_TYPE_STAFF; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index e81267205e..f67b22f9f4 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -6765,7 +6765,7 @@ void Guest::SetSpriteType(PeepSpriteType new_sprite_type) sprite_type = new_sprite_type; action_sprite_image_offset = 0; - no_action_frame_num = 0; + NoActionFrameNum = 0; if (action >= PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index fc52954cb2..1f6d7ca443 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -631,14 +631,14 @@ std::optional Peep::UpdateAction(int16_t& xy_distance) sprite_direction = nextDirection; CoordsXY loc = { x, y }; loc += word_981D7C[nextDirection / 8]; - no_action_frame_num++; + NoActionFrameNum++; const rct_peep_animation* peepAnimation = g_peep_animation_entries[sprite_type].sprite_animation; const uint8_t* imageOffset = peepAnimation[action_sprite_type].frame_offsets; - if (no_action_frame_num >= peepAnimation[action_sprite_type].num_frames) + if (NoActionFrameNum >= peepAnimation[action_sprite_type].num_frames) { - no_action_frame_num = 0; + NoActionFrameNum = 0; } - action_sprite_image_offset = imageOffset[no_action_frame_num]; + action_sprite_image_offset = imageOffset[NoActionFrameNum]; return loc; } @@ -1631,7 +1631,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->action = PEEP_ACTION_NONE_2; peep->special_sprite = 0; peep->action_sprite_image_offset = 0; - peep->no_action_frame_num = 0; + peep->NoActionFrameNum = 0; peep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; peep->peep_flags = 0; peep->FavouriteRide = RIDE_ID_NULL; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index a58ae9aec0..51eb28a583 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -700,7 +700,7 @@ struct Peep : SpriteBase uint32_t peep_flags; rct12_xyzd8 pathfind_goal; rct12_xyzd8 pathfind_history[4]; - uint8_t no_action_frame_num; + uint8_t NoActionFrameNum; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t LitterCount; union diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index ae3bc74793..1fb519a1c7 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1856,7 +1856,7 @@ void Staff::Tick128UpdateStaff() sprite_type = newSpriteType; action_sprite_image_offset = 0; - no_action_frame_num = 0; + NoActionFrameNum = 0; if (action < PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index a08ebc2989..088f2e869c 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1395,7 +1395,7 @@ private: dst->special_sprite = src->special_sprite; dst->next_action_sprite_type = static_cast(src->next_action_sprite_type); dst->action_sprite_image_offset = src->action_sprite_image_offset; - dst->no_action_frame_num = src->no_action_frame_num; + dst->NoActionFrameNum = src->no_action_frame_num; dst->action_sprite_type = static_cast(src->action_sprite_type); dst->action_frame = src->action_frame; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index d67f45e482..a9232fcf98 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1217,7 +1217,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) { dst->pathfind_history[i] = src->pathfind_history[i]; } - dst->no_action_frame_num = src->no_action_frame_num; + dst->no_action_frame_num = src->NoActionFrameNum; dst->litter_count = src->LitterCount; dst->time_on_ride = src->TimeOnRide; dst->disgusting_count = src->DisgustingCount; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index cc18fa0553..43b7238b26 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1482,7 +1482,7 @@ public: { dst->pathfind_history[i] = src->pathfind_history[i]; } - dst->no_action_frame_num = src->no_action_frame_num; + dst->NoActionFrameNum = src->no_action_frame_num; dst->LitterCount = src->litter_count; dst->TimeOnRide = src->time_on_ride; dst->DisgustingCount = src->disgusting_count; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 391edd0260..763f412ae5 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -243,7 +243,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(pathfind_history[i].z); COMPARE_FIELD(pathfind_history[i].direction); } - COMPARE_FIELD(no_action_frame_num); + COMPARE_FIELD(NoActionFrameNum); COMPARE_FIELD(LitterCount); COMPARE_FIELD(TimeOnRide); COMPARE_FIELD(DisgustingCount); From cad809275e19efbf3880ba3d1a47a00fc0e95f7e Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:38:18 -0300 Subject: [PATCH 05/16] Rename Peep::pathfind_history to PathfindHistory --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 42 +++++++++++++------------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 4 +-- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 8 ++--- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index dbe940cf43..caa7249a7e 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -2123,7 +2123,7 @@ void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi) screenCoords.y += LIST_ROW_HEIGHT; screenCoords.x += 10; - for (auto& point : peep->pathfind_history) + for (auto& point : peep->PathfindHistory) { int32_t args[] = { point.x, point.y, point.z, point.direction }; gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_HISTORY_ITEM, args, 0, screenCoords.x, screenCoords.y); diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index e367a5773d..e5a5d07d6d 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -288,7 +288,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, pathfind_goal); for (int i = 0; i < 4; i++) { - COMPARE_FIELD(Peep, pathfind_history[i]); + COMPARE_FIELD(Peep, PathfindHistory[i]); } COMPARE_FIELD(Peep, NoActionFrameNum); COMPARE_FIELD(Peep, LitterCount); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 012109648e..6d760db358 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -975,14 +975,14 @@ static void peep_pathfind_heuristic_search( /* First check if going through the junction would be * a loop. If so, the current search path ends here. * Path finding loop detection can take advantage of both the - * peep->pathfind_history - loops through remembered junctions + * peep->PathfindHistory - loops through remembered junctions * the peep has already passed through getting to its * current position while on the way to its current goal; * _peepPathFindHistory - loops in the current search path. */ bool pathLoop = false; - /* Check the peep->pathfind_history to see if this junction has + /* Check the peep->PathfindHistory to see if this junction has * already been visited by the peep while heading for this goal. */ - for (auto& pathfindHistory : peep->pathfind_history) + for (auto& pathfindHistory : peep->PathfindHistory) { if (pathfindHistory.x == loc.x && pathfindHistory.y == loc.y && pathfindHistory.z == loc.z) { @@ -1221,7 +1221,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) } /* Check if this path element is a thin junction. - * Only 'thin' junctions are remembered in peep->pathfind_history. + * Only 'thin' junctions are remembered in peep->PathfindHistory. * NO attempt is made to merge the overlaid path elements and * check if the combination is 'thin'! * The junction is considered 'thin' simply if any of the @@ -1239,8 +1239,8 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) uint8_t edges = permitted_edges; if (isThin && peep->pathfind_goal.x == goal.x && peep->pathfind_goal.y == goal.y && peep->pathfind_goal.z == goal.z) { - /* Use of peep->pathfind_history[]: - * When walking to a goal, the peep pathfind_history stores + /* Use of peep->PathfindHistory[]: + * When walking to a goal, the peep PathfindHistory stores * the last 4 thin junctions that the peep walked through. * For each of these 4 thin junctions the peep remembers * those edges it has not yet taken. @@ -1254,11 +1254,11 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) /* If the peep remembers walking through this junction * previously while heading for its goal, retrieve the * directions it has not yet tried. */ - for (auto& pathfindHistory : peep->pathfind_history) + for (auto& pathfindHistory : peep->PathfindHistory) { if (pathfindHistory.x == loc.x && pathfindHistory.y == loc.y && pathfindHistory.z == loc.z) { - /* Fix broken pathfind_history[i].direction + /* Fix broken PathfindHistory[i].direction * which have untried directions that are not * currently possible - could be due to pathing * changes or in earlier code .directions was @@ -1303,7 +1303,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) } /* If this is a new goal for the peep. Store it and reset the peep's - * pathfind_history. */ + * PathfindHistory. */ if (!direction_valid(peep->pathfind_goal.direction) || peep->pathfind_goal.x != goal.x || peep->pathfind_goal.y != goal.y || peep->pathfind_goal.z != goal.z) { @@ -1313,7 +1313,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) peep->pathfind_goal.direction = 0; // Clear pathfinding history - std::fill_n(reinterpret_cast(peep->pathfind_history), sizeof(peep->pathfind_history), 0xFF); + std::fill_n(reinterpret_cast(peep->PathfindHistory), sizeof(peep->PathfindHistory), 0xFF); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -1488,15 +1488,15 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) { for (int32_t i = 0; i < 4; ++i) { - if (peep->pathfind_history[i].x == loc.x && peep->pathfind_history[i].y == loc.y - && peep->pathfind_history[i].z == loc.z) + if (peep->PathfindHistory[i].x == loc.x && peep->PathfindHistory[i].y == loc.y + && peep->PathfindHistory[i].z == loc.z) { /* Peep remembers this junction, so remove the * chosen_edge from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << chosen_edge); + peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -1513,15 +1513,15 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) * and remember this junction. */ int32_t i = peep->pathfind_goal.direction++; peep->pathfind_goal.direction &= 3; - peep->pathfind_history[i].x = static_cast(loc.x); - peep->pathfind_history[i].y = static_cast(loc.y); - peep->pathfind_history[i].z = loc.z; - peep->pathfind_history[i].direction = permitted_edges; + peep->PathfindHistory[i].x = static_cast(loc.x); + peep->PathfindHistory[i].y = static_cast(loc.y); + peep->PathfindHistory[i].z = loc.z; + peep->PathfindHistory[i].direction = permitted_edges; /* Remove the chosen_edge from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << chosen_edge); + peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->pathfind_history[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { @@ -2147,7 +2147,7 @@ int32_t guest_path_finding(Guest* peep) if (direction == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the pathfind_history + * Reset the pathfind_goal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 51eb28a583..40ca0ac150 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -699,7 +699,7 @@ struct Peep : SpriteBase uint8_t photo1_ride_ref; uint32_t peep_flags; rct12_xyzd8 pathfind_goal; - rct12_xyzd8 pathfind_history[4]; + rct12_xyzd8 PathfindHistory[4]; uint8_t NoActionFrameNum; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t LitterCount; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 1fb519a1c7..e49ecff526 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -875,7 +875,7 @@ static uint8_t staff_mechanic_direction_path(Peep* peep, uint8_t validDirections if (pathfindDirection == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the pathfind_history + * Reset the pathfind_goal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index a9232fcf98..96be9026b8 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1213,9 +1213,9 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->photo1_ride_ref = src->photo1_ride_ref; dst->peep_flags = src->peep_flags; dst->pathfind_goal = src->pathfind_goal; - for (size_t i = 0; i < std::size(src->pathfind_history); i++) + for (size_t i = 0; i < std::size(src->PathfindHistory); i++) { - dst->pathfind_history[i] = src->pathfind_history[i]; + dst->pathfind_history[i] = src->PathfindHistory[i]; } dst->no_action_frame_num = src->NoActionFrameNum; dst->litter_count = src->LitterCount; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 43b7238b26..61c629f045 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1480,7 +1480,7 @@ public: dst->pathfind_goal = src->pathfind_goal; for (size_t i = 0; i < std::size(src->pathfind_history); i++) { - dst->pathfind_history[i] = src->pathfind_history[i]; + dst->PathfindHistory[i] = src->pathfind_history[i]; } dst->NoActionFrameNum = src->no_action_frame_num; dst->LitterCount = src->litter_count; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 763f412ae5..0aff08721e 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -238,10 +238,10 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(pathfind_goal.direction); for (int i = 0; i < 4; i++) { - COMPARE_FIELD(pathfind_history[i].x); - COMPARE_FIELD(pathfind_history[i].y); - COMPARE_FIELD(pathfind_history[i].z); - COMPARE_FIELD(pathfind_history[i].direction); + COMPARE_FIELD(PathfindHistory[i].x); + COMPARE_FIELD(PathfindHistory[i].y); + COMPARE_FIELD(PathfindHistory[i].z); + COMPARE_FIELD(PathfindHistory[i].direction); } COMPARE_FIELD(NoActionFrameNum); COMPARE_FIELD(LitterCount); From 53bff03a3f72bdb223dd5cf67c47880374a9601b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:42:49 -0300 Subject: [PATCH 06/16] Rename Peep::pathfind_goal to PathfindGoal --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 8 ++++---- src/openrct2/peep/GuestPathfinding.cpp | 20 ++++++++++---------- src/openrct2/peep/Peep.cpp | 18 +++++++++--------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 8 ++++---- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 8 ++++---- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index caa7249a7e..8f6fb4b802 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -2115,7 +2115,7 @@ void window_guest_debug_paint(rct_window* w, rct_drawpixelinfo* dpi) } screenCoords.y += LIST_ROW_HEIGHT; { - int32_t args[] = { peep->pathfind_goal.x, peep->pathfind_goal.y, peep->pathfind_goal.z, peep->pathfind_goal.direction }; + int32_t args[] = { peep->PathfindGoal.x, peep->PathfindGoal.y, peep->PathfindGoal.z, peep->PathfindGoal.direction }; gfx_draw_string_left(dpi, STR_PEEP_DEBUG_PATHFIND_GOAL, args, 0, screenCoords.x, screenCoords.y); } screenCoords.y += LIST_ROW_HEIGHT; diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index e5a5d07d6d..8e6b91e542 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -285,7 +285,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, staff_orders); COMPARE_FIELD(Peep, photo1_ride_ref); COMPARE_FIELD(Peep, peep_flags); - COMPARE_FIELD(Peep, pathfind_goal); + COMPARE_FIELD(Peep, PathfindGoal); for (int i = 0; i < 4; i++) { COMPARE_FIELD(Peep, PathfindHistory[i]); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index a59c86f5a7..c2354b3d86 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -232,10 +232,10 @@ private: // Staff uses this newPeep->time_in_park = gDateMonthsElapsed; - newPeep->pathfind_goal.x = 0xFF; - newPeep->pathfind_goal.y = 0xFF; - newPeep->pathfind_goal.z = 0xFF; - newPeep->pathfind_goal.direction = INVALID_DIRECTION; + newPeep->PathfindGoal.x = 0xFF; + newPeep->PathfindGoal.y = 0xFF; + newPeep->PathfindGoal.z = 0xFF; + newPeep->PathfindGoal.direction = INVALID_DIRECTION; uint8_t colour = staff_get_colour(_staffType); newPeep->tshirt_colour = colour; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 6d760db358..273faabd94 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -1237,7 +1237,7 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) permitted_edges &= 0xF; uint8_t edges = permitted_edges; - if (isThin && peep->pathfind_goal.x == goal.x && peep->pathfind_goal.y == goal.y && peep->pathfind_goal.z == goal.z) + if (isThin && peep->PathfindGoal.x == goal.x && peep->PathfindGoal.y == goal.y && peep->PathfindGoal.z == goal.z) { /* Use of peep->PathfindHistory[]: * When walking to a goal, the peep PathfindHistory stores @@ -1304,13 +1304,13 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) /* If this is a new goal for the peep. Store it and reset the peep's * PathfindHistory. */ - if (!direction_valid(peep->pathfind_goal.direction) || peep->pathfind_goal.x != goal.x || peep->pathfind_goal.y != goal.y - || peep->pathfind_goal.z != goal.z) + if (!direction_valid(peep->PathfindGoal.direction) || peep->PathfindGoal.x != goal.x || peep->PathfindGoal.y != goal.y + || peep->PathfindGoal.z != goal.z) { - peep->pathfind_goal.x = goal.x; - peep->pathfind_goal.y = goal.y; - peep->pathfind_goal.z = goal.z; - peep->pathfind_goal.direction = 0; + peep->PathfindGoal.x = goal.x; + peep->PathfindGoal.y = goal.y; + peep->PathfindGoal.z = goal.z; + peep->PathfindGoal.direction = 0; // Clear pathfinding history std::fill_n(reinterpret_cast(peep->PathfindHistory), sizeof(peep->PathfindHistory), 0xFF); @@ -1511,8 +1511,8 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) /* Peep does not remember this junction, so forget a junction * and remember this junction. */ - int32_t i = peep->pathfind_goal.direction++; - peep->pathfind_goal.direction &= 3; + int32_t i = peep->PathfindGoal.direction++; + peep->PathfindGoal.direction &= 3; peep->PathfindHistory[i].x = static_cast(loc.x); peep->PathfindHistory[i].y = static_cast(loc.y); peep->PathfindHistory[i].z = loc.z; @@ -2147,7 +2147,7 @@ int32_t guest_path_finding(Guest* peep) if (direction == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the PathfindHistory + * Reset the PathfindGoal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 1f6d7ca443..587d891460 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1754,10 +1754,10 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->cash_in_pocket = cash; peep->cash_spent = 0; peep->time_in_park = -1; - peep->pathfind_goal.x = 0xFF; - peep->pathfind_goal.y = 0xFF; - peep->pathfind_goal.z = 0xFF; - peep->pathfind_goal.direction = INVALID_DIRECTION; + peep->PathfindGoal.x = 0xFF; + peep->PathfindGoal.y = 0xFF; + peep->PathfindGoal.z = 0xFF; + peep->PathfindGoal.direction = INVALID_DIRECTION; peep->ItemStandardFlags = 0; peep->item_extra_flags = 0; peep->guest_heading_to_ride_id = RIDE_ID_NULL; @@ -3199,14 +3199,14 @@ void peep_reset_pathfind_goal(Peep* peep) #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { - log_info("Resetting pathfind_goal for %s", gPathFindDebugPeepName); + log_info("Resetting PathfindGoal for %s", gPathFindDebugPeepName); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 - peep->pathfind_goal.x = 0xFF; - peep->pathfind_goal.y = 0xFF; - peep->pathfind_goal.z = 0xFF; - peep->pathfind_goal.direction = INVALID_DIRECTION; + peep->PathfindGoal.x = 0xFF; + peep->PathfindGoal.y = 0xFF; + peep->PathfindGoal.z = 0xFF; + peep->PathfindGoal.direction = INVALID_DIRECTION; } /** diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 40ca0ac150..9c4c1bac78 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -698,7 +698,7 @@ struct Peep : SpriteBase }; uint8_t photo1_ride_ref; uint32_t peep_flags; - rct12_xyzd8 pathfind_goal; + rct12_xyzd8 PathfindGoal; rct12_xyzd8 PathfindHistory[4]; uint8_t NoActionFrameNum; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index e49ecff526..5f39e00618 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -875,7 +875,7 @@ static uint8_t staff_mechanic_direction_path(Peep* peep, uint8_t validDirections if (pathfindDirection == INVALID_DIRECTION) { /* Heuristic search failed for all directions. - * Reset the pathfind_goal - this means that the PathfindHistory + * Reset the PathfindGoal - this means that the PathfindHistory * will be reset in the next call to peep_pathfind_choose_direction(). * This lets the heuristic search "try again" in case the player has * edited the path layout or the mechanic was already stuck in the diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 088f2e869c..b4a84f1860 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1533,10 +1533,10 @@ private: dst->next_in_queue = src->next_in_queue; dst->peep_flags = 0; - dst->pathfind_goal.x = 0xFF; - dst->pathfind_goal.y = 0xFF; - dst->pathfind_goal.z = 0xFF; - dst->pathfind_goal.direction = INVALID_DIRECTION; + dst->PathfindGoal.x = 0xFF; + dst->PathfindGoal.y = 0xFF; + dst->PathfindGoal.z = 0xFF; + dst->PathfindGoal.direction = INVALID_DIRECTION; // Guests' favourite ride was only saved in LL. // Set it to N/A if the save comes from the original or AA. diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 96be9026b8..15785698d1 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1212,7 +1212,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->peep_is_lost_countdown = src->peep_is_lost_countdown; dst->photo1_ride_ref = src->photo1_ride_ref; dst->peep_flags = src->peep_flags; - dst->pathfind_goal = src->pathfind_goal; + dst->pathfind_goal = src->PathfindGoal; for (size_t i = 0; i < std::size(src->PathfindHistory); i++) { dst->pathfind_history[i] = src->PathfindHistory[i]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 61c629f045..6ca2417b2b 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1477,7 +1477,7 @@ public: dst->peep_is_lost_countdown = src->peep_is_lost_countdown; dst->photo1_ride_ref = src->photo1_ride_ref; dst->peep_flags = src->peep_flags; - dst->pathfind_goal = src->pathfind_goal; + dst->PathfindGoal = src->pathfind_goal; for (size_t i = 0; i < std::size(src->pathfind_history); i++) { dst->PathfindHistory[i] = src->pathfind_history[i]; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 0aff08721e..b2fb4814dc 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -232,10 +232,10 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(staff_orders); COMPARE_FIELD(photo1_ride_ref); COMPARE_FIELD(peep_flags); - COMPARE_FIELD(pathfind_goal.x); - COMPARE_FIELD(pathfind_goal.y); - COMPARE_FIELD(pathfind_goal.z); - COMPARE_FIELD(pathfind_goal.direction); + COMPARE_FIELD(PathfindGoal.x); + COMPARE_FIELD(PathfindGoal.y); + COMPARE_FIELD(PathfindGoal.z); + COMPARE_FIELD(PathfindGoal.direction); for (int i = 0; i < 4; i++) { COMPARE_FIELD(PathfindHistory[i].x); From a2a0fad8868ff7dd2fafc82dd8a20be71520ff8d Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:45:52 -0300 Subject: [PATCH 07/16] Rename Peep::peep_flags to PeepFlags --- src/openrct2-ui/windows/Guest.cpp | 4 +- src/openrct2-ui/windows/GuestList.cpp | 4 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/GuestSetFlagsAction.hpp | 2 +- src/openrct2/actions/SetCheatAction.hpp | 4 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- .../actions/StaffSetCostumeAction.hpp | 4 +- src/openrct2/peep/Guest.cpp | 174 +++++++++--------- src/openrct2/peep/GuestPathfinding.cpp | 18 +- src/openrct2/peep/Peep.cpp | 24 +-- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 4 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 2 +- src/openrct2/scripting/ScEntity.hpp | 6 +- src/openrct2/world/Park.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 19 files changed, 131 insertions(+), 131 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 8f6fb4b802..c4a5d8d43a 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -724,7 +724,7 @@ void window_guest_overview_mouse_up(rct_window* w, rct_widgetindex widgetIndex) break; case WIDX_TRACK: { - uint32_t flags = peep->peep_flags ^ PEEP_FLAGS_TRACKING; + uint32_t flags = peep->PeepFlags ^ PEEP_FLAGS_TRACKING; auto guestSetFlagsAction = GuestSetFlagsAction(w->number, flags); GameActions::Execute(&guestSetFlagsAction); @@ -1136,7 +1136,7 @@ void window_guest_overview_invalidate(rct_window* w) auto peep = GET_PEEP(w->number); w->pressed_widgets &= ~(1 << WIDX_TRACK); - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { w->pressed_widgets |= (1 << WIDX_TRACK); } diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index cc42c4337b..ef02e25eea 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -778,7 +778,7 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, gfx_draw_sprite(dpi, get_peep_face_sprite_small(peep), 118, y + 1, 0); // Tracking icon - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) gfx_draw_sprite(dpi, STR_ENTER_SELECTION_SIZE, 112, y + 1, 0); // Action @@ -1041,7 +1041,7 @@ static void window_guest_list_find_groups() static bool guest_should_be_visible(Peep* peep) { - if (_window_guest_list_tracking_only && !(peep->peep_flags & PEEP_FLAGS_TRACKING)) + if (_window_guest_list_tracking_only && !(peep->PeepFlags & PEEP_FLAGS_TRACKING)) return false; if (_window_guest_list_filter_name[0] != '\0') diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 8e6b91e542..e850a064a6 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -284,7 +284,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, guest_heading_to_ride_id); COMPARE_FIELD(Peep, staff_orders); COMPARE_FIELD(Peep, photo1_ride_ref); - COMPARE_FIELD(Peep, peep_flags); + COMPARE_FIELD(Peep, PeepFlags); COMPARE_FIELD(Peep, PathfindGoal); for (int i = 0; i < 4; i++) { diff --git a/src/openrct2/actions/GuestSetFlagsAction.hpp b/src/openrct2/actions/GuestSetFlagsAction.hpp index 3bbaa3e1cf..2a7eb31d3f 100644 --- a/src/openrct2/actions/GuestSetFlagsAction.hpp +++ b/src/openrct2/actions/GuestSetFlagsAction.hpp @@ -63,7 +63,7 @@ public: return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_THIS); } - peep->peep_flags = _newFlags; + peep->PeepFlags = _newFlags; return std::make_unique(); } diff --git a/src/openrct2/actions/SetCheatAction.hpp b/src/openrct2/actions/SetCheatAction.hpp index b9dd7e0730..064dca1be5 100644 --- a/src/openrct2/actions/SetCheatAction.hpp +++ b/src/openrct2/actions/SetCheatAction.hpp @@ -589,7 +589,7 @@ private: // Clear the 'red-faced with anger' status if we're making the guest happy if (value > 0) { - peep->peep_flags &= ~PEEP_FLAGS_ANGRY; + peep->PeepFlags &= ~PEEP_FLAGS_ANGRY; peep->Angriness = 0; } break; @@ -722,7 +722,7 @@ private: { if (scenario_rand_max(6) == 0) { - peep->peep_flags |= PEEP_FLAGS_EXPLODE; + peep->PeepFlags |= PEEP_FLAGS_EXPLODE; } } } diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index c2354b3d86..bce4f35567 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -168,7 +168,7 @@ private: newPeep->path_check_optimisation = 0; newPeep->type = PEEP_TYPE_STAFF; newPeep->outside_of_park = 0; - newPeep->peep_flags = 0; + newPeep->PeepFlags = 0; newPeep->PaidToEnter = 0; newPeep->PaidOnRides = 0; newPeep->PaidOnFood = 0; diff --git a/src/openrct2/actions/StaffSetCostumeAction.hpp b/src/openrct2/actions/StaffSetCostumeAction.hpp index f6ebb14110..b1fc66dfdd 100644 --- a/src/openrct2/actions/StaffSetCostumeAction.hpp +++ b/src/openrct2/actions/StaffSetCostumeAction.hpp @@ -95,10 +95,10 @@ public: auto spriteType = static_cast(_costume + 4); peep->sprite_type = spriteType; - peep->peep_flags &= ~PEEP_FLAGS_SLOW_WALK; + peep->PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; if (peep_slow_walking_types[spriteType]) { - peep->peep_flags |= PEEP_FLAGS_SLOW_WALK; + peep->PeepFlags |= PEEP_FLAGS_SLOW_WALK; } peep->action_frame = 0; peep->UpdateCurrentActionSpriteType(); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index f67b22f9f4..ceb4f36372 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -498,22 +498,22 @@ void Guest::GivePassingPeepsIceCream(Guest* passingPeep) */ void Guest::UpdateEasterEggInteractions() { - if (peep_flags & PEEP_FLAGS_PURPLE) + if (PeepFlags & PEEP_FLAGS_PURPLE) { ApplyEasterEggToNearbyGuests(&Guest::GivePassingPeepsPurpleClothes); } - if (peep_flags & PEEP_FLAGS_PIZZA) + if (PeepFlags & PEEP_FLAGS_PIZZA) { ApplyEasterEggToNearbyGuests(&Guest::GivePassingPeepsPizza); } - if (peep_flags & PEEP_FLAGS_CONTAGIOUS) + if (PeepFlags & PEEP_FLAGS_CONTAGIOUS) { ApplyEasterEggToNearbyGuests(&Guest::MakePassingPeepsSick); } - if (peep_flags & PEEP_FLAGS_JOY) + if (PeepFlags & PEEP_FLAGS_JOY) { if (scenario_rand() <= 1456) { @@ -527,7 +527,7 @@ void Guest::UpdateEasterEggInteractions() } } - if (peep_flags & PEEP_FLAGS_ICE_CREAM) + if (PeepFlags & PEEP_FLAGS_ICE_CREAM) { ApplyEasterEggToNearbyGuests(&Guest::GivePassingPeepsIceCream); } @@ -550,28 +550,28 @@ int32_t Guest::GetEasterEggNameId() const void Guest::HandleEasterEggName() { - peep_flags &= ~PEEP_FLAGS_WAVING; + PeepFlags &= ~PEEP_FLAGS_WAVING; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW)) { - peep_flags |= PEEP_FLAGS_WAVING; + PeepFlags |= PEEP_FLAGS_WAVING; } - peep_flags &= ~PEEP_FLAGS_PHOTO; + PeepFlags &= ~PEEP_FLAGS_PHOTO; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_CHRIS_SAWYER)) { - peep_flags |= PEEP_FLAGS_PHOTO; + PeepFlags |= PEEP_FLAGS_PHOTO; } - peep_flags &= ~PEEP_FLAGS_PAINTING; + PeepFlags &= ~PEEP_FLAGS_PAINTING; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_SIMON_FOSTER)) { - peep_flags |= PEEP_FLAGS_PAINTING; + PeepFlags |= PEEP_FLAGS_PAINTING; } - peep_flags &= ~PEEP_FLAGS_WOW; + PeepFlags &= ~PEEP_FLAGS_WOW; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_JOHN_WARDLEY)) { - peep_flags |= PEEP_FLAGS_WOW; + PeepFlags |= PEEP_FLAGS_WOW; } if (CheckEasterEggName(EASTEREGG_PEEP_NAME_MELANIE_WARN)) @@ -584,94 +584,94 @@ void Guest::HandleEasterEggName() nausea_target = 0; } - peep_flags &= ~PEEP_FLAGS_LITTER; + PeepFlags &= ~PEEP_FLAGS_LITTER; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_LISA_STIRLING)) { - peep_flags |= PEEP_FLAGS_LITTER; + PeepFlags |= PEEP_FLAGS_LITTER; } - peep_flags &= ~PEEP_FLAGS_LOST; + PeepFlags &= ~PEEP_FLAGS_LOST; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_DONALD_MACRAE)) { - peep_flags |= PEEP_FLAGS_LOST; + PeepFlags |= PEEP_FLAGS_LOST; } - peep_flags &= ~PEEP_FLAGS_HUNGER; + PeepFlags &= ~PEEP_FLAGS_HUNGER; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN)) { - peep_flags |= PEEP_FLAGS_HUNGER; + PeepFlags |= PEEP_FLAGS_HUNGER; } - peep_flags &= ~PEEP_FLAGS_TOILET; + PeepFlags &= ~PEEP_FLAGS_TOILET; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN)) { - peep_flags |= PEEP_FLAGS_TOILET; + PeepFlags |= PEEP_FLAGS_TOILET; } - peep_flags &= ~PEEP_FLAGS_CROWDED; + PeepFlags &= ~PEEP_FLAGS_CROWDED; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_CORINA_MASSOURA)) { - peep_flags |= PEEP_FLAGS_CROWDED; + PeepFlags |= PEEP_FLAGS_CROWDED; } - peep_flags &= ~PEEP_FLAGS_HAPPINESS; + PeepFlags &= ~PEEP_FLAGS_HAPPINESS; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_CAROL_YOUNG)) { - peep_flags |= PEEP_FLAGS_HAPPINESS; + PeepFlags |= PEEP_FLAGS_HAPPINESS; } - peep_flags &= ~PEEP_FLAGS_NAUSEA; + PeepFlags &= ~PEEP_FLAGS_NAUSEA; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_MIA_SHERIDAN)) { - peep_flags |= PEEP_FLAGS_NAUSEA; + PeepFlags |= PEEP_FLAGS_NAUSEA; } if (CheckEasterEggName(EASTEREGG_PEEP_NAME_KATIE_RODGER)) { - peep_flags |= PEEP_FLAGS_LEAVING_PARK; - peep_flags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; + PeepFlags |= PEEP_FLAGS_LEAVING_PARK; + PeepFlags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; } - peep_flags &= ~PEEP_FLAGS_PURPLE; + PeepFlags &= ~PEEP_FLAGS_PURPLE; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_EMMA_GARRELL)) { - peep_flags |= PEEP_FLAGS_PURPLE; + PeepFlags |= PEEP_FLAGS_PURPLE; } - peep_flags &= ~PEEP_FLAGS_PIZZA; + PeepFlags &= ~PEEP_FLAGS_PIZZA; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_JOANNE_BARTON)) { - peep_flags |= PEEP_FLAGS_PIZZA; + PeepFlags |= PEEP_FLAGS_PIZZA; } - peep_flags &= ~PEEP_FLAGS_CONTAGIOUS; + PeepFlags &= ~PEEP_FLAGS_CONTAGIOUS; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_FELICITY_ANDERSON)) { - peep_flags |= PEEP_FLAGS_CONTAGIOUS; + PeepFlags |= PEEP_FLAGS_CONTAGIOUS; } - peep_flags &= ~PEEP_FLAGS_JOY; + PeepFlags &= ~PEEP_FLAGS_JOY; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_KATIE_SMITH)) { - peep_flags |= PEEP_FLAGS_JOY; + PeepFlags |= PEEP_FLAGS_JOY; } - peep_flags &= ~PEEP_FLAGS_ANGRY; + PeepFlags &= ~PEEP_FLAGS_ANGRY; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_EILIDH_BELL)) { - peep_flags |= PEEP_FLAGS_ANGRY; + PeepFlags |= PEEP_FLAGS_ANGRY; } - peep_flags &= ~PEEP_FLAGS_ICE_CREAM; + PeepFlags &= ~PEEP_FLAGS_ICE_CREAM; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_NANCY_STILLWAGON)) { - peep_flags |= PEEP_FLAGS_ICE_CREAM; + PeepFlags |= PEEP_FLAGS_ICE_CREAM; } - peep_flags &= ~PEEP_FLAGS_HERE_WE_ARE; + PeepFlags &= ~PEEP_FLAGS_HERE_WE_ARE; if (CheckEasterEggName(EASTEREGG_PEEP_NAME_DAVID_ELLIS)) { - peep_flags |= PEEP_FLAGS_HERE_WE_ARE; + PeepFlags |= PEEP_FLAGS_HERE_WE_ARE; } } @@ -699,7 +699,7 @@ void Guest::Tick128UpdateGuest(int32_t index) * which is the condition for calling this function, is * to reduce how often the content in this conditional * is executed to once every four calls. */ - if (peep_flags & PEEP_FLAGS_CROWDED) + if (PeepFlags & PEEP_FLAGS_CROWDED) { PeepThoughtType thought_type = crowded_thoughts[scenario_rand() & 0xF]; if (thought_type != PEEP_THOUGHT_TYPE_NONE) @@ -708,7 +708,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } } - if (peep_flags & PEEP_FLAGS_EXPLODE && x != LOCATION_NULL) + if (PeepFlags & PEEP_FLAGS_EXPLODE && x != LOCATION_NULL) { if (state == PEEP_STATE_WALKING || state == PEEP_STATE_SITTING) { @@ -722,28 +722,28 @@ void Guest::Tick128UpdateGuest(int32_t index) } else { - peep_flags &= ~PEEP_FLAGS_EXPLODE; + PeepFlags &= ~PEEP_FLAGS_EXPLODE; } } - if (peep_flags & PEEP_FLAGS_HUNGER) + if (PeepFlags & PEEP_FLAGS_HUNGER) { if (hunger >= 15) hunger -= 15; } - if (peep_flags & PEEP_FLAGS_TOILET) + if (PeepFlags & PEEP_FLAGS_TOILET) { if (toilet <= 180) toilet += 50; } - if (peep_flags & PEEP_FLAGS_HAPPINESS) + if (PeepFlags & PEEP_FLAGS_HAPPINESS) { happiness_target = 5; } - if (peep_flags & PEEP_FLAGS_NAUSEA) + if (PeepFlags & PEEP_FLAGS_NAUSEA) { nausea_target = 200; if (nausea <= 130) @@ -778,7 +778,7 @@ void Guest::Tick128UpdateGuest(int32_t index) { TimeOnRide = std::min(255, TimeOnRide + 1); - if (peep_flags & PEEP_FLAGS_WOW) + if (PeepFlags & PEEP_FLAGS_WOW) { InsertNewThought(PEEP_THOUGHT_TYPE_WOW2, PEEP_THOUGHT_ITEM_NONE); } @@ -802,7 +802,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } } - if (state == PEEP_STATE_WALKING && outside_of_park == 0 && !(peep_flags & PEEP_FLAGS_LEAVING_PARK) && no_of_rides == 0 + if (state == PEEP_STATE_WALKING && outside_of_park == 0 && !(PeepFlags & PEEP_FLAGS_LEAVING_PARK) && no_of_rides == 0 && guest_heading_to_ride_id == RIDE_ID_NULL) { uint32_t time_duration = gScenarioTicks - time_in_park; @@ -840,7 +840,7 @@ void Guest::Tick128UpdateGuest(int32_t index) uint8_t num_thoughts = 0; PeepThoughtType possible_thoughts[5]; - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) { possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_GO_HOME; } @@ -1255,7 +1255,7 @@ void Guest::UpdateSitting() return; } - if ((peep_flags & PEEP_FLAGS_LEAVING_PARK)) + if ((PeepFlags & PEEP_FLAGS_LEAVING_PARK)) { SetState(PEEP_STATE_WALKING); @@ -1390,13 +1390,13 @@ bool Guest::HasEmptyContainer() const */ void Guest::CheckIfLost() { - if (!(peep_flags & PEEP_FLAGS_LOST)) + if (!(PeepFlags & PEEP_FLAGS_LOST)) { if (ride_get_count() < 2) return; - peep_flags ^= PEEP_FLAGS_21; + PeepFlags ^= PEEP_FLAGS_21; - if (!(peep_flags & PEEP_FLAGS_21)) + if (!(PeepFlags & PEEP_FLAGS_21)) return; TimeLost++; @@ -1448,7 +1448,7 @@ void Guest::CheckCantFindRide() */ void Guest::CheckCantFindExit() { - if (!(peep_flags & PEEP_FLAGS_LEAVING_PARK)) + if (!(PeepFlags & PEEP_FLAGS_LEAVING_PARK)) return; // Peeps who can't find the park exit will continue to get less happy until they find it. @@ -1684,7 +1684,7 @@ loc_69B221: window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; UpdateSpriteType(); - if (peep_flags & PEEP_FLAGS_TRACKING) + if (PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); FormatNameTo(ft); @@ -1784,9 +1784,9 @@ void Guest::OnEnterRide(ride_id_t rideIndex) void Guest::OnExitRide(ride_id_t rideIndex) { auto ride = get_ride(rideIndex); - if (peep_flags & PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE) + if (PeepFlags & PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE) { - peep_flags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; + PeepFlags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; FavouriteRide = rideIndex; // TODO fix this flag name or add another one window_invalidate_flags |= PEEP_INVALIDATE_STAFF_STATS; @@ -1795,8 +1795,8 @@ void Guest::OnExitRide(ride_id_t rideIndex) nausea = nausea_target; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_STATS; - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) - peep_flags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN); + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) + PeepFlags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN); if (ride != nullptr && peep_should_go_on_ride_again(this, ride)) { @@ -1852,7 +1852,7 @@ void Guest::PickRideToGoOn() return; if (guest_heading_to_ride_id != RIDE_ID_NULL) return; - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) return; if (HasFood()) return; @@ -1977,7 +1977,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t if (!(RideTypeDescriptors[ride->type].Flags & RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride->value == RIDE_VALUE_UNDEFINED || ride_get_price(ride) != 0) { - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) { ChoseNotToGoOnRide(ride, peepAtRide, false); return false; @@ -2200,7 +2200,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t if (value != 0xFFFF && !peep_has_voucher_for_free_ride(this, ride) && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { // The amount peeps are willing to pay is decreased by 75% if they had to pay to enter the park. - if (peep_flags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY) + if (PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY) value /= 4; // Peeps won't pay more than twice the value of the ride. @@ -2225,7 +2225,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t { if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { - if (!(peep_flags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY)) + if (!(PeepFlags & PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY)) { InsertNewThought(PEEP_THOUGHT_TYPE_GOOD_VALUE, ride->id); } @@ -2711,14 +2711,14 @@ static int16_t peep_calculate_ride_satisfaction(Guest* peep, Ride* ride) */ static void peep_update_favourite_ride(Peep* peep, Ride* ride) { - peep->peep_flags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; + peep->PeepFlags &= ~PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; uint8_t peepRideRating = std::clamp((ride->excitement / 4) + peep->happiness, 0, PEEP_MAX_HAPPINESS); if (peepRideRating >= peep->FavouriteRideRating) { if (peep->happiness >= 160 && peep->happiness_target >= 160) { peep->FavouriteRideRating = peepRideRating; - peep->peep_flags |= PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; + peep->PeepFlags |= PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE; } } } @@ -3083,7 +3083,7 @@ static void peep_decide_whether_to_leave_park(Peep* peep) /* Peeps that are happy enough, have enough energy and * (if appropriate) have enough money will always stay * in the park. */ - if (!(peep->peep_flags & PEEP_FLAGS_LEAVING_PARK)) + if (!(peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) { if (gParkFlags & PARK_FLAGS_NO_MONEY) { @@ -3118,7 +3118,7 @@ static void peep_decide_whether_to_leave_park(Peep* peep) static void peep_leave_park(Peep* peep) { peep->guest_heading_to_ride_id = RIDE_ID_NULL; - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { if (peep->peep_is_lost_countdown < 60) { @@ -3128,8 +3128,8 @@ static void peep_leave_park(Peep* peep) else { peep->peep_is_lost_countdown = 254; - peep->peep_flags |= PEEP_FLAGS_LEAVING_PARK; - peep->peep_flags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; + peep->PeepFlags |= PEEP_FLAGS_LEAVING_PARK; + peep->PeepFlags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; } peep->InsertNewThought(PEEP_THOUGHT_TYPE_GO_HOME, PEEP_THOUGHT_ITEM_NONE); @@ -3146,7 +3146,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co { return; } - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) return; if (peep->x == LOCATION_NULL) return; @@ -3325,7 +3325,7 @@ static bool peep_should_use_cash_machine(Peep* peep, ride_id_t rideIndex) { if (gParkFlags & PARK_FLAGS_NO_MONEY) return false; - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) return false; if (peep->cash_in_pocket > MONEY(20, 00)) return false; @@ -3883,7 +3883,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride) window_invalidate_by_number(WC_RIDE, current_ride); } - if (peep_flags & PEEP_FLAGS_TRACKING) + if (PeepFlags & PEEP_FLAGS_TRACKING) { auto nameArgLen = FormatNameTo(gCommonFormatArgs); ride->FormatNameTo(gCommonFormatArgs + nameArgLen); @@ -4989,7 +4989,7 @@ void Guest::UpdateRideLeaveExit() OnExitRide(current_ride); - if (ride != nullptr && (peep_flags & PEEP_FLAGS_TRACKING)) + if (ride != nullptr && (PeepFlags & PEEP_FLAGS_TRACKING)) { auto nameArgLen = FormatNameTo(gCommonFormatArgs); ride->FormatNameTo(gCommonFormatArgs + nameArgLen); @@ -5258,7 +5258,7 @@ void Guest::UpdateWalking() if (!CheckForPath()) return; - if (peep_flags & PEEP_FLAGS_WAVING) + if (PeepFlags & PEEP_FLAGS_WAVING) { if (action >= PEEP_ACTION_NONE_1) { @@ -5273,7 +5273,7 @@ void Guest::UpdateWalking() } } - if (peep_flags & PEEP_FLAGS_PHOTO) + if (PeepFlags & PEEP_FLAGS_PHOTO) { if (action >= PEEP_ACTION_NONE_1) { @@ -5288,7 +5288,7 @@ void Guest::UpdateWalking() } } - if (peep_flags & PEEP_FLAGS_PAINTING) + if (PeepFlags & PEEP_FLAGS_PAINTING) { if (action >= PEEP_ACTION_NONE_1) { @@ -5303,7 +5303,7 @@ void Guest::UpdateWalking() } } - if (peep_flags & PEEP_FLAGS_LITTER) + if (PeepFlags & PEEP_FLAGS_LITTER) { if (!GetNextIsSurface()) { @@ -5410,7 +5410,7 @@ void Guest::UpdateWalking() if (state != PEEP_STATE_WALKING) return; - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) return; if (nausea > 140) @@ -5988,7 +5988,7 @@ void Guest::UpdateUsingBin() /* Simplifies 0x690582. Returns true if should find bench*/ bool Guest::ShouldFindBench() { - if (peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) { return false; } @@ -6203,7 +6203,7 @@ static void peep_update_walking_break_scenery(Peep* peep) if (gCheatsDisableVandalism) return; - if (!(peep->peep_flags & PEEP_FLAGS_ANGRY)) + if (!(peep->PeepFlags & PEEP_FLAGS_ANGRY)) { if (peep->happiness >= 48) return; @@ -6770,11 +6770,11 @@ void Guest::SetSpriteType(PeepSpriteType new_sprite_type) if (action >= PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; - peep_flags &= ~PEEP_FLAGS_SLOW_WALK; + PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; Guard::Assert(new_sprite_type < std::size(gSpriteTypeToSlowWalkMap)); if (gSpriteTypeToSlowWalkMap[new_sprite_type]) { - peep_flags |= PEEP_FLAGS_SLOW_WALK; + PeepFlags |= PEEP_FLAGS_SLOW_WALK; } action_sprite_type = PEEP_ACTION_SPRITE_TYPE_INVALID; @@ -6944,5 +6944,5 @@ void Guest::UpdateSpriteType() bool Guest::HeadingForRideOrParkExit() const { - return (peep_flags & PEEP_FLAGS_LEAVING_PARK) || (guest_heading_to_ride_id != 0xFF); + return (PeepFlags & PEEP_FLAGS_LEAVING_PARK) || (guest_heading_to_ride_id != 0xFF); } diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 273faabd94..b15e6c26df 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -442,15 +442,15 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep* peep) return 8; // PEEP_FLAGS_2? It's cleared here but not set anywhere! - if ((peep->peep_flags & PEEP_FLAGS_2)) + if ((peep->PeepFlags & PEEP_FLAGS_2)) { if ((scenario_rand() & 0xFFFF) <= 7281) - peep->peep_flags &= ~PEEP_FLAGS_2; + peep->PeepFlags &= ~PEEP_FLAGS_2; return 8; } - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK && peep->peep_is_lost_countdown < 90) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK && peep->peep_is_lost_countdown < 90) { return 8; } @@ -458,7 +458,7 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep* peep) if (peep->ItemStandardFlags & PEEP_ITEM_MAP) return 7; - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) return 7; return 5; @@ -1646,13 +1646,13 @@ static int32_t guest_path_find_leaving_park(Peep* peep, uint8_t edges) static int32_t guest_path_find_park_entrance(Peep* peep, uint8_t edges) { // If entrance no longer exists, choose a new one - if ((peep->peep_flags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN) && peep->current_ride >= gParkEntrances.size()) + if ((peep->PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN) && peep->current_ride >= gParkEntrances.size()) { peep->current_ride = 0xFF; - peep->peep_flags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN); + peep->PeepFlags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN); } - if (!(peep->peep_flags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN)) + if (!(peep->PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN)) { uint8_t chosenEntrance = 0xFF; uint16_t nearestDist = 0xFFFF; @@ -1672,7 +1672,7 @@ static int32_t guest_path_find_park_entrance(Peep* peep, uint8_t edges) return guest_path_find_aimless(peep, edges); peep->current_ride = chosenEntrance; - peep->peep_flags |= PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; + peep->PeepFlags |= PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; } const auto& entrance = gParkEntrances[peep->current_ride]; @@ -2041,7 +2041,7 @@ int32_t guest_path_finding(Guest* peep) } } - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 587d891460..02e0e1348c 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1123,7 +1123,7 @@ void Peep::Update() uint32_t stepsToTake = energy; if (stepsToTake < 95 && state == PEEP_STATE_QUEUING) stepsToTake = 95; - if ((peep_flags & PEEP_FLAGS_SLOW_WALK) && state != PEEP_STATE_QUEUING) + if ((PeepFlags & PEEP_FLAGS_SLOW_WALK) && state != PEEP_STATE_QUEUING) stepsToTake /= 2; if (action == PEEP_ACTION_NONE_2 && (GetNextIsSloped())) { @@ -1633,7 +1633,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->action_sprite_image_offset = 0; peep->NoActionFrameNum = 0; peep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; - peep->peep_flags = 0; + peep->PeepFlags = 0; peep->FavouriteRide = RIDE_ID_NULL; peep->FavouriteRideRating = 0; @@ -1852,7 +1852,7 @@ void Peep::FormatActionTo(void* argsV) const } else { - ft.Add((peep_flags & PEEP_FLAGS_LEAVING_PARK) ? STR_LEAVING_PARK : STR_WALKING); + ft.Add((PeepFlags & PEEP_FLAGS_LEAVING_PARK) ? STR_LEAVING_PARK : STR_WALKING); } break; case PEEP_STATE_QUEUING_FRONT: @@ -2228,7 +2228,7 @@ void peep_set_map_tooltip(Peep* peep) auto ft = Formatter::MapTooltip(); if (peep->type == PEEP_TYPE_GUEST) { - ft.Add((peep->peep_flags & PEEP_FLAGS_TRACKING) ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP); + ft.Add((peep->PeepFlags & PEEP_FLAGS_TRACKING) ? STR_TRACKED_GUEST_MAP_TIP : STR_GUEST_MAP_TIP); ft.Add(get_peep_face_sprite_small(peep)); peep->FormatNameTo(ft); peep->FormatActionTo(ft); @@ -2439,7 +2439,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl peep->SetState(PEEP_STATE_QUEUING); peep->sub_state = 11; peep->time_in_queue = 0; - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); peep->FormatNameTo(ft); @@ -2484,7 +2484,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl return; } - if (!(peep->peep_flags & PEEP_FLAGS_LEAVING_PARK)) + if (!(peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK)) { // If the park is open and leaving flag isn't set return to centre if (gParkFlags & PARK_FLAGS_PARK_OPEN) @@ -2501,7 +2501,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl peep->SetState(PEEP_STATE_LEAVING_PARK); peep->var_37 = 0; - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); peep->FormatNameTo(ft); @@ -2628,7 +2628,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl gTotalIncomeFromAdmissions += entranceFee; guest->SpendMoney(peep->PaidToEnter, entranceFee, ExpenditureType::ParkEntranceTickets); - peep->peep_flags |= PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY; + peep->PeepFlags |= PEEP_FLAGS_HAS_PAID_FOR_PARK_ENTRY; } gTotalAdmissions++; @@ -2871,7 +2871,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen peep->sub_state = 10; peep->destination_tolerance = 2; peep->time_in_queue = 0; - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); peep->FormatNameTo(ft); @@ -2943,7 +2943,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen return true; } - if (peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { peep_return_to_centre_of_tile(peep); return true; @@ -2978,7 +2978,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen peep->TimeOnRide = 0; ride->cur_num_customers++; - if (peep->peep_flags & PEEP_FLAGS_TRACKING) + if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); peep->FormatNameTo(ft); @@ -3322,7 +3322,7 @@ void pathfind_logging_enable([[maybe_unused]] Peep* peep) * be output for. */ if (peep->type == PEEP_TYPE_GUEST) { - gPathFindDebug = peep->peep_flags & PEEP_FLAGS_TRACKING; + gPathFindDebug = peep->PeepFlags & PEEP_FLAGS_TRACKING; } /* For staff, there is no tracking button (any other similar * suitable existing mechanism?), so fall back to a crude diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 9c4c1bac78..f03c0f7467 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -697,7 +697,7 @@ struct Peep : SpriteBase uint8_t peep_is_lost_countdown; }; uint8_t photo1_ride_ref; - uint32_t peep_flags; + uint32_t PeepFlags; rct12_xyzd8 PathfindGoal; rct12_xyzd8 PathfindHistory[4]; uint8_t NoActionFrameNum; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 5f39e00618..85ea8c32e5 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1860,10 +1860,10 @@ void Staff::Tick128UpdateStaff() if (action < PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; - peep_flags &= ~PEEP_FLAGS_SLOW_WALK; + PeepFlags &= ~PEEP_FLAGS_SLOW_WALK; if (gSpriteTypeToSlowWalkMap[newSpriteType]) { - peep_flags |= PEEP_FLAGS_SLOW_WALK; + PeepFlags |= PEEP_FLAGS_SLOW_WALK; } action_sprite_type = PEEP_ACTION_SPRITE_TYPE_INVALID; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index b4a84f1860..28ec875277 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1532,7 +1532,7 @@ private: // The ID is fixed later dst->next_in_queue = src->next_in_queue; - dst->peep_flags = 0; + dst->PeepFlags = 0; dst->PathfindGoal.x = 0xFF; dst->PathfindGoal.y = 0xFF; dst->PathfindGoal.z = 0xFF; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 15785698d1..109dac4a3c 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1211,7 +1211,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; dst->peep_is_lost_countdown = src->peep_is_lost_countdown; dst->photo1_ride_ref = src->photo1_ride_ref; - dst->peep_flags = src->peep_flags; + dst->peep_flags = src->PeepFlags; dst->pathfind_goal = src->PathfindGoal; for (size_t i = 0; i < std::size(src->PathfindHistory); i++) { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6ca2417b2b..6aa9b36992 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1476,7 +1476,7 @@ public: dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; dst->peep_is_lost_countdown = src->peep_is_lost_countdown; dst->photo1_ride_ref = src->photo1_ride_ref; - dst->peep_flags = src->peep_flags; + dst->PeepFlags = src->peep_flags; dst->PathfindGoal = src->pathfind_goal; for (size_t i = 0; i < std::size(src->pathfind_history); i++) { diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 34dcbb6258..e0feef7a57 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3048,7 +3048,7 @@ void Vehicle::PeepEasterEggHereWeAre() const for (int32_t i = 0; i < vehicle->num_peeps; ++i) { Peep* curPeep = GET_PEEP(vehicle->peep[i]); - if (curPeep->peep_flags & PEEP_FLAGS_HERE_WE_ARE) + if (curPeep->PeepFlags & PEEP_FLAGS_HERE_WE_ARE) { curPeep->InsertNewThought(PEEP_THOUGHT_TYPE_HERE_WE_ARE, curPeep->current_ride); } diff --git a/src/openrct2/scripting/ScEntity.hpp b/src/openrct2/scripting/ScEntity.hpp index 4ddcc44528..2ee9ffbbfe 100644 --- a/src/openrct2/scripting/ScEntity.hpp +++ b/src/openrct2/scripting/ScEntity.hpp @@ -256,7 +256,7 @@ namespace OpenRCT2::Scripting if (peep != nullptr) { auto mask = PeepFlagMap[key]; - return (peep->peep_flags & mask) != 0; + return (peep->PeepFlags & mask) != 0; } return false; } @@ -269,9 +269,9 @@ namespace OpenRCT2::Scripting { auto mask = PeepFlagMap[key]; if (value) - peep->peep_flags |= mask; + peep->PeepFlags |= mask; else - peep->peep_flags &= ~mask; + peep->PeepFlags &= ~mask; peep->Invalidate(); } } diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 52c87c21a4..1117b30994 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -395,7 +395,7 @@ int32_t Park::CalculateParkRating() const { happyGuestCount++; } - if ((peep->peep_flags & PEEP_FLAGS_LEAVING_PARK) && (peep->peep_is_lost_countdown < 90)) + if ((peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) && (peep->peep_is_lost_countdown < 90)) { lostGuestCount++; } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index b2fb4814dc..21f2d986da 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -231,7 +231,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(guest_heading_to_ride_id); COMPARE_FIELD(staff_orders); COMPARE_FIELD(photo1_ride_ref); - COMPARE_FIELD(peep_flags); + COMPARE_FIELD(PeepFlags); COMPARE_FIELD(PathfindGoal.x); COMPARE_FIELD(PathfindGoal.y); COMPARE_FIELD(PathfindGoal.z); From 7357eeca6098095f93fd623d00dc01d1fdc4f12a Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:49:56 -0300 Subject: [PATCH 08/16] Rename Peep::photo1_ride_ref to Photo1RideRef --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/RideDemolishAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index c4a5d8d43a..e61ec966de 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1947,7 +1947,7 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item set_format_arg(0, uint32_t, SPRITE_ID_PALETTE_COLOUR_1(peep->BalloonColour) | ShopItems[item].Image); break; case SHOP_ITEM_PHOTO: - ride = get_ride(peep->photo1_ride_ref); + ride = get_ride(peep->Photo1RideRef); if (ride != nullptr) ride->FormatNameTo(gCommonFormatArgs + 6); break; diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index e850a064a6..b88e5aa7fa 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -283,7 +283,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, path_check_optimisation); COMPARE_FIELD(Peep, guest_heading_to_ride_id); COMPARE_FIELD(Peep, staff_orders); - COMPARE_FIELD(Peep, photo1_ride_ref); + COMPARE_FIELD(Peep, Photo1RideRef); COMPARE_FIELD(Peep, PeepFlags); COMPARE_FIELD(Peep, PathfindGoal); for (int i = 0; i < 4; i++) diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 7aa53e15df..5b6ee4662c 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -187,7 +187,7 @@ private: // remove any photos of this ride from peep if (peep->ItemStandardFlags & PEEP_ITEM_PHOTO) { - if (peep->photo1_ride_ref == _rideIndex) + if (peep->Photo1RideRef == _rideIndex) { peep->ItemStandardFlags &= ~PEEP_ITEM_PHOTO; } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index ceb4f36372..5cf006c3f8 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -1671,7 +1671,7 @@ loc_69B221: time_to_consume = std::min((time_to_consume + consumptionTime), 255); if (shopItem == SHOP_ITEM_PHOTO) - photo1_ride_ref = ride->id; + Photo1RideRef = ride->id; if (shopItem == SHOP_ITEM_PHOTO2) photo2_ride_ref = ride->id; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index f03c0f7467..dc67e8889e 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -696,7 +696,7 @@ struct Peep : SpriteBase uint8_t staff_orders; uint8_t peep_is_lost_countdown; }; - uint8_t photo1_ride_ref; + uint8_t Photo1RideRef; uint32_t PeepFlags; rct12_xyzd8 PathfindGoal; rct12_xyzd8 PathfindHistory[4]; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 28ec875277..0a784ef824 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1510,7 +1510,7 @@ private: dst->ride_types_been_on[i] = src->ride_types_been_on[i]; } - dst->photo1_ride_ref = src->photo1_ride_ref; + dst->Photo1RideRef = src->photo1_ride_ref; for (size_t i = 0; i < std::size(src->thoughts); i++) { diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 109dac4a3c..86cf27dcfc 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1210,7 +1210,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->path_check_optimisation = src->path_check_optimisation; dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; dst->peep_is_lost_countdown = src->peep_is_lost_countdown; - dst->photo1_ride_ref = src->photo1_ride_ref; + dst->photo1_ride_ref = src->Photo1RideRef; dst->peep_flags = src->PeepFlags; dst->pathfind_goal = src->PathfindGoal; for (size_t i = 0; i < std::size(src->PathfindHistory); i++) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6aa9b36992..2f18bcadb8 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1475,7 +1475,7 @@ public: dst->path_check_optimisation = src->path_check_optimisation; dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; dst->peep_is_lost_countdown = src->peep_is_lost_countdown; - dst->photo1_ride_ref = src->photo1_ride_ref; + dst->Photo1RideRef = src->photo1_ride_ref; dst->PeepFlags = src->peep_flags; dst->PathfindGoal = src->pathfind_goal; for (size_t i = 0; i < std::size(src->pathfind_history); i++) diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 21f2d986da..cef1f8f36e 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -230,7 +230,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(path_check_optimisation); COMPARE_FIELD(guest_heading_to_ride_id); COMPARE_FIELD(staff_orders); - COMPARE_FIELD(photo1_ride_ref); + COMPARE_FIELD(Photo1RideRef); COMPARE_FIELD(PeepFlags); COMPARE_FIELD(PathfindGoal.x); COMPARE_FIELD(PathfindGoal.y); From 480009c0f620af4593bd72fdf4c7b287e108f3aa Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 17:56:24 -0300 Subject: [PATCH 09/16] Rename Peep::peep_is_lost_countdown to PeepIsLostCountdown --- src/openrct2/management/Marketing.cpp | 4 ++-- src/openrct2/peep/Guest.cpp | 22 +++++++++++----------- src/openrct2/peep/GuestPathfinding.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/world/Park.cpp | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index a8c54304dc..cae6de58d3 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -143,7 +143,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) peep->VoucherType = VOUCHER_TYPE_RIDE_FREE; peep->VoucherArguments = campaign->RideId; peep->guest_heading_to_ride_id = campaign->RideId; - peep->peep_is_lost_countdown = 240; + peep->PeepIsLostCountdown = 240; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; @@ -158,7 +158,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) break; case ADVERTISING_CAMPAIGN_RIDE: peep->guest_heading_to_ride_id = campaign->RideId; - peep->peep_is_lost_countdown = 240; + peep->PeepIsLostCountdown = 240; break; } } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 5cf006c3f8..94f969aaed 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -1420,14 +1420,14 @@ void Guest::CheckCantFindRide() return; // Peeps will think "I can't find ride X" twice before giving up completely. - if (peep_is_lost_countdown == 30 || peep_is_lost_countdown == 60) + if (PeepIsLostCountdown == 30 || PeepIsLostCountdown == 60) { InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND, guest_heading_to_ride_id); happiness_target = std::max(happiness_target - 30, 0); } - peep_is_lost_countdown--; - if (peep_is_lost_countdown != 0) + PeepIsLostCountdown--; + if (PeepIsLostCountdown != 0) return; guest_heading_to_ride_id = RIDE_ID_NULL; @@ -1452,14 +1452,14 @@ void Guest::CheckCantFindExit() return; // Peeps who can't find the park exit will continue to get less happy until they find it. - if (peep_is_lost_countdown == 1) + if (PeepIsLostCountdown == 1) { InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND_EXIT, PEEP_THOUGHT_ITEM_NONE); happiness_target = std::max(happiness_target - 30, 0); } - if (--peep_is_lost_countdown == 0) - peep_is_lost_countdown = 90; + if (--PeepIsLostCountdown == 0) + PeepIsLostCountdown = 90; } /** Main logic to decide whether a peep should buy an item in question @@ -1801,7 +1801,7 @@ void Guest::OnExitRide(ride_id_t rideIndex) if (ride != nullptr && peep_should_go_on_ride_again(this, ride)) { guest_heading_to_ride_id = rideIndex; - peep_is_lost_countdown = 200; + PeepIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; } @@ -1864,7 +1864,7 @@ void Guest::PickRideToGoOn() { // Head to that ride guest_heading_to_ride_id = ride->id; - peep_is_lost_countdown = 200; + PeepIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; @@ -3120,14 +3120,14 @@ static void peep_leave_park(Peep* peep) peep->guest_heading_to_ride_id = RIDE_ID_NULL; if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { - if (peep->peep_is_lost_countdown < 60) + if (peep->PeepIsLostCountdown < 60) { return; } } else { - peep->peep_is_lost_countdown = 254; + peep->PeepIsLostCountdown = 254; peep->PeepFlags |= PEEP_FLAGS_LEAVING_PARK; peep->PeepFlags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; } @@ -3242,7 +3242,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co { // Head to that ride peep->guest_heading_to_ride_id = closestRide->id; - peep->peep_is_lost_countdown = 200; + peep->PeepIsLostCountdown = 200; peep_reset_pathfind_goal(peep); peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; peep->TimeLost = 0; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index b15e6c26df..1c99933907 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -450,7 +450,7 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep* peep) return 8; } - if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK && peep->peep_is_lost_countdown < 90) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK && peep->PeepIsLostCountdown < 90) { return 8; } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index dc67e8889e..2300b3526c 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -694,7 +694,7 @@ struct Peep : SpriteBase union { uint8_t staff_orders; - uint8_t peep_is_lost_countdown; + uint8_t PeepIsLostCountdown; }; uint8_t Photo1RideRef; uint32_t PeepFlags; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 0a784ef824..8277df8333 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1528,7 +1528,7 @@ private: dst->path_check_optimisation = 0; dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; // Doubles as staff orders - dst->peep_is_lost_countdown = src->peep_is_lost_countdown; + dst->PeepIsLostCountdown = src->peep_is_lost_countdown; // The ID is fixed later dst->next_in_queue = src->next_in_queue; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 86cf27dcfc..f7af4dd403 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1209,7 +1209,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } dst->path_check_optimisation = src->path_check_optimisation; dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; - dst->peep_is_lost_countdown = src->peep_is_lost_countdown; + dst->peep_is_lost_countdown = src->PeepIsLostCountdown; dst->photo1_ride_ref = src->Photo1RideRef; dst->peep_flags = src->PeepFlags; dst->pathfind_goal = src->PathfindGoal; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 2f18bcadb8..379a2e3073 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1474,7 +1474,7 @@ public: } dst->path_check_optimisation = src->path_check_optimisation; dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; - dst->peep_is_lost_countdown = src->peep_is_lost_countdown; + dst->PeepIsLostCountdown = src->peep_is_lost_countdown; dst->Photo1RideRef = src->photo1_ride_ref; dst->PeepFlags = src->peep_flags; dst->PathfindGoal = src->pathfind_goal; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 1117b30994..ce6696b7e1 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -395,7 +395,7 @@ int32_t Park::CalculateParkRating() const { happyGuestCount++; } - if ((peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) && (peep->peep_is_lost_countdown < 90)) + if ((peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) && (peep->PeepIsLostCountdown < 90)) { lostGuestCount++; } From 9fbaf61e070bb03d7b589249e51d750eba358a1b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 18:00:23 -0300 Subject: [PATCH 10/16] Rename Peep::staff_orders to StaffOrders --- src/openrct2-ui/windows/Staff.cpp | 6 +++--- src/openrct2-ui/windows/StaffList.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/actions/StaffSetOrdersAction.hpp | 2 +- src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 12 ++++++------ src/openrct2/ride/Ride.cpp | 4 ++-- src/openrct2/scripting/ScEntity.hpp | 4 ++-- test/tests/S6ImportExportTests.cpp | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index dec8cf591e..19c1f6109a 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -635,7 +635,7 @@ static void window_staff_set_order(rct_window* w, int32_t order_id) { Peep* peep = GET_PEEP(w->number); - uint8_t newOrders = peep->staff_orders ^ (1 << order_id); + uint8_t newOrders = peep->StaffOrders ^ (1 << order_id); auto staffSetOrdersAction = StaffSetOrdersAction(w->number, newOrders); GameActions::Execute(&staffSetOrdersAction); } @@ -834,7 +834,7 @@ void window_staff_options_invalidate(rct_window* w) window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_EMPTY; w->pressed_widgets &= ~( (1 << WIDX_CHECKBOX_1) | (1 << WIDX_CHECKBOX_2) | (1 << WIDX_CHECKBOX_3) | (1 << WIDX_CHECKBOX_4)); - w->pressed_widgets |= peep->staff_orders << WIDX_CHECKBOX_1; + w->pressed_widgets |= peep->StaffOrders << WIDX_CHECKBOX_1; break; case STAFF_TYPE_MECHANIC: window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX; @@ -846,7 +846,7 @@ void window_staff_options_invalidate(rct_window* w) window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_EMPTY; window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_EMPTY; w->pressed_widgets &= ~((1 << WIDX_CHECKBOX_1) | (1 << WIDX_CHECKBOX_2)); - w->pressed_widgets |= peep->staff_orders << WIDX_CHECKBOX_1; + w->pressed_widgets |= peep->StaffOrders << WIDX_CHECKBOX_1; break; case STAFF_TYPE_SECURITY: // Security guards don't have an options screen. diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 74ad135c30..92739b2ee6 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -715,7 +715,7 @@ void window_staff_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_ auto staffOrderIcon_x = nameColumnSize + 20; if (peep->staff_type != 3) { - auto staffOrders = peep->staff_orders; + auto staffOrders = peep->StaffOrders; auto staffOrderSprite = staffOrderBaseSprites[_windowStaffListSelectedTab]; while (staffOrders != 0) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index b88e5aa7fa..33466760fa 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -282,7 +282,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots } COMPARE_FIELD(Peep, path_check_optimisation); COMPARE_FIELD(Peep, guest_heading_to_ride_id); - COMPARE_FIELD(Peep, staff_orders); + COMPARE_FIELD(Peep, StaffOrders); COMPARE_FIELD(Peep, Photo1RideRef); COMPARE_FIELD(Peep, PeepFlags); COMPARE_FIELD(Peep, PathfindGoal); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index bce4f35567..91ec306801 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -174,7 +174,7 @@ private: newPeep->PaidOnFood = 0; newPeep->PaidOnSouvenirs = 0; newPeep->FavouriteRide = RIDE_ID_NULL; - newPeep->staff_orders = _staffOrders; + newPeep->StaffOrders = _staffOrders; uint16_t idSearchSpriteIndex; Peep* idSearchPeep; diff --git a/src/openrct2/actions/StaffSetOrdersAction.hpp b/src/openrct2/actions/StaffSetOrdersAction.hpp index e9ce50fbfd..38e811fbf6 100644 --- a/src/openrct2/actions/StaffSetOrdersAction.hpp +++ b/src/openrct2/actions/StaffSetOrdersAction.hpp @@ -68,7 +68,7 @@ public: { Peep* peep = GET_PEEP(_spriteIndex); - peep->staff_orders = _ordersId; + peep->StaffOrders = _ordersId; window_invalidate_by_number(WC_PEEP, _spriteIndex); auto intent = Intent(INTENT_ACTION_REFRESH_STAFF_LIST); diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 02e0e1348c..75dfde8e3e 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -3170,7 +3170,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) if (type == PEEP_TYPE_STAFF && !GetNextIsSurface()) { // Prevent staff from leaving the path on their own unless they're allowed to mow. - if (!((this->staff_orders & STAFF_ORDERS_MOWING) && this->StaffMowingTimeout >= 12)) + if (!((this->StaffOrders & STAFF_ORDERS_MOWING) && this->StaffMowingTimeout >= 12)) { peep_return_to_centre_of_tile(this); return; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 2300b3526c..7b80bedaa3 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -693,7 +693,7 @@ struct Peep : SpriteBase }; union { - uint8_t staff_orders; + uint8_t StaffOrders; uint8_t PeepIsLostCountdown; }; uint8_t Photo1RideRef; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 85ea8c32e5..839051a5ff 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -616,13 +616,13 @@ bool Staff::DoHandymanPathFinding() uint8_t litterDirection = INVALID_DIRECTION; uint8_t validDirections = staff_get_valid_patrol_directions(this, NextLoc); - if ((staff_orders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + sprite_index) & 0xFFF) > 110) + if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + sprite_index) & 0xFFF) > 110) { litterDirection = staff_handyman_direction_to_nearest_litter(this); } Direction newDirection = INVALID_DIRECTION; - if (litterDirection == INVALID_DIRECTION && (staff_orders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) + if (litterDirection == INVALID_DIRECTION && (StaffOrders & STAFF_ORDERS_MOWING) && StaffMowingTimeout >= 12) { newDirection = staff_handyman_direction_to_uncut_grass(this, validDirections); } @@ -1645,7 +1645,7 @@ static constexpr const CoordsXY _WateringUseOffsets[] = { */ static int32_t peep_update_patrolling_find_watering(Peep* peep) { - if (!(peep->staff_orders & STAFF_ORDERS_WATER_FLOWERS)) + if (!(peep->StaffOrders & STAFF_ORDERS_WATER_FLOWERS)) return 0; uint8_t chosen_position = scenario_rand() & 7; @@ -1717,7 +1717,7 @@ static int32_t peep_update_patrolling_find_watering(Peep* peep) */ static int32_t peep_update_patrolling_find_bin(Peep* peep) { - if (!(peep->staff_orders & STAFF_ORDERS_EMPTY_BINS)) + if (!(peep->StaffOrders & STAFF_ORDERS_EMPTY_BINS)) return 0; if (peep->GetNextIsSurface()) @@ -1782,7 +1782,7 @@ static int32_t peep_update_patrolling_find_bin(Peep* peep) */ static int32_t peep_update_patrolling_find_grass(Peep* peep) { - if (!(peep->staff_orders & STAFF_ORDERS_MOWING)) + if (!(peep->StaffOrders & STAFF_ORDERS_MOWING)) return 0; if (peep->StaffMowingTimeout < 12) @@ -1814,7 +1814,7 @@ static int32_t peep_update_patrolling_find_grass(Peep* peep) */ static int32_t peep_update_patrolling_find_sweeping(Peep* peep) { - if (!(peep->staff_orders & STAFF_ORDERS_SWEEPING)) + if (!(peep->StaffOrders & STAFF_ORDERS_SWEEPING)) return 0; uint16_t sprite_id = sprite_get_first_in_quadrant(peep->x, peep->y); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 2fcbad2985..7c31517573 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -2706,12 +2706,12 @@ Peep* find_closest_mechanic(int32_t x, int32_t y, int32_t forInspection) else if (peep->state != PEEP_STATE_PATROLLING) continue; - if (!(peep->staff_orders & STAFF_ORDERS_FIX_RIDES)) + if (!(peep->StaffOrders & STAFF_ORDERS_FIX_RIDES)) continue; } else { - if (peep->state != PEEP_STATE_PATROLLING || !(peep->staff_orders & STAFF_ORDERS_INSPECT_RIDES)) + if (peep->state != PEEP_STATE_PATROLLING || !(peep->StaffOrders & STAFF_ORDERS_INSPECT_RIDES)) continue; } diff --git a/src/openrct2/scripting/ScEntity.hpp b/src/openrct2/scripting/ScEntity.hpp index 2ee9ffbbfe..09f036a46e 100644 --- a/src/openrct2/scripting/ScEntity.hpp +++ b/src/openrct2/scripting/ScEntity.hpp @@ -756,7 +756,7 @@ namespace OpenRCT2::Scripting uint8_t orders_get() const { auto peep = GetStaff(); - return peep != nullptr ? peep->staff_orders : 0; + return peep != nullptr ? peep->StaffOrders : 0; } void orders_set(uint8_t value) @@ -765,7 +765,7 @@ namespace OpenRCT2::Scripting auto peep = GetStaff(); if (peep != nullptr) { - peep->staff_orders = value; + peep->StaffOrders = value; } } }; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index cef1f8f36e..6099aaf84d 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -229,7 +229,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) } COMPARE_FIELD(path_check_optimisation); COMPARE_FIELD(guest_heading_to_ride_id); - COMPARE_FIELD(staff_orders); + COMPARE_FIELD(StaffOrders); COMPARE_FIELD(Photo1RideRef); COMPARE_FIELD(PeepFlags); COMPARE_FIELD(PathfindGoal.x); From d05e5f8dc741aa24f5c57a29cf81918150a1e051 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 18:02:31 -0300 Subject: [PATCH 11/16] Rename Peep::guest_heading_to_ride_id to GuestHeadingToRideId --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/RideDemolishAction.hpp | 4 +-- src/openrct2/management/Marketing.cpp | 4 +-- src/openrct2/peep/Guest.cpp | 38 ++++++++++----------- src/openrct2/peep/GuestPathfinding.cpp | 4 +-- src/openrct2/peep/Peep.cpp | 22 ++++++------ src/openrct2/peep/Peep.h | 4 +-- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/Pathfinding.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 33466760fa..61fb347918 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -281,7 +281,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, thoughts[i]); } COMPARE_FIELD(Peep, path_check_optimisation); - COMPARE_FIELD(Peep, guest_heading_to_ride_id); + COMPARE_FIELD(Peep, GuestHeadingToRideId); COMPARE_FIELD(Peep, StaffOrders); COMPARE_FIELD(Peep, Photo1RideRef); COMPARE_FIELD(Peep, PeepFlags); diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 5b6ee4662c..07314d1037 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -214,9 +214,9 @@ private: } } - if (peep->guest_heading_to_ride_id == _rideIndex) + if (peep->GuestHeadingToRideId == _rideIndex) { - peep->guest_heading_to_ride_id = RIDE_ID_NULL; + peep->GuestHeadingToRideId = RIDE_ID_NULL; } if (peep->FavouriteRide == _rideIndex) { diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index cae6de58d3..650e9872a3 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -142,7 +142,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; peep->VoucherType = VOUCHER_TYPE_RIDE_FREE; peep->VoucherArguments = campaign->RideId; - peep->guest_heading_to_ride_id = campaign->RideId; + peep->GuestHeadingToRideId = campaign->RideId; peep->PeepIsLostCountdown = 240; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: @@ -157,7 +157,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) case ADVERTISING_CAMPAIGN_PARK: break; case ADVERTISING_CAMPAIGN_RIDE: - peep->guest_heading_to_ride_id = campaign->RideId; + peep->GuestHeadingToRideId = campaign->RideId; peep->PeepIsLostCountdown = 240; break; } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 94f969aaed..8752b0556b 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -803,7 +803,7 @@ void Guest::Tick128UpdateGuest(int32_t index) } if (state == PEEP_STATE_WALKING && outside_of_park == 0 && !(PeepFlags & PEEP_FLAGS_LEAVING_PARK) && no_of_rides == 0 - && guest_heading_to_ride_id == RIDE_ID_NULL) + && GuestHeadingToRideId == RIDE_ID_NULL) { uint32_t time_duration = gScenarioTicks - time_in_park; time_duration /= 2048; @@ -812,7 +812,7 @@ void Guest::Tick128UpdateGuest(int32_t index) { PickRideToGoOn(); - if (guest_heading_to_ride_id == RIDE_ID_NULL) + if (GuestHeadingToRideId == RIDE_ID_NULL) { happiness_target = std::max(happiness_target - 128, 0); peep_leave_park(this); @@ -1416,13 +1416,13 @@ void Guest::CheckIfLost() */ void Guest::CheckCantFindRide() { - if (guest_heading_to_ride_id == RIDE_ID_NULL) + if (GuestHeadingToRideId == RIDE_ID_NULL) return; // Peeps will think "I can't find ride X" twice before giving up completely. if (PeepIsLostCountdown == 30 || PeepIsLostCountdown == 60) { - InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND, guest_heading_to_ride_id); + InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND, GuestHeadingToRideId); happiness_target = std::max(happiness_target - 30, 0); } @@ -1430,7 +1430,7 @@ void Guest::CheckCantFindRide() if (PeepIsLostCountdown != 0) return; - guest_heading_to_ride_id = RIDE_ID_NULL; + GuestHeadingToRideId = RIDE_ID_NULL; rct_window* w = window_find_by_number(WC_PEEP, sprite_index); if (w) @@ -1800,7 +1800,7 @@ void Guest::OnExitRide(ride_id_t rideIndex) if (ride != nullptr && peep_should_go_on_ride_again(this, ride)) { - guest_heading_to_ride_id = rideIndex; + GuestHeadingToRideId = rideIndex; PeepIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; @@ -1850,7 +1850,7 @@ void Guest::PickRideToGoOn() { if (state != PEEP_STATE_WALKING) return; - if (guest_heading_to_ride_id != RIDE_ID_NULL) + if (GuestHeadingToRideId != RIDE_ID_NULL) return; if (PeepFlags & PEEP_FLAGS_LEAVING_PARK) return; @@ -1863,7 +1863,7 @@ void Guest::PickRideToGoOn() if (ride != nullptr) { // Head to that ride - guest_heading_to_ride_id = ride->id; + GuestHeadingToRideId = ride->id; PeepIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; @@ -2093,7 +2093,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t { // If a peep has already decided that they're going to go on a ride, they'll skip the weather and // excitement check and will only do a basic intensity check when they arrive at the ride itself. - if (ride->id == guest_heading_to_ride_id) + if (ride->id == GuestHeadingToRideId) { if (ride->intensity > RIDE_RATING(10, 00) && !gCheatsIgnoreRideIntensity) { @@ -2240,7 +2240,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t ride_update_popularity(ride, 1); } - if (ride->id == guest_heading_to_ride_id) + if (ride->id == GuestHeadingToRideId) { peep_reset_ride_heading(this); } @@ -2319,7 +2319,7 @@ bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop) if (peepAtShop) { ride_update_popularity(ride, 1); - if (ride->id == guest_heading_to_ride_id) + if (ride->id == GuestHeadingToRideId) { peep_reset_ride_heading(this); } @@ -2394,7 +2394,7 @@ void Guest::ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide) previous_ride_time_out = 0; } - if (ride->id == guest_heading_to_ride_id) + if (ride->id == GuestHeadingToRideId) { peep_reset_ride_heading(this); } @@ -2428,7 +2428,7 @@ static void peep_tried_to_enter_full_queue(Peep* peep, Ride* ride) peep->previous_ride = ride->id; peep->previous_ride_time_out = 0; // Change status "Heading to" to "Walking" if queue is full - if (ride->id == peep->guest_heading_to_ride_id) + if (ride->id == peep->GuestHeadingToRideId) { peep_reset_ride_heading(peep); } @@ -2436,7 +2436,7 @@ static void peep_tried_to_enter_full_queue(Peep* peep, Ride* ride) static void peep_reset_ride_heading(Peep* peep) { - peep->guest_heading_to_ride_id = RIDE_ID_NULL; + peep->GuestHeadingToRideId = RIDE_ID_NULL; peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; } @@ -3117,7 +3117,7 @@ static void peep_decide_whether_to_leave_park(Peep* peep) */ static void peep_leave_park(Peep* peep) { - peep->guest_heading_to_ride_id = RIDE_ID_NULL; + peep->GuestHeadingToRideId = RIDE_ID_NULL; if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { if (peep->PeepIsLostCountdown < 60) @@ -3150,9 +3150,9 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co return; if (peep->x == LOCATION_NULL) return; - if (peep->guest_heading_to_ride_id != RIDE_ID_NULL) + if (peep->GuestHeadingToRideId != RIDE_ID_NULL) { - auto ride = get_ride(peep->guest_heading_to_ride_id); + auto ride = get_ride(peep->GuestHeadingToRideId); if (ride != nullptr && predicate(*ride)) { return; @@ -3241,7 +3241,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co if (closestRide != nullptr) { // Head to that ride - peep->guest_heading_to_ride_id = closestRide->id; + peep->GuestHeadingToRideId = closestRide->id; peep->PeepIsLostCountdown = 200; peep_reset_pathfind_goal(peep); peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; @@ -6944,5 +6944,5 @@ void Guest::UpdateSpriteType() bool Guest::HeadingForRideOrParkExit() const { - return (PeepFlags & PEEP_FLAGS_LEAVING_PARK) || (guest_heading_to_ride_id != 0xFF); + return (PeepFlags & PEEP_FLAGS_LEAVING_PARK) || (GuestHeadingToRideId != 0xFF); } diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 1c99933907..589f34c9f7 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -2053,7 +2053,7 @@ int32_t guest_path_finding(Guest* peep) return guest_path_find_park_entrance(peep, edges); } - if (peep->guest_heading_to_ride_id == 0xFF) + if (peep->GuestHeadingToRideId == 0xFF) { #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) @@ -2066,7 +2066,7 @@ int32_t guest_path_finding(Guest* peep) } // Peep is heading for a ride. - ride_id_t rideIndex = peep->guest_heading_to_ride_id; + ride_id_t rideIndex = peep->GuestHeadingToRideId; auto ride = get_ride(rideIndex); if (ride == nullptr || ride->status != RIDE_STATUS_OPEN) { diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 75dfde8e3e..efab02d193 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1209,34 +1209,34 @@ void peep_problem_warnings_update() break; case PEEP_THOUGHT_TYPE_HUNGRY: // 0x14 - if (peep->guest_heading_to_ride_id == 0xFF) + if (peep->GuestHeadingToRideId == 0xFF) { hunger_counter++; break; } - ride = get_ride(peep->guest_heading_to_ride_id); + ride = get_ride(peep->GuestHeadingToRideId); if (ride != nullptr && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_FLAT_RIDE)) hunger_counter++; break; case PEEP_THOUGHT_TYPE_THIRSTY: - if (peep->guest_heading_to_ride_id == 0xFF) + if (peep->GuestHeadingToRideId == 0xFF) { thirst_counter++; break; } - ride = get_ride(peep->guest_heading_to_ride_id); + ride = get_ride(peep->GuestHeadingToRideId); if (ride != nullptr && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_SELLS_DRINKS)) thirst_counter++; break; case PEEP_THOUGHT_TYPE_TOILET: - if (peep->guest_heading_to_ride_id == 0xFF) + if (peep->GuestHeadingToRideId == 0xFF) { toilet_counter++; break; } - ride = get_ride(peep->guest_heading_to_ride_id); + ride = get_ride(peep->GuestHeadingToRideId); if (ride != nullptr && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IS_TOILET)) toilet_counter++; break; @@ -1760,7 +1760,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->PathfindGoal.direction = INVALID_DIRECTION; peep->ItemStandardFlags = 0; peep->item_extra_flags = 0; - peep->guest_heading_to_ride_id = RIDE_ID_NULL; + peep->GuestHeadingToRideId = RIDE_ID_NULL; peep->LitterCount = 0; peep->DisgustingCount = 0; peep->VandalismSeen = 0; @@ -1841,9 +1841,9 @@ void Peep::FormatActionTo(void* argsV) const } case PEEP_STATE_WALKING: case PEEP_STATE_USING_BIN: - if (guest_heading_to_ride_id != RIDE_ID_NULL) + if (GuestHeadingToRideId != RIDE_ID_NULL) { - auto ride = get_ride(guest_heading_to_ride_id); + auto ride = get_ride(GuestHeadingToRideId); if (ride != nullptr) { ft.Add(STR_HEADING_FOR); @@ -2993,8 +2993,8 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen } else { - if (peep->guest_heading_to_ride_id == rideIndex) - peep->guest_heading_to_ride_id = 0xFF; + if (peep->GuestHeadingToRideId == rideIndex) + peep->GuestHeadingToRideId = 0xFF; peep->action_sprite_image_offset = _unk_F1AEF0; peep->SetState(PEEP_STATE_BUYING); peep->current_ride = rideIndex; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 7b80bedaa3..86aaacf156 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -521,7 +521,7 @@ enum PeepInvalidate PEEP_INVALIDATE_PEEP_2 = 1 << 2, PEEP_INVALIDATE_PEEP_INVENTORY = 1 << 3, PEEP_INVALIDATE_STAFF_STATS = 1 << 4, - PEEP_INVALIDATE_PEEP_ACTION = 1 << 5, // Currently set only when guest_heading_to_ride_id is changed + PEEP_INVALIDATE_PEEP_ACTION = 1 << 5, // Currently set only when GuestHeadingToRideId is changed }; // Flags used by peep_should_go_on_ride() @@ -689,7 +689,7 @@ struct Peep : SpriteBase union { uint8_t staff_id; - uint8_t guest_heading_to_ride_id; + uint8_t GuestHeadingToRideId; }; union { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 8277df8333..c0113add8a 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1526,7 +1526,7 @@ private: dst->previous_ride_time_out = src->previous_ride_time_out; dst->path_check_optimisation = 0; - dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; + dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; // Doubles as staff orders dst->PeepIsLostCountdown = src->peep_is_lost_countdown; // The ID is fixed later diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index f7af4dd403..33346654ea 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1208,7 +1208,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dstThought->fresh_timeout = srcThought->fresh_timeout; } dst->path_check_optimisation = src->path_check_optimisation; - dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; + dst->guest_heading_to_ride_id = src->GuestHeadingToRideId; dst->peep_is_lost_countdown = src->PeepIsLostCountdown; dst->photo1_ride_ref = src->Photo1RideRef; dst->peep_flags = src->PeepFlags; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 379a2e3073..99039d1ada 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1473,7 +1473,7 @@ public: dstThought->fresh_timeout = srcThought->fresh_timeout; } dst->path_check_optimisation = src->path_check_optimisation; - dst->guest_heading_to_ride_id = src->guest_heading_to_ride_id; + dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; dst->PeepIsLostCountdown = src->peep_is_lost_countdown; dst->Photo1RideRef = src->photo1_ride_ref; dst->PeepFlags = src->peep_flags; diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index f641810ad7..48d2658a27 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -78,7 +78,7 @@ protected: // that with no actual ride to head towards, when a peep reaches a junction they use the 'aimless' // pathfinder instead of pursuing their original pathfinding target. So, we always need to give them // an actual ride to walk to the entrance of. - peep->guest_heading_to_ride_id = targetRideID; + peep->GuestHeadingToRideId = targetRideID; // Pick the direction the peep should initially move in, given the goal position. // This will also store the goal position and initialize pathfinding data for the peep. diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 6099aaf84d..83ced84df5 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -228,7 +228,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(thoughts[i].fresh_timeout); } COMPARE_FIELD(path_check_optimisation); - COMPARE_FIELD(guest_heading_to_ride_id); + COMPARE_FIELD(GuestHeadingToRideId); COMPARE_FIELD(StaffOrders); COMPARE_FIELD(Photo1RideRef); COMPARE_FIELD(PeepFlags); From 6dc08afdd0a0192d7ec56b0df5712f6a4fb0cdca Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 18:21:57 -0300 Subject: [PATCH 12/16] Rename Peep:staff_id to StaffId --- src/openrct2-ui/windows/Staff.cpp | 6 +++--- src/openrct2-ui/windows/StaffList.cpp | 4 ++-- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/actions/StaffSetPatrolAreaAction.hpp | 8 ++++---- src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 8 ++++---- src/openrct2/rct1/S4Importer.cpp | 4 ++-- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 19c1f6109a..f8e92d73ad 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -570,7 +570,7 @@ void window_staff_overview_mousedown(rct_window* w, rct_widgetindex widgetIndex, Peep* peep = GET_PEEP(w->number); // Disable clear patrol area if no area is set. - if (!(gStaffModes[peep->staff_id] & 2)) + if (!(gStaffModes[peep->StaffId] & 2)) { dropdown_set_disabled(1, true); } @@ -593,9 +593,9 @@ void window_staff_overview_dropdown(rct_window* w, rct_widgetindex widgetIndex, Peep* peep = GET_PEEP(w->number); for (int32_t i = 0; i < STAFF_PATROL_AREA_SIZE; i++) { - gStaffPatrolAreas[peep->staff_id * STAFF_PATROL_AREA_SIZE + i] = 0; + gStaffPatrolAreas[peep->StaffId * STAFF_PATROL_AREA_SIZE + i] = 0; } - gStaffModes[peep->staff_id] &= ~2; + gStaffModes[peep->StaffId] &= ~2; gfx_invalidate_screen(); staff_update_greyed_patrol_areas(); diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 92739b2ee6..e9ee701343 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -386,7 +386,7 @@ static void window_staff_list_tooldown(rct_window* w, rct_widgetindex widgetInde if (isPatrolAreaSet) { - if (!(gStaffModes[peep->staff_id] & 2)) + if (!(gStaffModes[peep->StaffId] & 2)) { continue; } @@ -707,7 +707,7 @@ void window_staff_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_ gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { actionOffset, y }, actionColumnSize); // True if a patrol path is set for the worker - if (gStaffModes[peep->staff_id] & 2) + if (gStaffModes[peep->StaffId] & 2) { gfx_draw_sprite(dpi, SPR_STAFF_PATROL_PATH, nameColumnSize + 5, y, 0); } diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index 91ec306801..99832a298a 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -246,7 +246,7 @@ private: newPeep->energy_target = 0x60; newPeep->StaffMowingTimeout = 0; - newPeep->staff_id = staffIndex; + newPeep->StaffId = staffIndex; gStaffModes[staffIndex] = STAFF_MODE_WALK; diff --git a/src/openrct2/actions/StaffSetPatrolAreaAction.hpp b/src/openrct2/actions/StaffSetPatrolAreaAction.hpp index cc2ec3fac1..22d113461e 100644 --- a/src/openrct2/actions/StaffSetPatrolAreaAction.hpp +++ b/src/openrct2/actions/StaffSetPatrolAreaAction.hpp @@ -69,9 +69,9 @@ public: return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE); } - int32_t patrolOffset = peep->staff_id * STAFF_PATROL_AREA_SIZE; + int32_t patrolOffset = peep->StaffId * STAFF_PATROL_AREA_SIZE; - staff_toggle_patrol_area(peep->staff_id, _loc.x, _loc.y); + staff_toggle_patrol_area(peep->StaffId, _loc.x, _loc.y); bool isPatrolling = false; for (int32_t i = 0; i < 128; i++) @@ -83,10 +83,10 @@ public: } } - gStaffModes[peep->staff_id] &= ~(1 << 1); + gStaffModes[peep->StaffId] &= ~(1 << 1); if (isPatrolling) { - gStaffModes[peep->staff_id] |= (1 << 1); + gStaffModes[peep->StaffId] |= (1 << 1); } for (int32_t y = 0; y < 4 * COORDS_XY_STEP; y += COORDS_XY_STEP) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index efab02d193..f5b31dee6d 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -848,7 +848,7 @@ void peep_sprite_remove(Peep* peep) { window_invalidate_by_class(WC_STAFF_LIST); - gStaffModes[peep->staff_id] = 0; + gStaffModes[peep->StaffId] = 0; peep->type = PEEP_TYPE_INVALID; staff_update_greyed_patrol_areas(); peep->type = PEEP_TYPE_STAFF; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 86aaacf156..5c86182cfe 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -688,7 +688,7 @@ struct Peep : SpriteBase uint8_t path_check_optimisation; // see peep.checkForPath union { - uint8_t staff_id; + uint8_t StaffId; uint8_t GuestHeadingToRideId; }; union diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 839051a5ff..dc3cf382f9 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -70,7 +70,7 @@ const rct_string_id StaffCostumeNames[] = { }; // clang-format on -// Every staff member has STAFF_PATROL_AREA_SIZE elements assigned to in this array, indexed by their staff_id +// Every staff member has STAFF_PATROL_AREA_SIZE elements assigned to in this array, indexed by their StaffId // Additionally there is a patrol area for each staff type, which is the union of the patrols of all staff members of that type uint32_t gStaffPatrolAreas[(STAFF_MAX_COUNT + STAFF_TYPE_COUNT) * STAFF_PATROL_AREA_SIZE]; uint8_t gStaffModes[STAFF_MAX_COUNT + STAFF_TYPE_COUNT]; @@ -157,7 +157,7 @@ void staff_update_greyed_patrol_areas() { if (peep->staff_type == staff_type) { - int32_t peepPatrolOffset = peep->staff_id * STAFF_PATROL_AREA_SIZE; + int32_t peepPatrolOffset = peep->StaffId * STAFF_PATROL_AREA_SIZE; for (int32_t i = 0; i < STAFF_PATROL_AREA_SIZE; i++) { gStaffPatrolAreas[staffPatrolOffset + i] |= gStaffPatrolAreas[peepPatrolOffset + i]; @@ -178,7 +178,7 @@ bool Staff::IsLocationInPatrol(const CoordsXY& loc) const return false; // Check if staff has patrol area - if (!(gStaffModes[staff_id] & 2)) + if (!(gStaffModes[StaffId] & 2)) return true; return IsPatrolAreaSet(loc); @@ -395,7 +395,7 @@ static bool staff_is_patrol_area_set(int32_t staffIndex, int32_t x, int32_t y) bool Staff::IsPatrolAreaSet(const CoordsXY& coords) const { - return staff_is_patrol_area_set(staff_id, coords.x, coords.y); + return staff_is_patrol_area_set(StaffId, coords.x, coords.y); } bool staff_is_patrol_area_set_for_type(STAFF_TYPE type, const CoordsXY& coords) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c0113add8a..385ee25fc2 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1596,7 +1596,7 @@ private: // index in the array ----^ ^--- bit position in the 8-bit value // We do the opposite in this function to recover the x and y values. - int32_t peepOffset = staffmember->staff_id * RCT12_PATROL_AREA_SIZE; + int32_t peepOffset = staffmember->StaffId * RCT12_PATROL_AREA_SIZE; for (int32_t i = 0; i < RCT12_PATROL_AREA_SIZE; i++) { if (_s4.patrol_areas[peepOffset + i] == 0) @@ -1620,7 +1620,7 @@ private: x <<= 7; int32_t y = val & 0x3E0; y <<= 2; - staff_set_patrol_area(staffmember->staff_id, x, y, true); + staff_set_patrol_area(staffmember->StaffId, x, y, true); } } } From fabdb8cdef041ed4aabf40b687056a60f88e65f7 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 31 May 2020 18:28:20 -0300 Subject: [PATCH 13/16] Rename Peep::path_check_optimisation to PathCheckOptimisation --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/peep/Peep.cpp | 10 +++++----- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 61fb347918..a604b2857c 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -280,7 +280,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots { COMPARE_FIELD(Peep, thoughts[i]); } - COMPARE_FIELD(Peep, path_check_optimisation); + COMPARE_FIELD(Peep, PathCheckOptimisation); COMPARE_FIELD(Peep, GuestHeadingToRideId); COMPARE_FIELD(Peep, StaffOrders); COMPARE_FIELD(Peep, Photo1RideRef); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index 99832a298a..b0013fd458 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -165,7 +165,7 @@ private: newPeep->action_sprite_image_offset = 0; newPeep->NoActionFrameNum = 0; newPeep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; - newPeep->path_check_optimisation = 0; + newPeep->PathCheckOptimisation = 0; newPeep->type = PEEP_TYPE_STAFF; newPeep->outside_of_park = 0; newPeep->PeepFlags = 0; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index f5b31dee6d..c58d4a4b14 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -471,8 +471,8 @@ static void peep_128_tick_update(Peep* peep, int32_t index) */ bool Peep::CheckForPath() { - path_check_optimisation++; - if ((path_check_optimisation & 0xF) != (sprite_index & 0xF)) + PathCheckOptimisation++; + if ((PathCheckOptimisation & 0xF) != (sprite_index & 0xF)) { // This condition makes the check happen less often // As a side effect peeps hover for a short, @@ -758,7 +758,7 @@ void Peep::PickupAbort(int32_t old_x) special_sprite = 0; action_sprite_image_offset = 0; action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; - path_check_optimisation = 0; + PathCheckOptimisation = 0; } gPickupPeepImage = UINT32_MAX; @@ -807,7 +807,7 @@ bool Peep::Place(const TileCoordsXYZ& location, bool apply) special_sprite = 0; action_sprite_image_offset = 0; action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; - path_check_optimisation = 0; + PathCheckOptimisation = 0; sprite_position_tween_reset(); if (type == PEEP_TYPE_GUEST) @@ -1645,7 +1645,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->MoveTo(coords); peep->sprite_direction = 0; peep->mass = (scenario_rand() & 0x1F) + 45; - peep->path_check_optimisation = 0; + peep->PathCheckOptimisation = 0; peep->interaction_ride_index = RIDE_ID_NULL; peep->type = PEEP_TYPE_GUEST; peep->previous_ride = RIDE_ID_NULL; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 5c86182cfe..a9527fabdd 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -685,7 +685,7 @@ struct Peep : SpriteBase uint8_t previous_ride; uint16_t previous_ride_time_out; rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; - uint8_t path_check_optimisation; // see peep.checkForPath + uint8_t PathCheckOptimisation; // see peep.checkForPath union { uint8_t StaffId; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 385ee25fc2..008fea3f15 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1525,7 +1525,7 @@ private: dst->previous_ride = src->previous_ride; dst->previous_ride_time_out = src->previous_ride_time_out; - dst->path_check_optimisation = 0; + dst->PathCheckOptimisation = 0; dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; // Doubles as staff orders dst->PeepIsLostCountdown = src->peep_is_lost_countdown; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 33346654ea..773bd7955f 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1207,7 +1207,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dstThought->freshness = srcThought->freshness; dstThought->fresh_timeout = srcThought->fresh_timeout; } - dst->path_check_optimisation = src->path_check_optimisation; + dst->path_check_optimisation = src->PathCheckOptimisation; dst->guest_heading_to_ride_id = src->GuestHeadingToRideId; dst->peep_is_lost_countdown = src->PeepIsLostCountdown; dst->photo1_ride_ref = src->Photo1RideRef; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 99039d1ada..5924435bbf 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1472,7 +1472,7 @@ public: dstThought->freshness = srcThought->freshness; dstThought->fresh_timeout = srcThought->fresh_timeout; } - dst->path_check_optimisation = src->path_check_optimisation; + dst->PathCheckOptimisation = src->path_check_optimisation; dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; dst->PeepIsLostCountdown = src->peep_is_lost_countdown; dst->Photo1RideRef = src->photo1_ride_ref; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 83ced84df5..fc37f25473 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -227,7 +227,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(thoughts[i].freshness); COMPARE_FIELD(thoughts[i].fresh_timeout); } - COMPARE_FIELD(path_check_optimisation); + COMPARE_FIELD(PathCheckOptimisation); COMPARE_FIELD(GuestHeadingToRideId); COMPARE_FIELD(StaffOrders); COMPARE_FIELD(Photo1RideRef); From ce952961b9f2b33cc6b4396cffa1d3751b98e350 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 3 Jun 2020 22:39:03 -0300 Subject: [PATCH 14/16] Rename Peep::PeepIsLostCountdown to GuestIsLostCountdown --- src/openrct2/management/Marketing.cpp | 4 ++-- src/openrct2/peep/Guest.cpp | 22 +++++++++++----------- src/openrct2/peep/GuestPathfinding.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/world/Park.cpp | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/openrct2/management/Marketing.cpp b/src/openrct2/management/Marketing.cpp index 650e9872a3..9ad7e31e63 100644 --- a/src/openrct2/management/Marketing.cpp +++ b/src/openrct2/management/Marketing.cpp @@ -143,7 +143,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) peep->VoucherType = VOUCHER_TYPE_RIDE_FREE; peep->VoucherArguments = campaign->RideId; peep->GuestHeadingToRideId = campaign->RideId; - peep->PeepIsLostCountdown = 240; + peep->GuestIsLostCountdown = 240; break; case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE: peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER; @@ -158,7 +158,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType) break; case ADVERTISING_CAMPAIGN_RIDE: peep->GuestHeadingToRideId = campaign->RideId; - peep->PeepIsLostCountdown = 240; + peep->GuestIsLostCountdown = 240; break; } } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 8752b0556b..40589a5693 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -1420,14 +1420,14 @@ void Guest::CheckCantFindRide() return; // Peeps will think "I can't find ride X" twice before giving up completely. - if (PeepIsLostCountdown == 30 || PeepIsLostCountdown == 60) + if (GuestIsLostCountdown == 30 || GuestIsLostCountdown == 60) { InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND, GuestHeadingToRideId); happiness_target = std::max(happiness_target - 30, 0); } - PeepIsLostCountdown--; - if (PeepIsLostCountdown != 0) + GuestIsLostCountdown--; + if (GuestIsLostCountdown != 0) return; GuestHeadingToRideId = RIDE_ID_NULL; @@ -1452,14 +1452,14 @@ void Guest::CheckCantFindExit() return; // Peeps who can't find the park exit will continue to get less happy until they find it. - if (PeepIsLostCountdown == 1) + if (GuestIsLostCountdown == 1) { InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND_EXIT, PEEP_THOUGHT_ITEM_NONE); happiness_target = std::max(happiness_target - 30, 0); } - if (--PeepIsLostCountdown == 0) - PeepIsLostCountdown = 90; + if (--GuestIsLostCountdown == 0) + GuestIsLostCountdown = 90; } /** Main logic to decide whether a peep should buy an item in question @@ -1801,7 +1801,7 @@ void Guest::OnExitRide(ride_id_t rideIndex) if (ride != nullptr && peep_should_go_on_ride_again(this, ride)) { GuestHeadingToRideId = rideIndex; - PeepIsLostCountdown = 200; + GuestIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; } @@ -1864,7 +1864,7 @@ void Guest::PickRideToGoOn() { // Head to that ride GuestHeadingToRideId = ride->id; - PeepIsLostCountdown = 200; + GuestIsLostCountdown = 200; peep_reset_pathfind_goal(this); window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; @@ -3120,14 +3120,14 @@ static void peep_leave_park(Peep* peep) peep->GuestHeadingToRideId = RIDE_ID_NULL; if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) { - if (peep->PeepIsLostCountdown < 60) + if (peep->GuestIsLostCountdown < 60) { return; } } else { - peep->PeepIsLostCountdown = 254; + peep->GuestIsLostCountdown = 254; peep->PeepFlags |= PEEP_FLAGS_LEAVING_PARK; peep->PeepFlags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN; } @@ -3242,7 +3242,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co { // Head to that ride peep->GuestHeadingToRideId = closestRide->id; - peep->PeepIsLostCountdown = 200; + peep->GuestIsLostCountdown = 200; peep_reset_pathfind_goal(peep); peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_ACTION; peep->TimeLost = 0; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 589f34c9f7..1ff4b4cd34 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -450,7 +450,7 @@ static uint8_t peep_pathfind_get_max_number_junctions(Peep* peep) return 8; } - if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK && peep->PeepIsLostCountdown < 90) + if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK && peep->GuestIsLostCountdown < 90) { return 8; } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index a9527fabdd..abd403c3a1 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -694,7 +694,7 @@ struct Peep : SpriteBase union { uint8_t StaffOrders; - uint8_t PeepIsLostCountdown; + uint8_t GuestIsLostCountdown; }; uint8_t Photo1RideRef; uint32_t PeepFlags; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 008fea3f15..3154b784d8 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1528,7 +1528,7 @@ private: dst->PathCheckOptimisation = 0; dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; // Doubles as staff orders - dst->PeepIsLostCountdown = src->peep_is_lost_countdown; + dst->GuestIsLostCountdown = src->peep_is_lost_countdown; // The ID is fixed later dst->next_in_queue = src->next_in_queue; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 773bd7955f..607f4dafb9 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1209,7 +1209,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } dst->path_check_optimisation = src->PathCheckOptimisation; dst->guest_heading_to_ride_id = src->GuestHeadingToRideId; - dst->peep_is_lost_countdown = src->PeepIsLostCountdown; + dst->peep_is_lost_countdown = src->GuestIsLostCountdown; dst->photo1_ride_ref = src->Photo1RideRef; dst->peep_flags = src->PeepFlags; dst->pathfind_goal = src->PathfindGoal; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 5924435bbf..910be98a1b 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1474,7 +1474,7 @@ public: } dst->PathCheckOptimisation = src->path_check_optimisation; dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; - dst->PeepIsLostCountdown = src->peep_is_lost_countdown; + dst->GuestIsLostCountdown = src->peep_is_lost_countdown; dst->Photo1RideRef = src->photo1_ride_ref; dst->PeepFlags = src->peep_flags; dst->PathfindGoal = src->pathfind_goal; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index ce6696b7e1..f451cc4931 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -395,7 +395,7 @@ int32_t Park::CalculateParkRating() const { happyGuestCount++; } - if ((peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) && (peep->PeepIsLostCountdown < 90)) + if ((peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) && (peep->GuestIsLostCountdown < 90)) { lostGuestCount++; } From c9f071a7660c5d8d6b8092b661849f5ed9c5c156 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 3 Jun 2020 22:41:54 -0300 Subject: [PATCH 15/16] Rename Peep::TimeOnRide to GuestTimeOnRide --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 12 ++++++------ src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index a604b2857c..42e916c837 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -292,7 +292,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots } COMPARE_FIELD(Peep, NoActionFrameNum); COMPARE_FIELD(Peep, LitterCount); - COMPARE_FIELD(Peep, TimeOnRide); + COMPARE_FIELD(Peep, GuestTimeOnRide); COMPARE_FIELD(Peep, DisgustingCount); COMPARE_FIELD(Peep, PaidToEnter); COMPARE_FIELD(Peep, PaidOnRides); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 40589a5693..17decd09ef 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -776,18 +776,18 @@ void Guest::Tick128UpdateGuest(int32_t index) if (state == PEEP_STATE_ON_RIDE || state == PEEP_STATE_ENTERING_RIDE) { - TimeOnRide = std::min(255, TimeOnRide + 1); + GuestTimeOnRide = std::min(255, GuestTimeOnRide + 1); if (PeepFlags & PEEP_FLAGS_WOW) { InsertNewThought(PEEP_THOUGHT_TYPE_WOW2, PEEP_THOUGHT_ITEM_NONE); } - if (TimeOnRide > 15) + if (GuestTimeOnRide > 15) { happiness_target = std::max(0, happiness_target - 5); - if (TimeOnRide > 22) + if (GuestTimeOnRide > 22) { auto ride = get_ride(current_ride); if (ride != nullptr) @@ -2548,7 +2548,7 @@ void Guest::GoToRideEntrance(Ride* ride) sub_state = PEEP_RIDE_IN_ENTRANCE; rejoin_queue_timeout = 0; - TimeOnRide = 0; + GuestTimeOnRide = 0; RemoveFromQueue(); } @@ -4079,7 +4079,7 @@ void Guest::UpdateRideEnterVehicle() vehicle->mass += seatedPeepAsGuest->mass; seatedPeepAsGuest->MoveTo({ LOCATION_NULL, 0, 0 }); seatedPeepAsGuest->SetState(PEEP_STATE_ON_RIDE); - seatedPeepAsGuest->TimeOnRide = 0; + seatedPeepAsGuest->GuestTimeOnRide = 0; seatedPeepAsGuest->sub_state = PEEP_RIDE_ON_RIDE; seatedPeepAsGuest->OnEnterRide(current_ride); } @@ -4095,7 +4095,7 @@ void Guest::UpdateRideEnterVehicle() SetState(PEEP_STATE_ON_RIDE); - TimeOnRide = 0; + GuestTimeOnRide = 0; sub_state = PEEP_RIDE_ON_RIDE; OnEnterRide(current_ride); } diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index c58d4a4b14..537f385d05 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2976,7 +2976,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen peep->SetState(PEEP_STATE_ENTERING_RIDE); peep->sub_state = PEEP_SHOP_APPROACH; - peep->TimeOnRide = 0; + peep->GuestTimeOnRide = 0; ride->cur_num_customers++; if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index abd403c3a1..bc1aedadbf 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -705,7 +705,7 @@ struct Peep : SpriteBase uint8_t LitterCount; union { - uint8_t TimeOnRide; + uint8_t GuestTimeOnRide; uint8_t StaffMowingTimeout; }; // 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 3154b784d8..16f7c14bf6 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1471,7 +1471,7 @@ private: dst->current_train = src->current_train; dst->current_car = src->current_car; dst->current_seat = src->current_seat; - dst->TimeOnRide = src->time_on_ride; + dst->GuestTimeOnRide = src->time_on_ride; dst->DaysInQueue = src->days_in_queue; dst->interaction_ride_index = src->interaction_ride_index; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 607f4dafb9..c2731e03a2 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1219,7 +1219,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } dst->no_action_frame_num = src->NoActionFrameNum; dst->litter_count = src->LitterCount; - dst->time_on_ride = src->TimeOnRide; + dst->time_on_ride = src->GuestTimeOnRide; dst->disgusting_count = src->DisgustingCount; dst->paid_to_enter = src->PaidToEnter; dst->paid_on_rides = src->PaidOnRides; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 910be98a1b..2c4154fabc 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1484,7 +1484,7 @@ public: } dst->NoActionFrameNum = src->no_action_frame_num; dst->LitterCount = src->litter_count; - dst->TimeOnRide = src->time_on_ride; + dst->GuestTimeOnRide = src->time_on_ride; dst->DisgustingCount = src->disgusting_count; dst->PaidToEnter = src->paid_to_enter; dst->PaidOnRides = src->paid_on_rides; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index fc37f25473..b3336f0086 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -245,7 +245,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) } COMPARE_FIELD(NoActionFrameNum); COMPARE_FIELD(LitterCount); - COMPARE_FIELD(TimeOnRide); + COMPARE_FIELD(GuestTimeOnRide); COMPARE_FIELD(DisgustingCount); COMPARE_FIELD(PaidToEnter); COMPARE_FIELD(PaidOnRides); From 57a2dab0641c9b5c33e4ff6410d9972f39f7d2cf Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Wed, 3 Jun 2020 22:45:15 -0300 Subject: [PATCH 16/16] Rename Peep::NoActionFrameNum to WalkingFrameNum --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/Peep.cpp | 10 +++++----- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 42e916c837..f3fbb46b2a 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -290,7 +290,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots { COMPARE_FIELD(Peep, PathfindHistory[i]); } - COMPARE_FIELD(Peep, NoActionFrameNum); + COMPARE_FIELD(Peep, WalkingFrameNum); COMPARE_FIELD(Peep, LitterCount); COMPARE_FIELD(Peep, GuestTimeOnRide); COMPARE_FIELD(Peep, DisgustingCount); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index b0013fd458..b9b3aa9c45 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -163,7 +163,7 @@ private: newPeep->action = PEEP_ACTION_NONE_2; newPeep->special_sprite = 0; newPeep->action_sprite_image_offset = 0; - newPeep->NoActionFrameNum = 0; + newPeep->WalkingFrameNum = 0; newPeep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; newPeep->PathCheckOptimisation = 0; newPeep->type = PEEP_TYPE_STAFF; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 17decd09ef..ab661b8cfa 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -6765,7 +6765,7 @@ void Guest::SetSpriteType(PeepSpriteType new_sprite_type) sprite_type = new_sprite_type; action_sprite_image_offset = 0; - NoActionFrameNum = 0; + WalkingFrameNum = 0; if (action >= PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 537f385d05..ff884b4d5a 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -631,14 +631,14 @@ std::optional Peep::UpdateAction(int16_t& xy_distance) sprite_direction = nextDirection; CoordsXY loc = { x, y }; loc += word_981D7C[nextDirection / 8]; - NoActionFrameNum++; + WalkingFrameNum++; const rct_peep_animation* peepAnimation = g_peep_animation_entries[sprite_type].sprite_animation; const uint8_t* imageOffset = peepAnimation[action_sprite_type].frame_offsets; - if (NoActionFrameNum >= peepAnimation[action_sprite_type].num_frames) + if (WalkingFrameNum >= peepAnimation[action_sprite_type].num_frames) { - NoActionFrameNum = 0; + WalkingFrameNum = 0; } - action_sprite_image_offset = imageOffset[NoActionFrameNum]; + action_sprite_image_offset = imageOffset[WalkingFrameNum]; return loc; } @@ -1631,7 +1631,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->action = PEEP_ACTION_NONE_2; peep->special_sprite = 0; peep->action_sprite_image_offset = 0; - peep->NoActionFrameNum = 0; + peep->WalkingFrameNum = 0; peep->action_sprite_type = PEEP_ACTION_SPRITE_TYPE_NONE; peep->PeepFlags = 0; peep->FavouriteRide = RIDE_ID_NULL; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index bc1aedadbf..a1ad3de117 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -700,7 +700,7 @@ struct Peep : SpriteBase uint32_t PeepFlags; rct12_xyzd8 PathfindGoal; rct12_xyzd8 PathfindHistory[4]; - uint8_t NoActionFrameNum; + uint8_t WalkingFrameNum; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t LitterCount; union diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index dc3cf382f9..c8695867c5 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1856,7 +1856,7 @@ void Staff::Tick128UpdateStaff() sprite_type = newSpriteType; action_sprite_image_offset = 0; - NoActionFrameNum = 0; + WalkingFrameNum = 0; if (action < PEEP_ACTION_NONE_1) action = PEEP_ACTION_NONE_2; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 16f7c14bf6..d23ba62425 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1395,7 +1395,7 @@ private: dst->special_sprite = src->special_sprite; dst->next_action_sprite_type = static_cast(src->next_action_sprite_type); dst->action_sprite_image_offset = src->action_sprite_image_offset; - dst->NoActionFrameNum = src->no_action_frame_num; + dst->WalkingFrameNum = src->no_action_frame_num; dst->action_sprite_type = static_cast(src->action_sprite_type); dst->action_frame = src->action_frame; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index c2731e03a2..5b9a96cff0 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1217,7 +1217,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) { dst->pathfind_history[i] = src->PathfindHistory[i]; } - dst->no_action_frame_num = src->NoActionFrameNum; + dst->no_action_frame_num = src->WalkingFrameNum; dst->litter_count = src->LitterCount; dst->time_on_ride = src->GuestTimeOnRide; dst->disgusting_count = src->DisgustingCount; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 2c4154fabc..56b91bb27c 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1482,7 +1482,7 @@ public: { dst->PathfindHistory[i] = src->pathfind_history[i]; } - dst->NoActionFrameNum = src->no_action_frame_num; + dst->WalkingFrameNum = src->no_action_frame_num; dst->LitterCount = src->litter_count; dst->GuestTimeOnRide = src->time_on_ride; dst->DisgustingCount = src->disgusting_count; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index b3336f0086..f0afa9b8f4 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -243,7 +243,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(PathfindHistory[i].z); COMPARE_FIELD(PathfindHistory[i].direction); } - COMPARE_FIELD(NoActionFrameNum); + COMPARE_FIELD(WalkingFrameNum); COMPARE_FIELD(LitterCount); COMPARE_FIELD(GuestTimeOnRide); COMPARE_FIELD(DisgustingCount);