From e08c1b44b272e16a72daba50971e5ff64edfa3be Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 6 Jun 2020 10:03:58 -0300 Subject: [PATCH] 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);