From e08c1b44b272e16a72daba50971e5ff64edfa3be Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:03:58 -0300 Subject: [PATCH 01/16] Rename Peep::thoughts to Thoughts --- src/openrct2-ui/windows/Guest.cpp | 8 ++--- src/openrct2-ui/windows/GuestList.cpp | 6 ++-- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/RideDemolishAction.hpp | 10 +++--- src/openrct2/management/Award.cpp | 40 ++++++++++----------- src/openrct2/peep/Guest.cpp | 4 +-- src/openrct2/peep/Peep.cpp | 40 ++++++++++----------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 4 +-- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 8 ++--- 12 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 1b74736a67..cbe2bae1d5 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1105,12 +1105,12 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi) int32_t i = 0; for (; i < PEEP_MAX_THOUGHTS; ++i) { - if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) + if (peep->Thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) { w->list_information_type = 0; return; } - if (peep->thoughts[i].freshness == 1) + if (peep->Thoughts[i].freshness == 1) { // If a fresh thought break; } @@ -1122,7 +1122,7 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi) } x = widget->right - widget->left - w->list_information_type; - peep_thought_set_format_args(&peep->thoughts[i]); + peep_thought_set_format_args(&peep->Thoughts[i]); gfx_draw_string_left(&dpi_marquee, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, x, 0); } @@ -1904,7 +1904,7 @@ void window_guest_thoughts_paint(rct_window* w, rct_drawpixelinfo* dpi) gfx_draw_string_left(dpi, STR_GUEST_RECENT_THOUGHTS_LABEL, nullptr, COLOUR_BLACK, x, y); y += 10; - for (rct_peep_thought* thought = peep->thoughts; thought < &peep->thoughts[PEEP_MAX_THOUGHTS]; ++thought) + for (rct_peep_thought* thought = peep->Thoughts; thought < &peep->Thoughts[PEEP_MAX_THOUGHTS]; ++thought) { if (thought->type == PEEP_THOUGHT_TYPE_NONE) return; diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index 72d0fa6421..bb3b4a9370 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -792,7 +792,7 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, // For each thought for (uint32_t j = 0; j < PEEP_MAX_THOUGHTS; j++) { - thought = &peep->thoughts[j]; + thought = &peep->Thoughts[j]; if (thought->type == PEEP_THOUGHT_TYPE_NONE) break; if (thought->freshness == 0) @@ -800,7 +800,7 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, if (thought->freshness > 5) break; - peep_thought_set_format_args(&peep->thoughts[j]); + peep_thought_set_format_args(&peep->Thoughts[j]); gfx_draw_string_left_clipped(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 118, y }, 329); break; } @@ -911,7 +911,7 @@ static FilterArguments get_arguments_from_peep(const Peep* peep) break; case VIEW_THOUGHTS: { - auto thought = &peep->thoughts[0]; + auto thought = &peep->Thoughts[0]; if (thought->freshness <= 5 && thought->type != PEEP_THOUGHT_TYPE_NONE) { std::memset(gCommonFormatArgs, 0, sizeof(gCommonFormatArgs)); diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index f3fbb46b2a..12098d6f81 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -278,7 +278,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, previous_ride_time_out); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { - COMPARE_FIELD(Peep, thoughts[i]); + COMPARE_FIELD(Peep, Thoughts[i]); } COMPARE_FIELD(Peep, PathCheckOptimisation); COMPARE_FIELD(Peep, GuestHeadingToRideId); diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 07314d1037..1a261242ca 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -227,15 +227,15 @@ private: { // Don't touch items after the first NONE thought as they are not valid // fixes issues with clearing out bad thought data in multiplayer - if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) + if (peep->Thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) break; - if (peep->thoughts[i].type != PEEP_THOUGHT_TYPE_NONE && peep->thoughts[i].item == _rideIndex) + if (peep->Thoughts[i].type != PEEP_THOUGHT_TYPE_NONE && peep->Thoughts[i].item == _rideIndex) { // Clear top thought, push others up - memmove(&peep->thoughts[i], &peep->thoughts[i + 1], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); - peep->thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; - peep->thoughts[PEEP_MAX_THOUGHTS - 1].item = PEEP_THOUGHT_ITEM_NONE; + memmove(&peep->Thoughts[i], &peep->Thoughts[i + 1], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); + peep->Thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; + peep->Thoughts[PEEP_MAX_THOUGHTS - 1].item = PEEP_THOUGHT_ITEM_NONE; // Next iteration, check the new thought at this index i--; } diff --git a/src/openrct2/management/Award.cpp b/src/openrct2/management/Award.cpp index 9393f41ada..710855645d 100644 --- a/src/openrct2/management/Award.cpp +++ b/src/openrct2/management/Award.cpp @@ -92,12 +92,12 @@ static bool award_is_deserved_most_untidy(int32_t activeAwardTypes) if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness > 5) + if (peep->Thoughts[0].freshness > 5) continue; - if (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) + if (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) { negativeCount++; } @@ -124,15 +124,15 @@ static bool award_is_deserved_most_tidy(int32_t activeAwardTypes) if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness > 5) + if (peep->Thoughts[0].freshness > 5) continue; - if (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VERY_CLEAN) + if (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VERY_CLEAN) positiveCount++; - if (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) + if (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) { negativeCount++; } @@ -207,15 +207,15 @@ static bool award_is_deserved_most_beautiful(int32_t activeAwardTypes) if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness > 5) + if (peep->Thoughts[0].freshness > 5) continue; - if (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_SCENERY) + if (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_SCENERY) positiveCount++; - if (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING - || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) + if (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_BAD_LITTER + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_PATH_DISGUSTING + || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) { negativeCount++; } @@ -251,7 +251,7 @@ static bool award_is_deserved_safest([[maybe_unused]] int32_t activeAwardTypes) { if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) + if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_VANDALISM) peepsWhoDislikeVandalism++; } @@ -340,7 +340,7 @@ static bool award_is_deserved_best_food(int32_t activeAwardTypes) if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) + if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) hungryPeeps++; } return (hungryPeeps <= 12); @@ -386,7 +386,7 @@ static bool award_is_deserved_worst_food(int32_t activeAwardTypes) if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) + if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_HUNGRY) hungryPeeps++; } return (hungryPeeps > 15); @@ -418,7 +418,7 @@ static bool award_is_deserved_best_restrooms([[maybe_unused]] int32_t activeAwar if (peep->outside_of_park != 0) continue; - if (peep->thoughts[0].freshness <= 5 && peep->thoughts[0].type == PEEP_THOUGHT_TYPE_TOILET) + if (peep->Thoughts[0].freshness <= 5 && peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_TOILET) guestsWhoNeedRestroom++; } return (guestsWhoNeedRestroom <= 16); @@ -550,8 +550,8 @@ static bool award_is_deserved_most_confusing_layout([[maybe_unused]] int32_t act continue; peepsCounted++; - if (peep->thoughts[0].freshness <= 5 - && (peep->thoughts[0].type == PEEP_THOUGHT_TYPE_LOST || peep->thoughts[0].type == PEEP_THOUGHT_TYPE_CANT_FIND)) + if (peep->Thoughts[0].freshness <= 5 + && (peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_LOST || peep->Thoughts[0].type == PEEP_THOUGHT_TYPE_CANT_FIND)) peepsLost++; } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index ab661b8cfa..038887b3c2 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -3297,7 +3297,7 @@ void Guest::StopPurchaseThought(uint8_t ride_type) // Remove the related thought for (int32_t i = 0; i < PEEP_MAX_THOUGHTS; ++i) { - rct_peep_thought* thought = &thoughts[i]; + rct_peep_thought* thought = &Thoughts[i]; if (thought->type == PEEP_THOUGHT_TYPE_NONE) break; @@ -3310,7 +3310,7 @@ void Guest::StopPurchaseThought(uint8_t ride_type) memmove(thought, thought + 1, sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); } - thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; + Thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_THOUGHTS; i--; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index ff884b4d5a..f68c49c951 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1054,28 +1054,28 @@ static void peep_update_thoughts(Peep* peep) int32_t fresh_thought = -1; for (int32_t i = 0; i < PEEP_MAX_THOUGHTS; i++) { - if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) + if (peep->Thoughts[i].type == PEEP_THOUGHT_TYPE_NONE) break; - if (peep->thoughts[i].freshness == 1) + if (peep->Thoughts[i].freshness == 1) { add_fresh = 0; // If thought is fresh we wait 220 ticks // before allowing a new thought to become fresh. - if (++peep->thoughts[i].fresh_timeout >= 220) + if (++peep->Thoughts[i].fresh_timeout >= 220) { - peep->thoughts[i].fresh_timeout = 0; + peep->Thoughts[i].fresh_timeout = 0; // Thought is no longer fresh - peep->thoughts[i].freshness++; + peep->Thoughts[i].freshness++; add_fresh = 1; } } - else if (peep->thoughts[i].freshness > 1) + else if (peep->Thoughts[i].freshness > 1) { - if (++peep->thoughts[i].fresh_timeout == 0) + if (++peep->Thoughts[i].fresh_timeout == 0) { // When thought is older than ~6900 ticks remove it - if (++peep->thoughts[i].freshness >= 28) + if (++peep->Thoughts[i].freshness >= 28) { peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_THOUGHTS; @@ -1083,9 +1083,9 @@ static void peep_update_thoughts(Peep* peep) if (i < PEEP_MAX_THOUGHTS - 2) { memmove( - &peep->thoughts[i], &peep->thoughts[i + 1], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); + &peep->Thoughts[i], &peep->Thoughts[i + 1], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); } - peep->thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; + peep->Thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE; } } } @@ -1099,7 +1099,7 @@ static void peep_update_thoughts(Peep* peep) // fresh. if (add_fresh && fresh_thought != -1) { - peep->thoughts[fresh_thought].freshness = 1; + peep->Thoughts[fresh_thought].freshness = 1; peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_THOUGHTS; } } @@ -1199,10 +1199,10 @@ void peep_problem_warnings_update() FOR_ALL_GUESTS (spriteIndex, peep) { - if (peep->outside_of_park != 0 || peep->thoughts[0].freshness > 5) + if (peep->outside_of_park != 0 || peep->Thoughts[0].freshness > 5) continue; - switch (peep->thoughts[0].type) + switch (peep->Thoughts[0].type) { case PEEP_THOUGHT_TYPE_LOST: // 0x10 lost_counter++; @@ -1586,7 +1586,7 @@ void Peep::InsertNewThought(PeepThoughtType thoughtType, uint8_t thoughtArgument for (int32_t i = 0; i < PEEP_MAX_THOUGHTS; ++i) { - rct_peep_thought* thought = &thoughts[i]; + rct_peep_thought* thought = &Thoughts[i]; // Remove the oldest thought by setting it to NONE. if (thought->type == PEEP_THOUGHT_TYPE_NONE) break; @@ -1604,12 +1604,12 @@ void Peep::InsertNewThought(PeepThoughtType thoughtType, uint8_t thoughtArgument } } - memmove(&thoughts[1], &thoughts[0], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - 1)); + memmove(&Thoughts[1], &Thoughts[0], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - 1)); - thoughts[0].type = thoughtType; - thoughts[0].item = thoughtArguments; - thoughts[0].freshness = 0; - thoughts[0].fresh_timeout = 0; + Thoughts[0].type = thoughtType; + Thoughts[0].item = thoughtArguments; + Thoughts[0].freshness = 0; + Thoughts[0].fresh_timeout = 0; window_invalidate_flags |= PEEP_INVALIDATE_PEEP_THOUGHTS; } @@ -1649,7 +1649,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->interaction_ride_index = RIDE_ID_NULL; peep->type = PEEP_TYPE_GUEST; peep->previous_ride = RIDE_ID_NULL; - peep->thoughts->type = PEEP_THOUGHT_TYPE_NONE; + peep->Thoughts->type = PEEP_THOUGHT_TYPE_NONE; peep->window_invalidate_flags = 0; uint8_t intensityHighest = (scenario_rand() & 0x7) + 3; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index a1ad3de117..08b42101d3 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -684,7 +684,7 @@ struct Peep : SpriteBase int8_t rejoin_queue_timeout; // whilst waiting for a free vehicle (or pair) in the entrance uint8_t previous_ride; uint16_t previous_ride_time_out; - rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; + rct_peep_thought Thoughts[PEEP_MAX_THOUGHTS]; uint8_t PathCheckOptimisation; // see peep.checkForPath union { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index d23ba62425..1feb5575b7 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1515,7 +1515,7 @@ private: for (size_t i = 0; i < std::size(src->thoughts); i++) { auto srcThought = &src->thoughts[i]; - auto dstThought = &dst->thoughts[i]; + auto dstThought = &dst->Thoughts[i]; dstThought->type = static_cast(srcThought->type); dstThought->item = srcThought->type; dstThought->freshness = srcThought->freshness; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 5b9a96cff0..a8b9740788 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1198,9 +1198,9 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->rejoin_queue_timeout = src->rejoin_queue_timeout; dst->previous_ride = src->previous_ride; dst->previous_ride_time_out = src->previous_ride_time_out; - for (size_t i = 0; i < std::size(src->thoughts); i++) + for (size_t i = 0; i < std::size(src->Thoughts); i++) { - auto srcThought = &src->thoughts[i]; + auto srcThought = &src->Thoughts[i]; auto dstThought = &dst->thoughts[i]; dstThought->type = static_cast(srcThought->type); dstThought->item = srcThought->item; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 56b91bb27c..6c52405c55 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1466,7 +1466,7 @@ public: for (size_t i = 0; i < std::size(src->thoughts); i++) { auto srcThought = &src->thoughts[i]; - auto dstThought = &dst->thoughts[i]; + auto dstThought = &dst->Thoughts[i]; dstThought->type = static_cast(srcThought->type); dstThought->item = srcThought->item; dstThought->freshness = srcThought->freshness; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index f0afa9b8f4..b600c68c1d 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -222,10 +222,10 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(previous_ride_time_out); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { - COMPARE_FIELD(thoughts[i].type); - COMPARE_FIELD(thoughts[i].item); - COMPARE_FIELD(thoughts[i].freshness); - COMPARE_FIELD(thoughts[i].fresh_timeout); + COMPARE_FIELD(Thoughts[i].type); + COMPARE_FIELD(Thoughts[i].item); + COMPARE_FIELD(Thoughts[i].freshness); + COMPARE_FIELD(Thoughts[i].fresh_timeout); } COMPARE_FIELD(PathCheckOptimisation); COMPARE_FIELD(GuestHeadingToRideId); From 7701b1827d315755c32049dd80214079147bba8d Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:07:36 -0300 Subject: [PATCH 02/16] Rename Peep::previous_ride_time_out to use TitleCase --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 6 +++--- 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, 10 insertions(+), 10 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 12098d6f81..98b9b62d06 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -275,7 +275,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, time_in_park); COMPARE_FIELD(Peep, rejoin_queue_timeout); COMPARE_FIELD(Peep, previous_ride); - COMPARE_FIELD(Peep, previous_ride_time_out); + COMPARE_FIELD(Peep, PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { COMPARE_FIELD(Peep, Thoughts[i]); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 038887b3c2..09ac31e3c3 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2391,7 +2391,7 @@ void Guest::ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide) if (peepAtRide && updateLastRide) { previous_ride = ride->id; - previous_ride_time_out = 0; + PreviousRideTimeOut = 0; } if (ride->id == GuestHeadingToRideId) @@ -2426,7 +2426,7 @@ static void peep_tried_to_enter_full_queue(Peep* peep, Ride* ride) { ride->lifecycle_flags |= RIDE_LIFECYCLE_QUEUE_FULL; peep->previous_ride = ride->id; - peep->previous_ride_time_out = 0; + peep->PreviousRideTimeOut = 0; // Change status "Heading to" to "Walking" if queue is full if (ride->id == peep->GuestHeadingToRideId) { @@ -3397,7 +3397,7 @@ void Guest::UpdateBuying() if (!item_bought) { previous_ride = current_ride; - previous_ride_time_out = 0; + PreviousRideTimeOut = 0; } else { diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index f68c49c951..a3fe6c269d 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1113,7 +1113,7 @@ void Peep::Update() if (type == PEEP_TYPE_GUEST) { if (previous_ride != RIDE_ID_NULL) - if (++previous_ride_time_out >= 720) + if (++PreviousRideTimeOut >= 720) previous_ride = RIDE_ID_NULL; peep_update_thoughts(this); diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 08b42101d3..1c3da166b0 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -683,7 +683,7 @@ struct Peep : SpriteBase int32_t time_in_park; int8_t rejoin_queue_timeout; // whilst waiting for a free vehicle (or pair) in the entrance uint8_t previous_ride; - uint16_t previous_ride_time_out; + uint16_t PreviousRideTimeOut; rct_peep_thought Thoughts[PEEP_MAX_THOUGHTS]; uint8_t PathCheckOptimisation; // see peep.checkForPath union diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 1feb5575b7..077b2c9ddf 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1523,7 +1523,7 @@ private: } dst->previous_ride = src->previous_ride; - dst->previous_ride_time_out = src->previous_ride_time_out; + dst->PreviousRideTimeOut = src->previous_ride_time_out; dst->PathCheckOptimisation = 0; dst->GuestHeadingToRideId = src->guest_heading_to_ride_id; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index a8b9740788..b761e78db9 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1197,7 +1197,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->time_in_park = src->time_in_park; dst->rejoin_queue_timeout = src->rejoin_queue_timeout; dst->previous_ride = src->previous_ride; - dst->previous_ride_time_out = src->previous_ride_time_out; + dst->previous_ride_time_out = src->PreviousRideTimeOut; for (size_t i = 0; i < std::size(src->Thoughts); i++) { auto srcThought = &src->Thoughts[i]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6c52405c55..c7172176a0 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1462,7 +1462,7 @@ public: dst->time_in_park = src->time_in_park; dst->rejoin_queue_timeout = src->rejoin_queue_timeout; dst->previous_ride = src->previous_ride; - dst->previous_ride_time_out = src->previous_ride_time_out; + dst->PreviousRideTimeOut = src->previous_ride_time_out; for (size_t i = 0; i < std::size(src->thoughts); i++) { auto srcThought = &src->thoughts[i]; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index b600c68c1d..a1e0c60b30 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -219,7 +219,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(time_in_park); COMPARE_FIELD(rejoin_queue_timeout); COMPARE_FIELD(previous_ride); - COMPARE_FIELD(previous_ride_time_out); + COMPARE_FIELD(PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { COMPARE_FIELD(Thoughts[i].type); From 3dad0fd500433926bb8ccc5ee43c58da63076b1f Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:10:00 -0300 Subject: [PATCH 03/16] Rename Peep::previous_ride to PreviousRide --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 14 +++++++------- src/openrct2/peep/Peep.cpp | 6 +++--- 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, 16 insertions(+), 16 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 98b9b62d06..a589850c01 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -274,7 +274,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, cash_spent); COMPARE_FIELD(Peep, time_in_park); COMPARE_FIELD(Peep, rejoin_queue_timeout); - COMPARE_FIELD(Peep, previous_ride); + COMPARE_FIELD(Peep, PreviousRide); COMPARE_FIELD(Peep, PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 09ac31e3c3..f8994f48e1 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2046,7 +2046,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 || ridePrice != 0) { - if (previous_ride == ride->id) + if (PreviousRide == ride->id) { ChoseNotToGoOnRide(ride, peepAtRide, false); return false; @@ -2256,7 +2256,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop) { // Peeps won't go to the same shop twice in a row. - if (ride->id == previous_ride) + if (ride->id == PreviousRide) { ChoseNotToGoOnRide(ride, peepAtShop, true); return false; @@ -2390,7 +2390,7 @@ void Guest::ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide) { if (peepAtRide && updateLastRide) { - previous_ride = ride->id; + PreviousRide = ride->id; PreviousRideTimeOut = 0; } @@ -2425,7 +2425,7 @@ static bool peep_has_voucher_for_free_ride(Peep* peep, Ride* ride) static void peep_tried_to_enter_full_queue(Peep* peep, Ride* ride) { ride->lifecycle_flags |= RIDE_LIFECYCLE_QUEUE_FULL; - peep->previous_ride = ride->id; + peep->PreviousRide = ride->id; peep->PreviousRideTimeOut = 0; // Change status "Heading to" to "Walking" if queue is full if (ride->id == peep->GuestHeadingToRideId) @@ -3372,7 +3372,7 @@ void Guest::UpdateBuying() if (ride->type == RIDE_TYPE_CASH_MACHINE) { - if (current_ride != previous_ride) + if (current_ride != PreviousRide) { cash_in_pocket += MONEY(50, 00); } @@ -3389,14 +3389,14 @@ void Guest::UpdateBuying() bool item_bought = false; - if (current_ride != previous_ride) + if (current_ride != PreviousRide) { if (ride->type == RIDE_TYPE_CASH_MACHINE) { item_bought = peep_should_use_cash_machine(this, current_ride); if (!item_bought) { - previous_ride = current_ride; + PreviousRide = current_ride; PreviousRideTimeOut = 0; } else diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index a3fe6c269d..0756c52d16 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1112,9 +1112,9 @@ void Peep::Update() { if (type == PEEP_TYPE_GUEST) { - if (previous_ride != RIDE_ID_NULL) + if (PreviousRide != RIDE_ID_NULL) if (++PreviousRideTimeOut >= 720) - previous_ride = RIDE_ID_NULL; + PreviousRide = RIDE_ID_NULL; peep_update_thoughts(this); } @@ -1648,7 +1648,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->PathCheckOptimisation = 0; peep->interaction_ride_index = RIDE_ID_NULL; peep->type = PEEP_TYPE_GUEST; - peep->previous_ride = RIDE_ID_NULL; + peep->PreviousRide = RIDE_ID_NULL; peep->Thoughts->type = PEEP_THOUGHT_TYPE_NONE; peep->window_invalidate_flags = 0; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 1c3da166b0..50a8bc94b5 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -682,7 +682,7 @@ struct Peep : SpriteBase money32 cash_spent; int32_t time_in_park; int8_t rejoin_queue_timeout; // whilst waiting for a free vehicle (or pair) in the entrance - uint8_t previous_ride; + uint8_t PreviousRide; uint16_t PreviousRideTimeOut; rct_peep_thought Thoughts[PEEP_MAX_THOUGHTS]; uint8_t PathCheckOptimisation; // see peep.checkForPath diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 077b2c9ddf..f3c04a2d2c 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1522,7 +1522,7 @@ private: dstThought->fresh_timeout = srcThought->fresh_timeout; } - dst->previous_ride = src->previous_ride; + dst->PreviousRide = src->previous_ride; dst->PreviousRideTimeOut = src->previous_ride_time_out; dst->PathCheckOptimisation = 0; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index b761e78db9..0ef7ac7cd6 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1196,7 +1196,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->cash_spent = src->cash_spent; dst->time_in_park = src->time_in_park; dst->rejoin_queue_timeout = src->rejoin_queue_timeout; - dst->previous_ride = src->previous_ride; + dst->previous_ride = src->PreviousRide; dst->previous_ride_time_out = src->PreviousRideTimeOut; for (size_t i = 0; i < std::size(src->Thoughts); i++) { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index c7172176a0..39f0e656cd 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1461,7 +1461,7 @@ public: dst->cash_spent = src->cash_spent; dst->time_in_park = src->time_in_park; dst->rejoin_queue_timeout = src->rejoin_queue_timeout; - dst->previous_ride = src->previous_ride; + dst->PreviousRide = src->previous_ride; dst->PreviousRideTimeOut = src->previous_ride_time_out; for (size_t i = 0; i < std::size(src->thoughts); i++) { diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index a1e0c60b30..10a55d574f 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -218,7 +218,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(cash_spent); COMPARE_FIELD(time_in_park); COMPARE_FIELD(rejoin_queue_timeout); - COMPARE_FIELD(previous_ride); + COMPARE_FIELD(PreviousRide); COMPARE_FIELD(PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) { From 4c459fada3bbf34c22dbe1067061e5d94982ae36 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:12:40 -0300 Subject: [PATCH 04/16] Rename Peep::rejoin_queue_timeout to use TitleCase --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 6 +++--- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index a589850c01..4731ae81a9 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -273,7 +273,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, cash_in_pocket); COMPARE_FIELD(Peep, cash_spent); COMPARE_FIELD(Peep, time_in_park); - COMPARE_FIELD(Peep, rejoin_queue_timeout); + COMPARE_FIELD(Peep, RejoinQueueTimeout); COMPARE_FIELD(Peep, PreviousRide); COMPARE_FIELD(Peep, PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index f8994f48e1..6791f252ec 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2547,7 +2547,7 @@ void Guest::GoToRideEntrance(Ride* ride) SetState(PEEP_STATE_ENTERING_RIDE); sub_state = PEEP_RIDE_IN_ENTRANCE; - rejoin_queue_timeout = 0; + RejoinQueueTimeout = 0; GuestTimeOnRide = 0; RemoveFromQueue(); @@ -3948,7 +3948,7 @@ void Guest::UpdateRideFreeVehicleCheck() if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_NO_VEHICLES)) { - if (ride->status != RIDE_STATUS_OPEN || ride->vehicle_change_timeout != 0 || (++rejoin_queue_timeout) == 0) + if (ride->status != RIDE_STATUS_OPEN || ride->vehicle_change_timeout != 0 || (++RejoinQueueTimeout) == 0) { peep_update_ride_no_free_vehicle_rejoin_queue(this, ride); return; @@ -4017,7 +4017,7 @@ void Guest::UpdateRideFreeVehicleCheck() } Vehicle* currentTrain = GET_VEHICLE(ride->vehicles[current_train]); - if (ride->status == RIDE_STATUS_OPEN && ++rejoin_queue_timeout != 0 + if (ride->status == RIDE_STATUS_OPEN && ++RejoinQueueTimeout != 0 && !currentTrain->UpdateFlag(VEHICLE_UPDATE_FLAG_TRAIN_READY_DEPART)) { return; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 50a8bc94b5..9acaf9c79e 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -681,7 +681,7 @@ struct Peep : SpriteBase money32 cash_in_pocket; money32 cash_spent; int32_t time_in_park; - int8_t rejoin_queue_timeout; // whilst waiting for a free vehicle (or pair) in the entrance + int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance uint8_t PreviousRide; uint16_t PreviousRideTimeOut; rct_peep_thought Thoughts[PEEP_MAX_THOUGHTS]; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 0ef7ac7cd6..d4ccf26890 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1195,7 +1195,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->cash_in_pocket = src->cash_in_pocket; dst->cash_spent = src->cash_spent; dst->time_in_park = src->time_in_park; - dst->rejoin_queue_timeout = src->rejoin_queue_timeout; + dst->rejoin_queue_timeout = src->RejoinQueueTimeout; dst->previous_ride = src->PreviousRide; dst->previous_ride_time_out = src->PreviousRideTimeOut; for (size_t i = 0; i < std::size(src->Thoughts); i++) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 39f0e656cd..b9fc8278c1 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1460,7 +1460,7 @@ public: dst->cash_in_pocket = src->cash_in_pocket; dst->cash_spent = src->cash_spent; dst->time_in_park = src->time_in_park; - dst->rejoin_queue_timeout = src->rejoin_queue_timeout; + dst->RejoinQueueTimeout = src->rejoin_queue_timeout; dst->PreviousRide = src->previous_ride; dst->PreviousRideTimeOut = src->previous_ride_time_out; for (size_t i = 0; i < std::size(src->thoughts); i++) diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 10a55d574f..d9d12f6a5e 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -217,7 +217,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(cash_in_pocket); COMPARE_FIELD(cash_spent); COMPARE_FIELD(time_in_park); - COMPARE_FIELD(rejoin_queue_timeout); + COMPARE_FIELD(RejoinQueueTimeout); COMPARE_FIELD(PreviousRide); COMPARE_FIELD(PreviousRideTimeOut); for (int i = 0; i < PEEP_MAX_THOUGHTS; i++) From cf4b052cd462e3af2c95d18f2d0b4d95ec4523fc Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:15:10 -0300 Subject: [PATCH 05/16] Rename Peep::time_in_park to TimeInPark --- src/openrct2-ui/windows/Guest.cpp | 6 +++--- src/openrct2-ui/windows/Staff.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 4 ++-- src/openrct2/peep/Peep.cpp | 2 +- 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 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index cbe2bae1d5..1e51bd375e 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1513,10 +1513,10 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi) // Time in park y += LIST_ROW_HEIGHT + 1; - if (peep->time_in_park != -1) + if (peep->TimeInPark != -1) { int32_t eax = gScenarioTicks; - eax -= peep->time_in_park; + eax -= peep->TimeInPark; eax >>= 11; auto ft = Formatter::Common(); ft.Add(eax & 0xFFFF); @@ -1579,7 +1579,7 @@ void window_guest_rides_update(rct_window* w) if (guest != nullptr) { // Every 2048 ticks do a full window_invalidate - int32_t number_of_ticks = gScenarioTicks - peep->time_in_park; + int32_t number_of_ticks = gScenarioTicks - peep->TimeInPark; if (!(number_of_ticks & 0x7FF)) w->Invalidate(); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index f8e92d73ad..2affab5b9b 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -1104,7 +1104,7 @@ void window_staff_stats_paint(rct_window* w, rct_drawpixelinfo* dpi) y += LIST_ROW_HEIGHT; } - gfx_draw_string_left(dpi, STR_STAFF_STAT_EMPLOYED_FOR, static_cast(&peep->time_in_park), COLOUR_BLACK, x, y); + gfx_draw_string_left(dpi, STR_STAFF_STAT_EMPLOYED_FOR, static_cast(&peep->TimeInPark), COLOUR_BLACK, x, y); y += LIST_ROW_HEIGHT; switch (peep->staff_type) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 4731ae81a9..6cba345f77 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -272,7 +272,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, id); COMPARE_FIELD(Peep, cash_in_pocket); COMPARE_FIELD(Peep, cash_spent); - COMPARE_FIELD(Peep, time_in_park); + COMPARE_FIELD(Peep, TimeInPark); COMPARE_FIELD(Peep, RejoinQueueTimeout); COMPARE_FIELD(Peep, PreviousRide); COMPARE_FIELD(Peep, PreviousRideTimeOut); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index b9b3aa9c45..d182b9d03e 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -231,7 +231,7 @@ private: } // Staff uses this - newPeep->time_in_park = gDateMonthsElapsed; + newPeep->TimeInPark = gDateMonthsElapsed; newPeep->PathfindGoal.x = 0xFF; newPeep->PathfindGoal.y = 0xFF; newPeep->PathfindGoal.z = 0xFF; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 6791f252ec..7193ad2114 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -805,7 +805,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 && GuestHeadingToRideId == RIDE_ID_NULL) { - uint32_t time_duration = gScenarioTicks - time_in_park; + uint32_t time_duration = gScenarioTicks - TimeInPark; time_duration /= 2048; if (time_duration >= 5) @@ -5679,7 +5679,7 @@ void Guest::UpdateEnteringPark() SetState(PEEP_STATE_FALLING); outside_of_park = 0; - time_in_park = gScenarioTicks; + TimeInPark = gScenarioTicks; increment_guests_in_park(); decrement_guests_heading_for_park(); auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT); diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 0756c52d16..bcca8c6723 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1753,7 +1753,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->cash_in_pocket = cash; peep->cash_spent = 0; - peep->time_in_park = -1; + peep->TimeInPark = -1; peep->PathfindGoal.x = 0xFF; peep->PathfindGoal.y = 0xFF; peep->PathfindGoal.z = 0xFF; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 9acaf9c79e..4d9577845e 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -680,7 +680,7 @@ struct Peep : SpriteBase uint32_t id; money32 cash_in_pocket; money32 cash_spent; - int32_t time_in_park; + int32_t TimeInPark; int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance uint8_t PreviousRide; uint16_t PreviousRideTimeOut; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index af154689bf..4539081333 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -366,7 +366,7 @@ void staff_reset_stats() FOR_ALL_STAFF (spriteIndex, peep) { - peep->time_in_park = gDateMonthsElapsed; + peep->TimeInPark = gDateMonthsElapsed; peep->StaffLawnsMown = 0; peep->StaffRidesFixed = 0; peep->StaffGardensWatered = 0; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index f3c04a2d2c..aa3783aea3 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1479,7 +1479,7 @@ private: dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; dst->cash_spent = src->cash_spent; - dst->time_in_park = src->time_in_park; + dst->TimeInPark = src->time_in_park; // This doubles as staff type dst->no_of_rides = src->no_of_rides; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index d4ccf26890..6e4cc75d51 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1194,7 +1194,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; dst->cash_spent = src->cash_spent; - dst->time_in_park = src->time_in_park; + dst->time_in_park = src->TimeInPark; dst->rejoin_queue_timeout = src->RejoinQueueTimeout; dst->previous_ride = src->PreviousRide; dst->previous_ride_time_out = src->PreviousRideTimeOut; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index b9fc8278c1..f80b34a5bb 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1459,7 +1459,7 @@ public: dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; dst->cash_spent = src->cash_spent; - dst->time_in_park = src->time_in_park; + dst->TimeInPark = src->time_in_park; dst->RejoinQueueTimeout = src->rejoin_queue_timeout; dst->PreviousRide = src->previous_ride; dst->PreviousRideTimeOut = src->previous_ride_time_out; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index d9d12f6a5e..45bd96dcec 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -216,7 +216,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(id); COMPARE_FIELD(cash_in_pocket); COMPARE_FIELD(cash_spent); - COMPARE_FIELD(time_in_park); + COMPARE_FIELD(TimeInPark); COMPARE_FIELD(RejoinQueueTimeout); COMPARE_FIELD(PreviousRide); COMPARE_FIELD(PreviousRideTimeOut); From 0fc7bd1afda9fbc33ad37ab56c51bfcc41938b5b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:17:43 -0300 Subject: [PATCH 06/16] Rename Peep::cash_spent to CashSpent --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- 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 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 1e51bd375e..4864e5a2db 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1792,7 +1792,7 @@ void window_guest_finance_paint(rct_window* w, rct_drawpixelinfo* dpi) // Cash spent y += LIST_ROW_HEIGHT; ft = Formatter::Common(); - ft.Add(peep->cash_spent); + ft.Add(peep->CashSpent); gfx_draw_string_left(dpi, STR_GUEST_STAT_CASH_SPENT, gCommonFormatArgs, COLOUR_BLACK, x, y); y += LIST_ROW_HEIGHT * 2; diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 6cba345f77..f1e371e71c 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -271,7 +271,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots } COMPARE_FIELD(Peep, id); COMPARE_FIELD(Peep, cash_in_pocket); - COMPARE_FIELD(Peep, cash_spent); + COMPARE_FIELD(Peep, CashSpent); COMPARE_FIELD(Peep, TimeInPark); COMPARE_FIELD(Peep, RejoinQueueTimeout); COMPARE_FIELD(Peep, PreviousRide); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 7193ad2114..502379e757 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2344,7 +2344,7 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp assert(!(gParkFlags & PARK_FLAGS_NO_MONEY)); cash_in_pocket = std::max(0, cash_in_pocket - amount); - cash_spent += amount; + CashSpent += amount; peep_expend_type += static_cast(amount); diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index bcca8c6723..8af04ffe43 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1752,7 +1752,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) } peep->cash_in_pocket = cash; - peep->cash_spent = 0; + peep->CashSpent = 0; peep->TimeInPark = -1; peep->PathfindGoal.x = 0xFF; peep->PathfindGoal.y = 0xFF; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 4d9577845e..d0478fa285 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -679,7 +679,7 @@ struct Peep : SpriteBase // window_peep_rides_update for how to use. uint32_t id; money32 cash_in_pocket; - money32 cash_spent; + money32 CashSpent; int32_t TimeInPark; int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance uint8_t PreviousRide; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index aa3783aea3..98c5c2f50f 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1478,7 +1478,7 @@ private: dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; - dst->cash_spent = src->cash_spent; + dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; // This doubles as staff type diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 6e4cc75d51..0ea6caac80 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1193,7 +1193,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; - dst->cash_spent = src->cash_spent; + dst->cash_spent = src->CashSpent; dst->time_in_park = src->TimeInPark; dst->rejoin_queue_timeout = src->RejoinQueueTimeout; dst->previous_ride = src->PreviousRide; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index f80b34a5bb..7c3ba5ed0e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1458,7 +1458,7 @@ public: } dst->id = src->id; dst->cash_in_pocket = src->cash_in_pocket; - dst->cash_spent = src->cash_spent; + dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; dst->RejoinQueueTimeout = src->rejoin_queue_timeout; dst->PreviousRide = src->previous_ride; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 45bd96dcec..5c8fdb154b 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -215,7 +215,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) } COMPARE_FIELD(id); COMPARE_FIELD(cash_in_pocket); - COMPARE_FIELD(cash_spent); + COMPARE_FIELD(CashSpent); COMPARE_FIELD(TimeInPark); COMPARE_FIELD(RejoinQueueTimeout); COMPARE_FIELD(PreviousRide); From 77af2326ffb8ba8bb8bfcbdd4ea06ee34dd2b559 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:19:37 -0300 Subject: [PATCH 07/16] Rename Peep::cash_in_pocket to CashInPocket --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/SetCheatAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 27 ++++++++++++------------- src/openrct2/peep/Peep.cpp | 4 ++-- 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/scripting/ScEntity.hpp | 4 ++-- test/tests/PlayTests.cpp | 4 ++-- test/tests/S6ImportExportTests.cpp | 2 +- 12 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 4864e5a2db..32b27b684b 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1786,7 +1786,7 @@ void window_guest_finance_paint(rct_window* w, rct_drawpixelinfo* dpi) // Cash in pocket auto ft = Formatter::Common(); - ft.Add(peep->cash_in_pocket); + ft.Add(peep->CashInPocket); gfx_draw_string_left(dpi, STR_GUEST_STAT_CASH_IN_POCKET, gCommonFormatArgs, COLOUR_BLACK, x, y); // Cash spent diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index f1e371e71c..a69c237eb0 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -270,7 +270,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, rides_been_on[i]); } COMPARE_FIELD(Peep, id); - COMPARE_FIELD(Peep, cash_in_pocket); + COMPARE_FIELD(Peep, CashInPocket); COMPARE_FIELD(Peep, CashSpent); COMPARE_FIELD(Peep, TimeInPark); COMPARE_FIELD(Peep, RejoinQueueTimeout); diff --git a/src/openrct2/actions/SetCheatAction.hpp b/src/openrct2/actions/SetCheatAction.hpp index 064dca1be5..3e3726051d 100644 --- a/src/openrct2/actions/SetCheatAction.hpp +++ b/src/openrct2/actions/SetCheatAction.hpp @@ -632,7 +632,7 @@ private: switch (object) { case OBJECT_MONEY: - peep->cash_in_pocket = MONEY(1000, 00); + peep->CashInPocket = MONEY(1000, 00); break; case OBJECT_PARK_MAP: peep->ItemStandardFlags |= PEEP_ITEM_MAP; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 502379e757..062fcc9225 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -866,8 +866,7 @@ void Guest::Tick128UpdateGuest(int32_t index) possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_TOILET; } - if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && cash_in_pocket <= MONEY(9, 00) && happiness >= 105 - && energy >= 70) + if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && CashInPocket <= MONEY(9, 00) && happiness >= 105 && energy >= 70) { /* The energy check was originally a second check on happiness. * This was superfluous so should probably check something else. @@ -1551,12 +1550,12 @@ loc_69B119: { if (price != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - if (cash_in_pocket == 0) + if (CashInPocket == 0) { InsertNewThought(PEEP_THOUGHT_TYPE_SPENT_MONEY, PEEP_THOUGHT_ITEM_NONE); return false; } - if (price > cash_in_pocket) + if (price > CashInPocket) { InsertNewThought(PEEP_THOUGHT_TYPE_CANT_AFFORD, shopItem); return false; @@ -2055,11 +2054,11 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t // Basic price checks if (ridePrice != 0 && !peep_has_voucher_for_free_ride(this, ride) && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { - if (ridePrice > cash_in_pocket) + if (ridePrice > CashInPocket) { if (peepAtRide) { - if (cash_in_pocket <= 0) + if (CashInPocket <= 0) { InsertNewThought(PEEP_THOUGHT_TYPE_SPENT_MONEY, PEEP_THOUGHT_ITEM_NONE); } @@ -2299,11 +2298,11 @@ bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop) // Basic price checks auto ridePrice = ride_get_price(ride); - if (ridePrice != 0 && ridePrice > cash_in_pocket) + if (ridePrice != 0 && ridePrice > CashInPocket) { if (peepAtShop) { - if (cash_in_pocket <= 0) + if (CashInPocket <= 0) { InsertNewThought(PEEP_THOUGHT_TYPE_SPENT_MONEY, PEEP_THOUGHT_ITEM_NONE); } @@ -2343,7 +2342,7 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp { assert(!(gParkFlags & PARK_FLAGS_NO_MONEY)); - cash_in_pocket = std::max(0, cash_in_pocket - amount); + CashInPocket = std::max(0, CashInPocket - amount); CashSpent += amount; peep_expend_type += static_cast(amount); @@ -2638,14 +2637,14 @@ static bool peep_check_ride_price_at_entrance(Guest* peep, Ride* ride, money32 r && peep->VoucherArguments == peep->current_ride) return true; - if (peep->cash_in_pocket <= 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) + if (peep->CashInPocket <= 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY)) { peep->InsertNewThought(PEEP_THOUGHT_TYPE_SPENT_MONEY, PEEP_THOUGHT_ITEM_NONE); peep_update_ride_at_entrance_try_leave(peep); return false; } - if (ridePrice > peep->cash_in_pocket) + if (ridePrice > peep->CashInPocket) { peep->InsertNewThought(PEEP_THOUGHT_TYPE_CANT_AFFORD_0, peep->current_ride); peep_update_ride_at_entrance_try_leave(peep); @@ -3094,7 +3093,7 @@ static void peep_decide_whether_to_leave_park(Peep* peep) } else { - if (peep->energy >= 55 && peep->happiness >= 45 && peep->cash_in_pocket >= MONEY(5, 00)) + if (peep->energy >= 55 && peep->happiness >= 45 && peep->CashInPocket >= MONEY(5, 00)) { return; } @@ -3327,7 +3326,7 @@ static bool peep_should_use_cash_machine(Peep* peep, ride_id_t rideIndex) return false; if (peep->PeepFlags & PEEP_FLAGS_LEAVING_PARK) return false; - if (peep->cash_in_pocket > MONEY(20, 00)) + if (peep->CashInPocket > MONEY(20, 00)) return false; if (115 + (scenario_rand() % 128) > peep->happiness) return false; @@ -3374,7 +3373,7 @@ void Guest::UpdateBuying() { if (current_ride != PreviousRide) { - cash_in_pocket += MONEY(50, 00); + CashInPocket += MONEY(50, 00); } window_invalidate_by_number(WC_PEEP, sprite_index); } diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 8af04ffe43..83040d86b3 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1751,7 +1751,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) cash = 0; } - peep->cash_in_pocket = cash; + peep->CashInPocket = cash; peep->CashSpent = 0; peep->TimeInPark = -1; peep->PathfindGoal.x = 0xFF; @@ -2616,7 +2616,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl peep->window_invalidate_flags |= PEEP_INVALIDATE_PEEP_INVENTORY; } } - if (entranceFee > peep->cash_in_pocket) + if (entranceFee > peep->CashInPocket) { peep->state = PEEP_STATE_LEAVING_PARK; peep->var_37 = 1; diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index d0478fa285..70a075ef07 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -678,7 +678,7 @@ struct Peep : SpriteBase // 255 bit bitmap of every ride the peep has been on see // window_peep_rides_update for how to use. uint32_t id; - money32 cash_in_pocket; + money32 CashInPocket; money32 CashSpent; int32_t TimeInPark; int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 98c5c2f50f..4225008366 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1477,7 +1477,7 @@ private: dst->interaction_ride_index = src->interaction_ride_index; dst->id = src->id; - dst->cash_in_pocket = src->cash_in_pocket; + dst->CashInPocket = src->cash_in_pocket; dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 0ea6caac80..52e333bf56 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1192,7 +1192,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->rides_been_on[i] = src->rides_been_on[i]; } dst->id = src->id; - dst->cash_in_pocket = src->cash_in_pocket; + dst->cash_in_pocket = src->CashInPocket; dst->cash_spent = src->CashSpent; dst->time_in_park = src->TimeInPark; dst->rejoin_queue_timeout = src->RejoinQueueTimeout; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 7c3ba5ed0e..269a1747da 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1457,7 +1457,7 @@ public: dst->rides_been_on[i] = src->rides_been_on[i]; } dst->id = src->id; - dst->cash_in_pocket = src->cash_in_pocket; + dst->CashInPocket = src->cash_in_pocket; dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; dst->RejoinQueueTimeout = src->rejoin_queue_timeout; diff --git a/src/openrct2/scripting/ScEntity.hpp b/src/openrct2/scripting/ScEntity.hpp index 09f036a46e..e3eef62b96 100644 --- a/src/openrct2/scripting/ScEntity.hpp +++ b/src/openrct2/scripting/ScEntity.hpp @@ -626,7 +626,7 @@ namespace OpenRCT2::Scripting int32_t cash_get() const { auto peep = GetPeep(); - return peep != nullptr ? peep->cash_in_pocket : 0; + return peep != nullptr ? peep->CashInPocket : 0; } void cash_set(int32_t value) { @@ -634,7 +634,7 @@ namespace OpenRCT2::Scripting auto peep = GetPeep(); if (peep != nullptr) { - peep->cash_in_pocket = std::max(0, value); + peep->CashInPocket = std::max(0, value); } } }; diff --git a/test/tests/PlayTests.cpp b/test/tests/PlayTests.cpp index bf63ebf776..89755338a9 100644 --- a/test/tests/PlayTests.cpp +++ b/test/tests/PlayTests.cpp @@ -115,7 +115,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds) // Insert a rich guest auto richGuest = gs->GetPark().GenerateGuest(); - richGuest->cash_in_pocket = 3000; + richGuest->CashInPocket = 3000; // Wait for rich guest to get in queue bool matched = updateUntil(*gs, 1000, [&]() { return richGuest->state == PEEP_STATE_QUEUING; }); @@ -123,7 +123,7 @@ TEST_F(PlayTests, SecondGuestInQueueShouldNotRideIfNoFunds) // Insert poor guest auto poorGuest = gs->GetPark().GenerateGuest(); - poorGuest->cash_in_pocket = 5; + poorGuest->CashInPocket = 5; // Wait for poor guest to get in queue matched = updateUntil(*gs, 1000, [&]() { return poorGuest->state == PEEP_STATE_QUEUING; }); diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 5c8fdb154b..38b0ea9518 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -214,7 +214,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(rides_been_on[i]); } COMPARE_FIELD(id); - COMPARE_FIELD(cash_in_pocket); + COMPARE_FIELD(CashInPocket); COMPARE_FIELD(CashSpent); COMPARE_FIELD(TimeInPark); COMPARE_FIELD(RejoinQueueTimeout); From 4cdfccb3387a2de4cc2acafa662791eb64596b82 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:31:19 -0300 Subject: [PATCH 08/16] Rename Peep::id to Id --- src/openrct2-ui/windows/TitleCommandEditor.cpp | 2 +- src/openrct2/Game.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/StaffHireNewAction.hpp | 6 +++--- src/openrct2/peep/Peep.cpp | 14 +++++++------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 4 ++-- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 4 ++-- src/openrct2/scripting/ScEntity.hpp | 4 ++-- test/tests/S6ImportExportTests.cpp | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/openrct2-ui/windows/TitleCommandEditor.cpp b/src/openrct2-ui/windows/TitleCommandEditor.cpp index b5ab4795ce..a9cf3b4cde 100644 --- a/src/openrct2-ui/windows/TitleCommandEditor.cpp +++ b/src/openrct2-ui/windows/TitleCommandEditor.cpp @@ -628,7 +628,7 @@ static void window_title_command_editor_tool_down( { uint8_t formatArgs[32]{}; peep->FormatNameTo(formatArgs); - format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, &peep->id); + format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, &peep->Id); } } else if (spriteIdentifier == SPRITE_IDENTIFIER_VEHICLE) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 5c6234d795..580c8b34ae 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -465,7 +465,7 @@ void game_fix_save_vars() continue; } auto ft = Formatter::Common(); - ft.Add(peep->id); + ft.Add(peep->Id); auto curName = peep->GetName(); log_warning( "Peep %u (%s) has invalid ride station = %u for ride %u.", spriteIndex, curName.c_str(), srcStation, rideIdx); diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index a69c237eb0..53649d7e6b 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -269,7 +269,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots { COMPARE_FIELD(Peep, rides_been_on[i]); } - COMPARE_FIELD(Peep, id); + COMPARE_FIELD(Peep, Id); COMPARE_FIELD(Peep, CashInPocket); COMPARE_FIELD(Peep, CashSpent); COMPARE_FIELD(Peep, TimeInPark); diff --git a/src/openrct2/actions/StaffHireNewAction.hpp b/src/openrct2/actions/StaffHireNewAction.hpp index d182b9d03e..6e6dffcb3b 100644 --- a/src/openrct2/actions/StaffHireNewAction.hpp +++ b/src/openrct2/actions/StaffHireNewAction.hpp @@ -179,7 +179,7 @@ private: uint16_t idSearchSpriteIndex; Peep* idSearchPeep; - // We search for the first available id for a given staff type + // We search for the first available Id for a given staff type uint32_t newStaffId = 0; for (;;) { @@ -191,7 +191,7 @@ private: if (idSearchPeep->staff_type != _staffType) continue; - if (idSearchPeep->id == newStaffId) + if (idSearchPeep->Id == newStaffId) { found = true; break; @@ -202,7 +202,7 @@ private: break; } - newPeep->id = newStaffId; + newPeep->Id = newStaffId; newPeep->staff_type = _staffType; PeepSpriteType spriteType = spriteTypes[_staffType]; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 83040d86b3..e4362e6363 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1729,7 +1729,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->no_of_rides = 0; std::fill_n(peep->ride_types_been_on, 16, 0x00); - peep->id = gNextGuestNumber++; + peep->Id = gNextGuestNumber++; peep->name = nullptr; money32 cash = (scenario_rand() & 0x3) * 100 - 100 + gGuestInitialCash; @@ -1998,17 +1998,17 @@ size_t Peep::FormatNameTo(void* argsV) const } ft.Add(staffNames[staffNameIndex]); - ft.Add(id); + ft.Add(Id); return ft.NumBytes(); } else if (gParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) { - auto realNameStringId = get_real_name_string_id_from_id(id); + auto realNameStringId = get_real_name_string_id_from_id(Id); return ft.Add(realNameStringId).NumBytes(); } else { - return ft.Add(STR_GUEST_X).Add(id).NumBytes(); + return ft.Add(STR_GUEST_X).Add(Id).NumBytes(); } } else @@ -3230,7 +3230,7 @@ int32_t Peep::GetZOnSlope(int32_t tile_x, int32_t tile_y) rct_string_id get_real_name_string_id_from_id(uint32_t id) { - // Generate a name_string_idx from the peep id using bit twiddling + // Generate a name_string_idx from the peep Id using bit twiddling uint16_t ax = static_cast(id + 0xF0B); uint16_t dx = 0; static constexpr uint16_t twiddlingBitOrder[] = { 4, 9, 3, 7, 5, 8, 2, 1, 6, 0, 12, 11, 13, 10 }; @@ -3271,7 +3271,7 @@ int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_ else { // Simple ID comparison for when both peeps use a number or a generated name - return peep_a->id - peep_b->id; + return peep_a->Id - peep_b->Id; } } @@ -3315,7 +3315,7 @@ void pathfind_logging_enable([[maybe_unused]] Peep* peep) { # if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG /* Determine if the pathfinding debugging is wanted for this peep. */ - format_string(gPathFindDebugPeepName, sizeof(gPathFindDebugPeepName), peep->name_string_idx, &(peep->id)); + format_string(gPathFindDebugPeepName, sizeof(gPathFindDebugPeepName), peep->name_string_idx, &(peep->Id)); /* For guests, use the existing PEEP_FLAGS_TRACKING flag to * determine for which guest(s) the pathfinding debugging will diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 70a075ef07..3a4ff3878c 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -677,7 +677,7 @@ struct Peep : SpriteBase uint8_t rides_been_on[32]; // 255 bit bitmap of every ride the peep has been on see // window_peep_rides_update for how to use. - uint32_t id; + uint32_t Id; money32 CashInPocket; money32 CashSpent; int32_t TimeInPark; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 4225008366..baf465159f 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1476,7 +1476,7 @@ private: dst->interaction_ride_index = src->interaction_ride_index; - dst->id = src->id; + dst->Id = src->id; dst->CashInPocket = src->cash_in_pocket; dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 52e333bf56..70ba9fd5e0 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1125,7 +1125,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) } else if (gParkFlags & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) { - dst->name_string_idx = get_real_name_string_id_from_id(src->id); + dst->name_string_idx = get_real_name_string_id_from_id(src->Id); } else { @@ -1191,7 +1191,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) { dst->rides_been_on[i] = src->rides_been_on[i]; } - dst->id = src->id; + dst->id = src->Id; dst->cash_in_pocket = src->CashInPocket; dst->cash_spent = src->CashSpent; dst->time_in_park = src->TimeInPark; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 269a1747da..f36314bf1a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1456,7 +1456,7 @@ public: { dst->rides_been_on[i] = src->rides_been_on[i]; } - dst->id = src->id; + dst->Id = src->id; dst->CashInPocket = src->cash_in_pocket; dst->CashSpent = src->cash_spent; dst->TimeInPark = src->time_in_park; diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 7e9d58c7ea..8fa51eb571 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -8954,7 +8954,7 @@ loc_6DC743: if (z == 2) { Peep* peep = GET_PEEP(vehicle->peep[0]); - if (peep->id & 7) + if (peep->Id & 7) { z = 7; } @@ -8962,7 +8962,7 @@ loc_6DC743: if (z == 6) { Peep* peep = GET_PEEP(vehicle->peep[0]); - if (peep->id & 7) + if (peep->Id & 7) { z = 8; } diff --git a/src/openrct2/scripting/ScEntity.hpp b/src/openrct2/scripting/ScEntity.hpp index e3eef62b96..92fe9f03f0 100644 --- a/src/openrct2/scripting/ScEntity.hpp +++ b/src/openrct2/scripting/ScEntity.hpp @@ -642,8 +642,8 @@ namespace OpenRCT2::Scripting class ScStaff : public ScPeep { public: - ScStaff(uint16_t id) - : ScPeep(id) + ScStaff(uint16_t Id) + : ScPeep(Id) { } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 38b0ea9518..a5ea3e8314 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -213,7 +213,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) { COMPARE_FIELD(rides_been_on[i]); } - COMPARE_FIELD(id); + COMPARE_FIELD(Id); COMPARE_FIELD(CashInPocket); COMPARE_FIELD(CashSpent); COMPARE_FIELD(TimeInPark); From 3748cdb19441ed7de34c8b160b64a0c196e1405b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:52:23 -0300 Subject: [PATCH 09/16] Rename Peep::rides_been_on to RidesBeenOn --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/RideDemolishAction.hpp | 4 ++-- src/openrct2/peep/Guest.cpp | 4 ++-- src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 4 ++-- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 53649d7e6b..955a17bb23 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -267,7 +267,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, time_in_queue); for (int i = 0; i < 32; i++) { - COMPARE_FIELD(Peep, rides_been_on[i]); + COMPARE_FIELD(Peep, RidesBeenOn[i]); } COMPARE_FIELD(Peep, Id); COMPARE_FIELD(Peep, CashInPocket); diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 1a261242ca..b86d0015ea 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -160,8 +160,8 @@ private: uint8_t ride_id_bit = _rideIndex % 8; uint8_t ride_id_offset = _rideIndex / 8; - // clear ride from potentially being in rides_been_on - peep->rides_been_on[ride_id_offset] &= ~(1 << ride_id_bit); + // clear ride from potentially being in RidesBeenOn + peep->RidesBeenOn[ride_id_offset] &= ~(1 << ride_id_bit); if (peep->state == PEEP_STATE_WATCHING) { if (peep->current_ride == _rideIndex) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 062fcc9225..4e8e264484 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2366,13 +2366,13 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp void Guest::SetHasRidden(const Ride* ride) { - rides_been_on[ride->id / 8] |= 1 << (ride->id % 8); + RidesBeenOn[ride->id / 8] |= 1 << (ride->id % 8); SetHasRiddenRideType(ride->type); } bool Guest::HasRidden(const Ride* ride) const { - return rides_been_on[ride->id / 8] & (1 << (ride->id % 8)); + return RidesBeenOn[ride->id / 8] & (1 << (ride->id % 8)); } void Guest::SetHasRiddenRideType(int32_t rideType) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index e4362e6363..da73a8b73e 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1725,7 +1725,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->toilet = 0; peep->time_to_consume = 0; - std::fill_n(peep->rides_been_on, 32, 0x00); + std::fill_n(peep->RidesBeenOn, 32, 0x00); peep->no_of_rides = 0; std::fill_n(peep->ride_types_been_on, 16, 0x00); diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 3a4ff3878c..413d23cb79 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -674,7 +674,7 @@ struct Peep : SpriteBase }; uint8_t interaction_ride_index; uint16_t time_in_queue; - uint8_t rides_been_on[32]; + uint8_t RidesBeenOn[32]; // 255 bit bitmap of every ride the peep has been on see // window_peep_rides_update for how to use. uint32_t Id; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index baf465159f..a07a41ff73 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1503,7 +1503,7 @@ private: for (size_t i = 0; i < 32; i++) { - dst->rides_been_on[i] = src->rides_been_on[i]; + dst->RidesBeenOn[i] = src->rides_been_on[i]; } for (size_t i = 0; i < 16; i++) { diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 70ba9fd5e0..dab4c229d2 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1187,9 +1187,9 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->direction = src->direction; dst->interaction_ride_index = src->interaction_ride_index; dst->time_in_queue = src->time_in_queue; - for (size_t i = 0; i < std::size(src->rides_been_on); i++) + for (size_t i = 0; i < std::size(src->RidesBeenOn); i++) { - dst->rides_been_on[i] = src->rides_been_on[i]; + dst->rides_been_on[i] = src->RidesBeenOn[i]; } dst->id = src->Id; dst->cash_in_pocket = src->CashInPocket; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index f36314bf1a..48e723b2f5 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1454,7 +1454,7 @@ public: dst->time_in_queue = src->time_in_queue; for (size_t i = 0; i < std::size(src->rides_been_on); i++) { - dst->rides_been_on[i] = src->rides_been_on[i]; + dst->RidesBeenOn[i] = src->rides_been_on[i]; } dst->Id = src->id; dst->CashInPocket = src->cash_in_pocket; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index a5ea3e8314..3258b98d8c 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -211,7 +211,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(time_in_queue); for (int i = 0; i < 32; i++) { - COMPARE_FIELD(rides_been_on[i]); + COMPARE_FIELD(RidesBeenOn[i]); } COMPARE_FIELD(Id); COMPARE_FIELD(CashInPocket); From 8400a7f54d03d6db3b6e855f65bae42e345d1395 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:54:40 -0300 Subject: [PATCH 10/16] Rename Peep::time_in_queue to TimeInQueue --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 18 +++++++++--------- src/openrct2/peep/Peep.cpp | 6 +++--- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 6 +++--- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 955a17bb23..d74b103a4f 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -264,7 +264,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, next_in_queue); COMPARE_FIELD(Peep, maze_last_edge); COMPARE_FIELD(Peep, interaction_ride_index); - COMPARE_FIELD(Peep, time_in_queue); + COMPARE_FIELD(Peep, TimeInQueue); for (int i = 0; i < 32; i++) { COMPARE_FIELD(Peep, RidesBeenOn[i]); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 4e8e264484..a3cfdccf10 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -952,7 +952,7 @@ void Guest::Tick128UpdateGuest(int32_t index) break; case PEEP_STATE_QUEUING: - if (time_in_queue >= 2000) + if (TimeInQueue >= 2000) { /* Peep happiness is affected once the peep has been waiting * too long in a queue. */ @@ -2029,7 +2029,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t } // This checks if there's a peep standing still at the very end of the queue. - if (maxD <= 13 && lastPeepInQueue->time_in_queue > 10) + if (maxD <= 13 && lastPeepInQueue->TimeInQueue > 10) { peep_tried_to_enter_full_queue(this, ride); return false; @@ -2680,11 +2680,11 @@ static int16_t peep_calculate_ride_satisfaction(Guest* peep, Ride* ride) // Calculate satisfaction based on how long the peep has been in the queue for. // (For comparison: peeps start thinking "I've been queueing for a long time" at 3500 and // start leaving the queue at 4300.) - if (peep->time_in_queue >= 4500) + if (peep->TimeInQueue >= 4500) satisfaction -= 35; - else if (peep->time_in_queue >= 2250) + else if (peep->TimeInQueue >= 2250) satisfaction -= 10; - else if (peep->time_in_queue <= 750) + else if (peep->TimeInQueue <= 750) satisfaction += 10; // Peeps get a small boost in satisfaction if they've been on a ride of the same type before, @@ -5588,7 +5588,7 @@ void Guest::UpdateQueuing() return; if (sprite_type == PEEP_SPRITE_TYPE_NORMAL) { - if (time_in_queue >= 2000 && (0xFFFF & scenario_rand()) <= 119) + if (TimeInQueue >= 2000 && (0xFFFF & scenario_rand()) <= 119) { // Eat Food/Look at watch action = PEEP_ACTION_EAT_FOOD; @@ -5596,7 +5596,7 @@ void Guest::UpdateQueuing() action_sprite_image_offset = 0; UpdateCurrentActionSpriteType(); } - if (time_in_queue >= 3500 && (0xFFFF & scenario_rand()) <= 93) + if (TimeInQueue >= 3500 && (0xFFFF & scenario_rand()) <= 93) { // Create the I have been waiting in line ages thought InsertNewThought(PEEP_THOUGHT_TYPE_QUEUING_AGES, current_ride); @@ -5604,7 +5604,7 @@ void Guest::UpdateQueuing() } else { - if (!(time_in_queue & 0x3F) && action == PEEP_ACTION_NONE_1 && next_action_sprite_type == 2) + if (!(TimeInQueue & 0x3F) && action == PEEP_ACTION_NONE_1 && next_action_sprite_type == 2) { switch (sprite_type) { @@ -5641,7 +5641,7 @@ void Guest::UpdateQueuing() } } } - if (time_in_queue < 4300) + if (TimeInQueue < 4300) return; if (happiness <= 65 && (0xFFFF & scenario_rand()) < 2184) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index da73a8b73e..5a95f71ca5 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2265,7 +2265,7 @@ void Peep::SwitchNextActionSpriteType() */ static bool peep_update_queue_position(Peep* peep, uint8_t previous_action) { - peep->time_in_queue++; + peep->TimeInQueue++; if (peep->next_in_queue == SPRITE_INDEX_NULL) return false; @@ -2438,7 +2438,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl peep->DaysInQueue = 0; peep->SetState(PEEP_STATE_QUEUING); peep->sub_state = 11; - peep->time_in_queue = 0; + peep->TimeInQueue = 0; if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); @@ -2870,7 +2870,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; + peep->TimeInQueue = 0; if (peep->PeepFlags & PEEP_FLAGS_TRACKING) { auto ft = Formatter::Common(); diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 413d23cb79..8576638a6f 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -673,7 +673,7 @@ struct Peep : SpriteBase Direction direction; // Direction ? }; uint8_t interaction_ride_index; - uint16_t time_in_queue; + uint16_t TimeInQueue; uint8_t RidesBeenOn[32]; // 255 bit bitmap of every ride the peep has been on see // window_peep_rides_update for how to use. diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 4539081333..9f6316229a 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1045,13 +1045,13 @@ static void staff_entertainer_update_nearby_peeps(Peep* peep) } else if (peep->state == PEEP_STATE_QUEUING) { - if (peep->time_in_queue > 200) + if (peep->TimeInQueue > 200) { - peep->time_in_queue -= 200; + peep->TimeInQueue -= 200; } else { - peep->time_in_queue = 0; + peep->TimeInQueue = 0; } peep->happiness_target = std::min(peep->happiness_target + 3, PEEP_MAX_HAPPINESS); } diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index dab4c229d2..9de9eee4cc 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1186,7 +1186,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->next_in_queue = src->next_in_queue; dst->direction = src->direction; dst->interaction_ride_index = src->interaction_ride_index; - dst->time_in_queue = src->time_in_queue; + dst->time_in_queue = src->TimeInQueue; for (size_t i = 0; i < std::size(src->RidesBeenOn); i++) { dst->rides_been_on[i] = src->RidesBeenOn[i]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 48e723b2f5..69b71f861f 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1451,7 +1451,7 @@ public: dst->next_in_queue = src->next_in_queue; dst->direction = src->direction; dst->interaction_ride_index = src->interaction_ride_index; - dst->time_in_queue = src->time_in_queue; + dst->TimeInQueue = src->time_in_queue; for (size_t i = 0; i < std::size(src->rides_been_on); i++) { dst->RidesBeenOn[i] = src->rides_been_on[i]; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 3258b98d8c..72c04b2ec7 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -208,7 +208,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(next_in_queue); COMPARE_FIELD(maze_last_edge); COMPARE_FIELD(interaction_ride_index); - COMPARE_FIELD(time_in_queue); + COMPARE_FIELD(TimeInQueue); for (int i = 0; i < 32; i++) { COMPARE_FIELD(RidesBeenOn[i]); From 8a50fafdc82a779d8eae39671f7a4b5c817941a3 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:57:14 -0300 Subject: [PATCH 11/16] Rename Peep::interaction_ride_index to use TitleCase --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/Peep.cpp | 22 +++++++++++----------- 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, 18 insertions(+), 18 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index d74b103a4f..e6a20cd5ff 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -263,7 +263,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, step_progress); COMPARE_FIELD(Peep, next_in_queue); COMPARE_FIELD(Peep, maze_last_edge); - COMPARE_FIELD(Peep, interaction_ride_index); + COMPARE_FIELD(Peep, InteractionRideIndex); COMPARE_FIELD(Peep, TimeInQueue); for (int i = 0; i < 32; i++) { diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index a3cfdccf10..b69d41308a 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -4999,7 +4999,7 @@ void Guest::UpdateRideLeaveExit() } } - interaction_ride_index = RIDE_ID_NULL; + InteractionRideIndex = RIDE_ID_NULL; SetState(PEEP_STATE_FALLING); CoordsXY targetLoc = { x, y }; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 5a95f71ca5..5794f10b86 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1646,7 +1646,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) peep->sprite_direction = 0; peep->mass = (scenario_rand() & 0x1F) + 45; peep->PathCheckOptimisation = 0; - peep->interaction_ride_index = RIDE_ID_NULL; + peep->InteractionRideIndex = RIDE_ID_NULL; peep->type = PEEP_TYPE_GUEST; peep->PreviousRide = RIDE_ID_NULL; peep->Thoughts->type = PEEP_THOUGHT_TYPE_NONE; @@ -2369,7 +2369,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl { // Default guest/staff behaviour attempting to enter a // ride exit is to turn around. - peep->interaction_ride_index = 0xFF; + peep->InteractionRideIndex = 0xFF; peep_return_to_centre_of_tile(peep); return; } @@ -2386,7 +2386,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl { // Default staff behaviour attempting to enter a // ride entrance is to turn around. - peep->interaction_ride_index = 0xFF; + peep->InteractionRideIndex = 0xFF; peep_return_to_centre_of_tile(peep); return; } @@ -2400,7 +2400,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl } // Guest is on a normal path, i.e. ride has no queue. - if (peep->interaction_ride_index == rideIndex) + if (peep->InteractionRideIndex == rideIndex) { // Peep is retrying the ride entrance without leaving // the path tile and without trying any other ride @@ -2419,14 +2419,14 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl { // Peep remembers that this is the last ride they // considered while on this path tile. - peep->interaction_ride_index = rideIndex; + peep->InteractionRideIndex = rideIndex; peep_return_to_centre_of_tile(peep); return; } // Guest has decided to go on the ride. peep->action_sprite_image_offset = _unk_F1AEF0; - peep->interaction_ride_index = rideIndex; + peep->InteractionRideIndex = rideIndex; uint16_t previous_last = ride->stations[stationNum].LastPeepInQueue; ride->stations[stationNum].LastPeepInQueue = peep->sprite_index; @@ -2830,7 +2830,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen else { // Queue got disconnected from the original ride. - peep->interaction_ride_index = 0xFF; + peep->InteractionRideIndex = 0xFF; guest->RemoveFromQueue(); peep->SetState(PEEP_STATE_1); peep_footpath_move_forward(peep, x, y, tile_element, vandalism_present); @@ -2853,7 +2853,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen if (ride != nullptr && guest->ShouldGoOnRide(ride, stationNum, true, false)) { // Peep has decided to go on the ride at the queue. - peep->interaction_ride_index = rideIndex; + peep->InteractionRideIndex = rideIndex; // Add the peep to the ride queue. uint16_t old_last_peep = ride->stations[stationNum].LastPeepInQueue; @@ -2901,7 +2901,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen } else { - peep->interaction_ride_index = 0xFF; + peep->InteractionRideIndex = 0xFF; if (peep->state == PEEP_STATE_QUEUING) { peep->RemoveFromQueue(); @@ -2937,7 +2937,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen return true; } - if (peep->interaction_ride_index == rideIndex) + if (peep->InteractionRideIndex == rideIndex) { peep_return_to_centre_of_tile(peep); return true; @@ -3140,7 +3140,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) int16_t height = abs(tile_element_height(newLoc) - z); if (height <= 3 || (type == PEEP_TYPE_STAFF && height <= 32)) { - interaction_ride_index = 0xFF; + InteractionRideIndex = 0xFF; if (state == PEEP_STATE_QUEUING) { RemoveFromQueue(); diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 8576638a6f..a4c85bc0c6 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -672,7 +672,7 @@ struct Peep : SpriteBase uint8_t maze_last_edge; Direction direction; // Direction ? }; - uint8_t interaction_ride_index; + uint8_t InteractionRideIndex; uint16_t TimeInQueue; uint8_t RidesBeenOn[32]; // 255 bit bitmap of every ride the peep has been on see diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index a07a41ff73..bfdb58b868 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1474,7 +1474,7 @@ private: dst->GuestTimeOnRide = src->time_on_ride; dst->DaysInQueue = src->days_in_queue; - dst->interaction_ride_index = src->interaction_ride_index; + dst->InteractionRideIndex = src->interaction_ride_index; dst->Id = src->id; dst->CashInPocket = src->cash_in_pocket; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 9de9eee4cc..ae7314fab5 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1185,7 +1185,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->step_progress = src->step_progress; dst->next_in_queue = src->next_in_queue; dst->direction = src->direction; - dst->interaction_ride_index = src->interaction_ride_index; + dst->interaction_ride_index = src->InteractionRideIndex; dst->time_in_queue = src->TimeInQueue; for (size_t i = 0; i < std::size(src->RidesBeenOn); i++) { diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 69b71f861f..19e16d6ad8 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1450,7 +1450,7 @@ public: dst->step_progress = src->step_progress; dst->next_in_queue = src->next_in_queue; dst->direction = src->direction; - dst->interaction_ride_index = src->interaction_ride_index; + dst->InteractionRideIndex = src->interaction_ride_index; dst->TimeInQueue = src->time_in_queue; for (size_t i = 0; i < std::size(src->rides_been_on); i++) { diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 72c04b2ec7..c1c1f9eebb 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -207,7 +207,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(step_progress); COMPARE_FIELD(next_in_queue); COMPARE_FIELD(maze_last_edge); - COMPARE_FIELD(interaction_ride_index); + COMPARE_FIELD(InteractionRideIndex); COMPARE_FIELD(TimeInQueue); for (int i = 0; i < 32; i++) { From 1a3f8490ad97cab8c69cfad399277c44c68d213b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 11:12:11 -0300 Subject: [PATCH 12/16] Rename Peep::direction to PeepDirection --- src/openrct2/peep/Guest.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 16 +++---- src/openrct2/peep/Peep.cpp | 18 ++++---- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 58 +++++++++++++------------- src/openrct2/rct1/S4Importer.cpp | 2 +- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/world/Park.cpp | 2 +- test/tests/Pathfinding.cpp | 2 +- 10 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index b69d41308a..e20d81e47c 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -3380,7 +3380,7 @@ void Guest::UpdateBuying() sprite_direction ^= 0x10; destination_x = NextLoc.x + 16; destination_y = NextLoc.y + 16; - direction = direction_reverse(direction); + PeepDirection = direction_reverse(PeepDirection); SetState(PEEP_STATE_WALKING); return; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 1ff4b4cd34..2f2b202050 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -118,7 +118,7 @@ static int32_t peep_move_one_tile(Direction direction, Peep* peep) return guest_surface_path_finding(peep); } - peep->direction = direction; + peep->PeepDirection = direction; peep->destination_x = newTile.x; peep->destination_y = newTile.y; peep->destination_tolerance = 2; @@ -415,9 +415,9 @@ static int32_t guest_path_find_aimless(Peep* peep, uint8_t edges) if (scenario_rand() & 1) { // If possible go straight - if (edges & (1 << peep->direction)) + if (edges & (1 << peep->PeepDirection)) { - return peep_move_one_tile(peep->direction, peep); + return peep_move_one_tile(peep->PeepDirection, peep); } } @@ -1496,13 +1496,13 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->PeepDirection)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { log_verbose( "Updating existing pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i, - loc.x, loc.y, loc.z, direction_reverse(peep->direction), chosen_edge); + loc.x, loc.y, loc.z, direction_reverse(peep->PeepDirection), chosen_edge); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 return chosen_edge; @@ -1521,13 +1521,13 @@ Direction peep_pathfind_choose_direction(const TileCoordsXYZ& loc, Peep* peep) peep->PathfindHistory[i].direction &= ~(1 << chosen_edge); /* Also remove the edge through which the peep * entered the junction from those left to try. */ - peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->direction)); + peep->PathfindHistory[i].direction &= ~(1 << direction_reverse(peep->PeepDirection)); #if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 if (gPathFindDebug) { log_verbose( "Storing new pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i, loc.x, loc.y, - loc.z, direction_reverse(peep->direction), chosen_edge); + loc.z, direction_reverse(peep->PeepDirection), chosen_edge); } #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 } @@ -1935,7 +1935,7 @@ int32_t guest_path_finding(Guest* peep) edges = adjustedEdges; } - int32_t direction = direction_reverse(peep->direction); + int32_t direction = direction_reverse(peep->PeepDirection); // Check if in a dead end (i.e. only edge is where the peep came from) if (!(edges & ~(1 << direction))) { diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 5794f10b86..a05f4c0784 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1018,7 +1018,7 @@ void Peep::Update1() destination_x = x; destination_y = y; destination_tolerance = 10; - direction = sprite_direction >> 3; + PeepDirection = sprite_direction >> 3; } void Peep::SetState(PeepState new_state) @@ -2337,7 +2337,7 @@ static bool peep_update_queue_position(Peep* peep, uint8_t previous_action) */ static void peep_return_to_centre_of_tile(Peep* peep) { - peep->direction = direction_reverse(peep->direction); + peep->PeepDirection = direction_reverse(peep->PeepDirection); peep->destination_x = (peep->x & 0xFFE0) + 16; peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerance = 5; @@ -2469,9 +2469,9 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl } uint8_t entranceDirection = tile_element->GetDirection(); - if (entranceDirection != peep->direction) + if (entranceDirection != peep->PeepDirection) { - if (direction_reverse(entranceDirection) != peep->direction) + if (direction_reverse(entranceDirection) != peep->PeepDirection) { peep_return_to_centre_of_tile(peep); return; @@ -2494,8 +2494,8 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl } } - peep->destination_x += CoordsDirectionDelta[peep->direction].x; - peep->destination_y += CoordsDirectionDelta[peep->direction].y; + peep->destination_x += CoordsDirectionDelta[peep->PeepDirection].x; + peep->destination_y += CoordsDirectionDelta[peep->PeepDirection].y; peep->destination_tolerance = 9; peep->MoveTo({ x, y, peep->z }); peep->SetState(PEEP_STATE_LEAVING_PARK); @@ -2635,8 +2635,8 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl window_invalidate_by_number(WC_PARK_INFORMATION, 0); peep->var_37 = 1; - peep->destination_x += CoordsDirectionDelta[peep->direction].x; - peep->destination_y += CoordsDirectionDelta[peep->direction].y; + peep->destination_x += CoordsDirectionDelta[peep->PeepDirection].x; + peep->destination_y += CoordsDirectionDelta[peep->PeepDirection].y; peep->destination_tolerance = 7; peep->MoveTo({ x, y, peep->z }); } @@ -2844,7 +2844,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen if ((tile_element->AsPath()->HasQueueBanner()) && (tile_element->AsPath()->GetQueueBannerDirection() - == direction_reverse(peep->direction)) // Ride sign is facing the direction the peep is walking + == direction_reverse(peep->PeepDirection)) // Ride sign is facing the direction the peep is walking ) { /* Peep is approaching the entrance of a ride queue. diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index a4c85bc0c6..199eb2b968 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -670,7 +670,7 @@ struct Peep : SpriteBase union { uint8_t maze_last_edge; - Direction direction; // Direction ? + Direction PeepDirection; // Direction ? }; uint8_t InteractionRideIndex; uint16_t TimeInQueue; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 9f6316229a..3531f91dca 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -658,10 +658,10 @@ bool Staff::DoHandymanPathFinding() } else { - pathDirections &= ~(1 << direction_reverse(direction)); + pathDirections &= ~(1 << direction_reverse(PeepDirection)); if (pathDirections == 0) { - pathDirections |= 1 << direction_reverse(direction); + pathDirections |= 1 << direction_reverse(PeepDirection); } } @@ -687,7 +687,7 @@ bool Staff::DoHandymanPathFinding() chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } - direction = newDirection; + PeepDirection = newDirection; destination_x = chosenTile.x + 16; destination_y = chosenTile.y + 16; destination_tolerance = 3; @@ -781,8 +781,8 @@ static uint8_t staff_mechanic_direction_path_rand(Peep* peep, uint8_t pathDirect { if (scenario_rand() & 1) { - if (pathDirections & (1 << peep->direction)) - return peep->direction; + if (pathDirections & (1 << peep->PeepDirection)) + return peep->PeepDirection; } // Modified from original to spam scenario_rand less @@ -794,7 +794,7 @@ static uint8_t staff_mechanic_direction_path_rand(Peep* peep, uint8_t pathDirect return direction; } // This will never happen as pathDirections always has a bit set. - return peep->direction; + return peep->PeepDirection; } /** @@ -813,10 +813,10 @@ static uint8_t staff_mechanic_direction_path(Peep* peep, uint8_t validDirections } // Check if this is dead end - i.e. only way out is the reverse direction. - pathDirections &= ~(1 << direction_reverse(peep->direction)); + pathDirections &= ~(1 << direction_reverse(peep->PeepDirection)); if (pathDirections == 0) { - pathDirections |= (1 << direction_reverse(peep->direction)); + pathDirections |= (1 << direction_reverse(peep->PeepDirection)); } direction = bitscanforward(pathDirections); @@ -921,7 +921,7 @@ bool Staff::DoMechanicPathFinding() chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } - direction = newDirection; + PeepDirection = newDirection; destination_x = chosenTile.x + 16; destination_y = chosenTile.y + 16; destination_tolerance = (scenario_rand() & 7) + 2; @@ -947,10 +947,10 @@ static uint8_t staff_direction_path(Peep* peep, uint8_t validDirections, PathEle return staff_direction_surface(peep, scenario_rand() & 3); } - pathDirections &= ~(1 << direction_reverse(peep->direction)); + pathDirections &= ~(1 << direction_reverse(peep->PeepDirection)); if (pathDirections == 0) { - pathDirections |= (1 << direction_reverse(peep->direction)); + pathDirections |= (1 << direction_reverse(peep->PeepDirection)); } direction = bitscanforward(pathDirections); @@ -1004,7 +1004,7 @@ bool Staff::DoMiscPathFinding() chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; } - direction = newDirection; + PeepDirection = newDirection; destination_x = chosenTile.x + 16; destination_y = chosenTile.y + 16; destination_tolerance = (scenario_rand() & 7) + 2; @@ -1490,15 +1490,15 @@ void Staff::UpdateHeadingToInspect() } } - direction = rideEntranceExitElement->GetDirection(); + PeepDirection = rideEntranceExitElement->GetDirection(); - int32_t destX = NextLoc.x + 16 + DirectionOffsets[direction].x * 53; - int32_t destY = NextLoc.y + 16 + DirectionOffsets[direction].y * 53; + int32_t destX = NextLoc.x + 16 + DirectionOffsets[PeepDirection].x * 53; + int32_t destY = NextLoc.y + 16 + DirectionOffsets[PeepDirection].y * 53; destination_x = destX; destination_y = destY; destination_tolerance = 2; - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; z = rideEntranceExitElement->base_height * 4; sub_state = 4; @@ -1601,15 +1601,15 @@ void Staff::UpdateAnswering() } } - direction = rideEntranceExitElement->GetDirection(); + PeepDirection = rideEntranceExitElement->GetDirection(); - int32_t destX = NextLoc.x + 16 + DirectionOffsets[direction].x * 53; - int32_t destY = NextLoc.y + 16 + DirectionOffsets[direction].y * 53; + int32_t destX = NextLoc.x + 16 + DirectionOffsets[PeepDirection].x * 53; + int32_t destY = NextLoc.y + 16 + DirectionOffsets[PeepDirection].y * 53; destination_x = destX; destination_y = destY; destination_tolerance = 2; - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; z = rideEntranceExitElement->base_height * 4; sub_state = 4; @@ -2211,7 +2211,7 @@ bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, Ride* ride) vehicle = GET_VEHICLE(vehicle->prev_vehicle_on_ride); } - CoordsXY offset = DirectionOffsets[direction]; + CoordsXY offset = DirectionOffsets[PeepDirection]; destination_x = (offset.x * -12) + vehicle->x; destination_y = (offset.y * -12) + vehicle->y; destination_tolerance = 2; @@ -2239,7 +2239,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, Ride* ride) { if (!firstRun) { - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = (scenario_rand() & 1) ? PEEP_ACTION_STAFF_FIX_2 : PEEP_ACTION_STAFF_FIX; action_sprite_image_offset = 0; @@ -2281,7 +2281,7 @@ bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, Ride* ride) { if (!firstRun) { - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = PEEP_ACTION_STAFF_FIX_3; action_sprite_image_offset = 0; action_frame = 0; @@ -2388,7 +2388,7 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun) { if (!firstRun) { - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = PEEP_ACTION_STAFF_CHECKBOARD; action_frame = 0; action_sprite_image_offset = 0; @@ -2504,7 +2504,7 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, Ride* ride) return true; } - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = PEEP_ACTION_STAFF_FIX; action_frame = 0; @@ -2532,7 +2532,7 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride) { if (!firstRun) { - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = PEEP_ACTION_STAFF_FIX_GROUND; action_frame = 0; @@ -2585,7 +2585,7 @@ bool Staff::UpdateFixingMoveToStationExit(bool firstRun, Ride* ride) stationPosition = stationPosition.ToTileCentre(); - CoordsXY stationPlatformDirection = DirectionOffsets[direction]; + CoordsXY stationPlatformDirection = DirectionOffsets[PeepDirection]; stationPosition.x += stationPlatformDirection.x * 20; stationPosition.y += stationPlatformDirection.y * 20; @@ -2629,7 +2629,7 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r StaffRidesFixed++; window_invalidate_flags |= RIDE_INVALIDATE_RIDE_INCOME | RIDE_INVALIDATE_RIDE_LIST; - sprite_direction = direction << 3; + sprite_direction = PeepDirection << 3; action = PEEP_ACTION_STAFF_ANSWER_CALL_2; action_frame = 0; action_sprite_image_offset = 0; @@ -2672,7 +2672,7 @@ bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, Ride* ride) exitPosition = exitPosition.ToTileCentre(); - CoordsXY ebx_direction = DirectionOffsets[direction]; + CoordsXY ebx_direction = DirectionOffsets[PeepDirection]; exitPosition.x -= ebx_direction.x * 19; exitPosition.y -= ebx_direction.y * 19; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index bfdb58b868..7ddd94a8e4 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1446,7 +1446,7 @@ private: dst->destination_x = src->destination_x; dst->destination_y = src->destination_y; dst->destination_tolerance = src->destination_tolerance; - dst->direction = src->direction; + dst->PeepDirection = src->direction; dst->energy = src->energy; dst->energy_target = src->energy_target; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index ae7314fab5..d30b9909b0 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1184,7 +1184,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; dst->next_in_queue = src->next_in_queue; - dst->direction = src->direction; + dst->direction = src->PeepDirection; dst->interaction_ride_index = src->InteractionRideIndex; dst->time_in_queue = src->TimeInQueue; for (size_t i = 0; i < std::size(src->RidesBeenOn); i++) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 19e16d6ad8..5ae184cc3c 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1449,7 +1449,7 @@ public: dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; dst->next_in_queue = src->next_in_queue; - dst->direction = src->direction; + dst->PeepDirection = src->direction; dst->InteractionRideIndex = src->interaction_ride_index; dst->TimeInQueue = src->time_in_queue; for (size_t i = 0; i < std::size(src->rides_been_on); i++) diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index f451cc4931..f4a038f17c 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -728,7 +728,7 @@ Peep* Park::GenerateGuest() peep->destination_y = (peep->y & 0xFFE0) + 16; peep->destination_tolerance = 5; - peep->direction = direction; + peep->PeepDirection = direction; peep->var_37 = 0; peep->state = PEEP_STATE_ENTERING_PARK; } diff --git a/test/tests/Pathfinding.cpp b/test/tests/Pathfinding.cpp index 48d2658a27..e2a5e3a35b 100644 --- a/test/tests/Pathfinding.cpp +++ b/test/tests/Pathfinding.cpp @@ -94,7 +94,7 @@ protected: // 'destination' which is a close position that they will walk towards in a straight line - in this case, one // tile away. Stepping the peep will move them towards their destination, and once they reach it, a new // destination will be picked, to try and get the peep towards the overall pathfinding goal. - peep->direction = moveDir; + peep->PeepDirection = moveDir; peep->destination_x = peep->x + CoordsDirectionDelta[moveDir].x; peep->destination_y = peep->y + CoordsDirectionDelta[moveDir].y; peep->destination_tolerance = 2; From f1f915b540cadc96790e61d11c87f77ca8124c47 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 11:18:58 -0300 Subject: [PATCH 13/16] Rename Peep::maze_last_edge to MazeLastEdge --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 16 ++++++++-------- src/openrct2/peep/Peep.h | 2 +- test/tests/S6ImportExportTests.cpp | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index e6a20cd5ff..8d62b0fdcd 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -262,7 +262,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, action_frame); COMPARE_FIELD(Peep, step_progress); COMPARE_FIELD(Peep, next_in_queue); - COMPARE_FIELD(Peep, maze_last_edge); + COMPARE_FIELD(Peep, MazeLastEdge); COMPARE_FIELD(Peep, InteractionRideIndex); COMPARE_FIELD(Peep, TimeInQueue); for (int i = 0; i < 32; i++) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index e20d81e47c..506f093f50 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -3537,7 +3537,7 @@ static constexpr const CoordsXY _MazeEntranceStart[] = { static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc) { - peep->maze_last_edge = entrance_loc.direction + 1; + peep->MazeLastEdge = entrance_loc.direction + 1; entrance_loc.x += CoordsDirectionDelta[entrance_loc.direction].x; entrance_loc.y += CoordsDirectionDelta[entrance_loc.direction].y; @@ -3546,13 +3546,13 @@ static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, Coords if (scenario_rand() & 0x40) { direction += 4; - peep->maze_last_edge += 2; + peep->MazeLastEdge += 2; } direction &= 0xF; // Direction is 11, 15, 3, or 7 peep->var_37 = direction; - peep->maze_last_edge &= 3; + peep->MazeLastEdge &= 3; entrance_loc.x += _MazeEntranceStart[direction / 4].x; entrance_loc.y += _MazeEntranceStart[direction / 4].y; @@ -4884,7 +4884,7 @@ void Guest::UpdateRideMazePathfinding() if (openHedges == 0) return; - uint8_t mazeLastEdge = direction_reverse(maze_last_edge); + uint8_t mazeLastEdge = direction_reverse(MazeLastEdge); openHedges &= ~(1 << mazeLastEdge); if (openHedges == 0) openHedges |= (1 << mazeLastEdge); @@ -4934,15 +4934,15 @@ void Guest::UpdateRideMazePathfinding() switch (mazeType) { case maze_type::invalid: - maze_last_edge++; - maze_last_edge &= 3; + MazeLastEdge++; + MazeLastEdge &= 3; return; case maze_type::hedge: destination_x = targetLoc.x; destination_y = targetLoc.y; var_37 = _MazeGetNewDirectionFromEdge[var_37 / 4][chosenEdge]; - maze_last_edge = chosenEdge; + MazeLastEdge = chosenEdge; break; case maze_type::entrance_or_exit: targetLoc.x = destination_x; @@ -4958,7 +4958,7 @@ void Guest::UpdateRideMazePathfinding() destination_x = targetLoc.x; destination_y = targetLoc.y; var_37 = 16; - maze_last_edge = chosenEdge; + MazeLastEdge = chosenEdge; break; } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 199eb2b968..aefecb7d1c 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -669,7 +669,7 @@ struct Peep : SpriteBase }; union { - uint8_t maze_last_edge; + uint8_t MazeLastEdge; Direction PeepDirection; // Direction ? }; uint8_t InteractionRideIndex; diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index c1c1f9eebb..74e9bdf91f 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -206,7 +206,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(action_frame); COMPARE_FIELD(step_progress); COMPARE_FIELD(next_in_queue); - COMPARE_FIELD(maze_last_edge); + COMPARE_FIELD(MazeLastEdge); COMPARE_FIELD(InteractionRideIndex); COMPARE_FIELD(TimeInQueue); for (int i = 0; i < 32; i++) From d195c9fb1de720a9bee94db2ccb739cf267bdb4b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 11:19:42 -0300 Subject: [PATCH 14/16] Rename Peep::next_in_queue to NextInQueue --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 6 +++--- src/openrct2/peep/Peep.cpp | 16 ++++++++-------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 4 ++-- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/Ride.cpp | 8 ++++---- test/tests/S6ImportExportTests.cpp | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 8d62b0fdcd..397427bc9b 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -261,7 +261,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, action); COMPARE_FIELD(Peep, action_frame); COMPARE_FIELD(Peep, step_progress); - COMPARE_FIELD(Peep, next_in_queue); + COMPARE_FIELD(Peep, NextInQueue); COMPARE_FIELD(Peep, MazeLastEdge); COMPARE_FIELD(Peep, InteractionRideIndex); COMPARE_FIELD(Peep, TimeInQueue); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 506f093f50..d07d620948 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -5551,14 +5551,14 @@ void Guest::UpdateQueuing() if (sub_state != 10) { bool is_front = true; - if (next_in_queue != SPRITE_INDEX_NULL) + if (NextInQueue != SPRITE_INDEX_NULL) { - // Fix #4819: Occasionally the peep->next_in_queue is incorrectly set + // Fix #4819: Occasionally the peep->NextInQueue is incorrectly set // to prevent this from causing the peeps to enter a loop // first check if the next in queue is actually nearby // if they are not then it's safe to assume that this is // the front of the queue. - Peep* next_peep = GET_PEEP(next_in_queue); + Peep* next_peep = GET_PEEP(NextInQueue); if (abs(next_peep->x - x) < 32 && abs(next_peep->y - y) < 32) { is_front = false; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index a05f4c0784..ad5c069af2 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2266,10 +2266,10 @@ void Peep::SwitchNextActionSpriteType() static bool peep_update_queue_position(Peep* peep, uint8_t previous_action) { peep->TimeInQueue++; - if (peep->next_in_queue == SPRITE_INDEX_NULL) + if (peep->NextInQueue == SPRITE_INDEX_NULL) return false; - Peep* peep_next = GET_PEEP(peep->next_in_queue); + Peep* peep_next = GET_PEEP(peep->NextInQueue); int16_t x_diff = abs(peep_next->x - peep->x); int16_t y_diff = abs(peep_next->y - peep->y); @@ -2430,7 +2430,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl uint16_t previous_last = ride->stations[stationNum].LastPeepInQueue; ride->stations[stationNum].LastPeepInQueue = peep->sprite_index; - peep->next_in_queue = previous_last; + peep->NextInQueue = previous_last; ride->stations[stationNum].QueueLength++; peep->current_ride = rideIndex; @@ -2858,7 +2858,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen // Add the peep to the ride queue. uint16_t old_last_peep = ride->stations[stationNum].LastPeepInQueue; ride->stations[stationNum].LastPeepInQueue = peep->sprite_index; - peep->next_in_queue = old_last_peep; + peep->NextInQueue = old_last_peep; ride->stations[stationNum].QueueLength++; peep_decrement_num_riders(peep); @@ -3425,7 +3425,7 @@ void Peep::RemoveFromQueue() if (sprite_index == station.LastPeepInQueue) { - station.LastPeepInQueue = next_in_queue; + station.LastPeepInQueue = NextInQueue; return; } @@ -3433,12 +3433,12 @@ void Peep::RemoveFromQueue() while (spriteId != SPRITE_INDEX_NULL) { Peep* other_peep = GET_PEEP(spriteId); - if (sprite_index == other_peep->next_in_queue) + if (sprite_index == other_peep->NextInQueue) { - other_peep->next_in_queue = next_in_queue; + other_peep->NextInQueue = NextInQueue; return; } - spriteId = other_peep->next_in_queue; + spriteId = other_peep->NextInQueue; } } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index aefecb7d1c..38d456fc3d 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -665,7 +665,7 @@ struct Peep : SpriteBase union { uint16_t mechanic_time_since_call; // time getting to ride to fix - uint16_t next_in_queue; + uint16_t NextInQueue; }; union { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 7ddd94a8e4..f50300f40f 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1530,7 +1530,7 @@ private: // Doubles as staff orders dst->GuestIsLostCountdown = src->peep_is_lost_countdown; // The ID is fixed later - dst->next_in_queue = src->next_in_queue; + dst->NextInQueue = src->next_in_queue; dst->PeepFlags = 0; dst->PathfindGoal.x = 0xFF; @@ -1581,7 +1581,7 @@ private: void FixPeepNextInQueue(Peep* peep, const uint16_t* spriteIndexMap) { - peep->next_in_queue = MapSpriteIndex(peep->next_in_queue, spriteIndexMap); + peep->NextInQueue = MapSpriteIndex(peep->NextInQueue, spriteIndexMap); } void ImportStaffPatrolArea(Peep* staffmember) diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index d30b9909b0..5c691c2d40 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1183,7 +1183,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->action = static_cast(src->action); dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; - dst->next_in_queue = src->next_in_queue; + dst->next_in_queue = src->NextInQueue; dst->direction = src->PeepDirection; dst->interaction_ride_index = src->InteractionRideIndex; dst->time_in_queue = src->TimeInQueue; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 5ae184cc3c..76fd427c1e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1448,7 +1448,7 @@ public: dst->action = static_cast(src->action); dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; - dst->next_in_queue = src->next_in_queue; + dst->NextInQueue = src->next_in_queue; dst->PeepDirection = src->direction; dst->InteractionRideIndex = src->interaction_ride_index; dst->TimeInQueue = src->time_in_queue; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 39f9615d81..2fd381ad16 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -309,7 +309,7 @@ Peep* Ride::GetQueueHeadGuest(StationIndex stationIndex) const uint16_t spriteIndex = stations[stationIndex].LastPeepInQueue; while ((peep = try_get_guest(spriteIndex)) != nullptr) { - spriteIndex = peep->next_in_queue; + spriteIndex = peep->NextInQueue; result = peep; } return result; @@ -322,7 +322,7 @@ void Ride::UpdateQueueLength(StationIndex stationIndex) uint16_t spriteIndex = stations[stationIndex].LastPeepInQueue; while ((peep = try_get_guest(spriteIndex)) != nullptr) { - spriteIndex = peep->next_in_queue; + spriteIndex = peep->NextInQueue; count++; } stations[stationIndex].QueueLength = count; @@ -333,7 +333,7 @@ void Ride::QueueInsertGuestAtFront(StationIndex stationIndex, Peep* peep) assert(stationIndex < MAX_STATIONS); assert(peep != nullptr); - peep->next_in_queue = SPRITE_INDEX_NULL; + peep->NextInQueue = SPRITE_INDEX_NULL; Peep* queueHeadGuest = GetQueueHeadGuest(peep->current_ride_station); if (queueHeadGuest == nullptr) { @@ -341,7 +341,7 @@ void Ride::QueueInsertGuestAtFront(StationIndex stationIndex, Peep* peep) } else { - queueHeadGuest->next_in_queue = peep->sprite_index; + queueHeadGuest->NextInQueue = peep->sprite_index; } UpdateQueueLength(peep->current_ride_station); } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 74e9bdf91f..bc1b9204d2 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -205,7 +205,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(action); COMPARE_FIELD(action_frame); COMPARE_FIELD(step_progress); - COMPARE_FIELD(next_in_queue); + COMPARE_FIELD(NextInQueue); COMPARE_FIELD(MazeLastEdge); COMPARE_FIELD(InteractionRideIndex); COMPARE_FIELD(TimeInQueue); From 357db4981927e471108348d07bb66d9915e8a17b Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 11:24:29 -0300 Subject: [PATCH 15/16] Rename Peep::mechanic_time_sine_call to use TitleCase --- src/openrct2/peep/Peep.h | 2 +- src/openrct2/peep/Staff.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 38d456fc3d..b7f2cf6127 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -664,7 +664,7 @@ struct Peep : SpriteBase uint8_t step_progress; union { - uint16_t mechanic_time_since_call; // time getting to ride to fix + uint16_t MechanicTimeSinceCall; // time getting to ride to fix uint16_t NextInQueue; }; union diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 3531f91dca..cc1fde5d97 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1444,15 +1444,15 @@ void Staff::UpdateHeadingToInspect() if (sub_state == 0) { - mechanic_time_since_call = 0; + MechanicTimeSinceCall = 0; peep_reset_pathfind_goal(this); sub_state = 2; } if (sub_state <= 3) { - mechanic_time_since_call++; - if (mechanic_time_since_call > 2500) + MechanicTimeSinceCall++; + if (MechanicTimeSinceCall > 2500) { if (ride->lifecycle_flags & RIDE_LIFECYCLE_DUE_INSPECTION && ride->mechanic_status == RIDE_MECHANIC_STATUS_HEADING) { @@ -1554,7 +1554,7 @@ void Staff::UpdateAnswering() { sub_state = 2; peep_window_state_update(this); - mechanic_time_since_call = 0; + MechanicTimeSinceCall = 0; peep_reset_pathfind_goal(this); return; } @@ -1564,8 +1564,8 @@ void Staff::UpdateAnswering() } else if (sub_state <= 3) { - mechanic_time_since_call++; - if (mechanic_time_since_call > 2500) + MechanicTimeSinceCall++; + if (MechanicTimeSinceCall > 2500) { ride->mechanic_status = RIDE_MECHANIC_STATUS_CALLING; ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE; From 95624c748e92ad0afd186d8ffe1c70cd6bb48c77 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 7 Jun 2020 10:46:18 -0300 Subject: [PATCH 16/16] Prefix Peep::NextInQueue with Guest --- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/peep/Guest.cpp | 6 +++--- src/openrct2/peep/Peep.cpp | 16 ++++++++-------- src/openrct2/peep/Peep.h | 2 +- src/openrct2/rct1/S4Importer.cpp | 4 ++-- src/openrct2/rct2/S6Exporter.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 2 +- src/openrct2/ride/Ride.cpp | 8 ++++---- test/tests/S6ImportExportTests.cpp | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 397427bc9b..a8af3ac086 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -261,7 +261,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, action); COMPARE_FIELD(Peep, action_frame); COMPARE_FIELD(Peep, step_progress); - COMPARE_FIELD(Peep, NextInQueue); + COMPARE_FIELD(Peep, GuestNextInQueue); COMPARE_FIELD(Peep, MazeLastEdge); COMPARE_FIELD(Peep, InteractionRideIndex); COMPARE_FIELD(Peep, TimeInQueue); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index d07d620948..bd1185c3c7 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -5551,14 +5551,14 @@ void Guest::UpdateQueuing() if (sub_state != 10) { bool is_front = true; - if (NextInQueue != SPRITE_INDEX_NULL) + if (GuestNextInQueue != SPRITE_INDEX_NULL) { - // Fix #4819: Occasionally the peep->NextInQueue is incorrectly set + // Fix #4819: Occasionally the peep->GuestNextInQueue is incorrectly set // to prevent this from causing the peeps to enter a loop // first check if the next in queue is actually nearby // if they are not then it's safe to assume that this is // the front of the queue. - Peep* next_peep = GET_PEEP(NextInQueue); + Peep* next_peep = GET_PEEP(GuestNextInQueue); if (abs(next_peep->x - x) < 32 && abs(next_peep->y - y) < 32) { is_front = false; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index ad5c069af2..2c94b50915 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2266,10 +2266,10 @@ void Peep::SwitchNextActionSpriteType() static bool peep_update_queue_position(Peep* peep, uint8_t previous_action) { peep->TimeInQueue++; - if (peep->NextInQueue == SPRITE_INDEX_NULL) + if (peep->GuestNextInQueue == SPRITE_INDEX_NULL) return false; - Peep* peep_next = GET_PEEP(peep->NextInQueue); + Peep* peep_next = GET_PEEP(peep->GuestNextInQueue); int16_t x_diff = abs(peep_next->x - peep->x); int16_t y_diff = abs(peep_next->y - peep->y); @@ -2430,7 +2430,7 @@ static void peep_interact_with_entrance(Peep* peep, int16_t x, int16_t y, TileEl uint16_t previous_last = ride->stations[stationNum].LastPeepInQueue; ride->stations[stationNum].LastPeepInQueue = peep->sprite_index; - peep->NextInQueue = previous_last; + peep->GuestNextInQueue = previous_last; ride->stations[stationNum].QueueLength++; peep->current_ride = rideIndex; @@ -2858,7 +2858,7 @@ static void peep_interact_with_path(Peep* peep, int16_t x, int16_t y, TileElemen // Add the peep to the ride queue. uint16_t old_last_peep = ride->stations[stationNum].LastPeepInQueue; ride->stations[stationNum].LastPeepInQueue = peep->sprite_index; - peep->NextInQueue = old_last_peep; + peep->GuestNextInQueue = old_last_peep; ride->stations[stationNum].QueueLength++; peep_decrement_num_riders(peep); @@ -3425,7 +3425,7 @@ void Peep::RemoveFromQueue() if (sprite_index == station.LastPeepInQueue) { - station.LastPeepInQueue = NextInQueue; + station.LastPeepInQueue = GuestNextInQueue; return; } @@ -3433,12 +3433,12 @@ void Peep::RemoveFromQueue() while (spriteId != SPRITE_INDEX_NULL) { Peep* other_peep = GET_PEEP(spriteId); - if (sprite_index == other_peep->NextInQueue) + if (sprite_index == other_peep->GuestNextInQueue) { - other_peep->NextInQueue = NextInQueue; + other_peep->GuestNextInQueue = GuestNextInQueue; return; } - spriteId = other_peep->NextInQueue; + spriteId = other_peep->GuestNextInQueue; } } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index b7f2cf6127..1410c4c051 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -665,7 +665,7 @@ struct Peep : SpriteBase union { uint16_t MechanicTimeSinceCall; // time getting to ride to fix - uint16_t NextInQueue; + uint16_t GuestNextInQueue; }; union { diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index f50300f40f..30a2bb8538 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1530,7 +1530,7 @@ private: // Doubles as staff orders dst->GuestIsLostCountdown = src->peep_is_lost_countdown; // The ID is fixed later - dst->NextInQueue = src->next_in_queue; + dst->GuestNextInQueue = src->next_in_queue; dst->PeepFlags = 0; dst->PathfindGoal.x = 0xFF; @@ -1581,7 +1581,7 @@ private: void FixPeepNextInQueue(Peep* peep, const uint16_t* spriteIndexMap) { - peep->NextInQueue = MapSpriteIndex(peep->NextInQueue, spriteIndexMap); + peep->GuestNextInQueue = MapSpriteIndex(peep->GuestNextInQueue, spriteIndexMap); } void ImportStaffPatrolArea(Peep* staffmember) diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 5c691c2d40..a7af67c6eb 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1183,7 +1183,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->action = static_cast(src->action); dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; - dst->next_in_queue = src->NextInQueue; + dst->next_in_queue = src->GuestNextInQueue; dst->direction = src->PeepDirection; dst->interaction_ride_index = src->InteractionRideIndex; dst->time_in_queue = src->TimeInQueue; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 76fd427c1e..fc193f0c54 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1448,7 +1448,7 @@ public: dst->action = static_cast(src->action); dst->action_frame = src->action_frame; dst->step_progress = src->step_progress; - dst->NextInQueue = src->next_in_queue; + dst->GuestNextInQueue = src->next_in_queue; dst->PeepDirection = src->direction; dst->InteractionRideIndex = src->interaction_ride_index; dst->TimeInQueue = src->time_in_queue; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 2fd381ad16..29bb9bbee4 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -309,7 +309,7 @@ Peep* Ride::GetQueueHeadGuest(StationIndex stationIndex) const uint16_t spriteIndex = stations[stationIndex].LastPeepInQueue; while ((peep = try_get_guest(spriteIndex)) != nullptr) { - spriteIndex = peep->NextInQueue; + spriteIndex = peep->GuestNextInQueue; result = peep; } return result; @@ -322,7 +322,7 @@ void Ride::UpdateQueueLength(StationIndex stationIndex) uint16_t spriteIndex = stations[stationIndex].LastPeepInQueue; while ((peep = try_get_guest(spriteIndex)) != nullptr) { - spriteIndex = peep->NextInQueue; + spriteIndex = peep->GuestNextInQueue; count++; } stations[stationIndex].QueueLength = count; @@ -333,7 +333,7 @@ void Ride::QueueInsertGuestAtFront(StationIndex stationIndex, Peep* peep) assert(stationIndex < MAX_STATIONS); assert(peep != nullptr); - peep->NextInQueue = SPRITE_INDEX_NULL; + peep->GuestNextInQueue = SPRITE_INDEX_NULL; Peep* queueHeadGuest = GetQueueHeadGuest(peep->current_ride_station); if (queueHeadGuest == nullptr) { @@ -341,7 +341,7 @@ void Ride::QueueInsertGuestAtFront(StationIndex stationIndex, Peep* peep) } else { - queueHeadGuest->NextInQueue = peep->sprite_index; + queueHeadGuest->GuestNextInQueue = peep->sprite_index; } UpdateQueueLength(peep->current_ride_station); } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index bc1b9204d2..a684d2c0c1 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -205,7 +205,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(action); COMPARE_FIELD(action_frame); COMPARE_FIELD(step_progress); - COMPARE_FIELD(NextInQueue); + COMPARE_FIELD(GuestNextInQueue); COMPARE_FIELD(MazeLastEdge); COMPARE_FIELD(InteractionRideIndex); COMPARE_FIELD(TimeInQueue);