From b97ebc745f929688ab0e3c900871584d2659aa1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Fri, 27 Aug 2021 23:17:47 +0300 Subject: [PATCH] Rename rct_peep_thought to PeepThought --- src/openrct2/core/DataSerialiserTraits.h | 10 +++++----- src/openrct2/peep/Guest.cpp | 12 ++++++------ src/openrct2/peep/Peep.cpp | 3 +-- src/openrct2/peep/Peep.h | 6 +++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/openrct2/core/DataSerialiserTraits.h b/src/openrct2/core/DataSerialiserTraits.h index 3953709582..bb4b638724 100644 --- a/src/openrct2/core/DataSerialiserTraits.h +++ b/src/openrct2/core/DataSerialiserTraits.h @@ -814,27 +814,27 @@ template<> struct DataSerializerTraits_t } }; -template<> struct DataSerializerTraits_t +template<> struct DataSerializerTraits_t { - static void encode(OpenRCT2::IStream* stream, const rct_peep_thought& val) + static void encode(OpenRCT2::IStream* stream, const PeepThought& val) { stream->Write(&val.type); stream->Write(&val.item); stream->Write(&val.freshness); stream->Write(&val.fresh_timeout); } - static void decode(OpenRCT2::IStream* stream, rct_peep_thought& val) + static void decode(OpenRCT2::IStream* stream, PeepThought& val) { stream->Read(&val.type); stream->Read(&val.item); stream->Read(&val.freshness); stream->Read(&val.fresh_timeout); } - static void log(OpenRCT2::IStream* stream, const rct_peep_thought& val) + static void log(OpenRCT2::IStream* stream, const PeepThought& val) { char msg[128] = {}; snprintf( - msg, sizeof(msg), "rct_peep_thought(type = %d, item = %d, freshness = %d, freshtimeout = %d)", + msg, sizeof(msg), "PeepThought(type = %d, item = %d, freshness = %d, freshtimeout = %d)", static_cast(val.type), val.item, val.freshness, val.fresh_timeout); stream->Write(msg, strlen(msg)); } diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index f85ef7f0b1..53e4792b08 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -3232,7 +3232,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]; + PeepThought* thought = &Thoughts[i]; if (thought->type == PeepThoughtType::None) break; @@ -3242,7 +3242,7 @@ void Guest::StopPurchaseThought(uint8_t ride_type) if (i < PEEP_MAX_THOUGHTS - 1) { - memmove(thought, thought + 1, sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); + memmove(thought, thought + 1, sizeof(PeepThought) * (PEEP_MAX_THOUGHTS - i - 1)); } Thoughts[PEEP_MAX_THOUGHTS - 1].type = PeepThoughtType::None; @@ -6774,7 +6774,7 @@ bool Guest::HeadingForRideOrParkExit() const * argument_1 (esi & ebx) * argument_2 (esi+2) */ -void peep_thought_set_format_args(const rct_peep_thought* thought, Formatter& ft) +void peep_thought_set_format_args(const PeepThought* thought, Formatter& ft) { ft.Add(PeepThoughts[EnumValue(thought->type)]); @@ -6821,7 +6821,7 @@ void Guest::InsertNewThought(PeepThoughtType thoughtType, uint8_t thoughtArgumen for (int32_t i = 0; i < PEEP_MAX_THOUGHTS; ++i) { - rct_peep_thought* thought = &Thoughts[i]; + PeepThought* thought = &Thoughts[i]; // Remove the oldest thought by setting it to NONE. if (thought->type == PeepThoughtType::None) break; @@ -6833,13 +6833,13 @@ void Guest::InsertNewThought(PeepThoughtType thoughtType, uint8_t thoughtArgumen // existing thought and placing it at the top. if (i < PEEP_MAX_THOUGHTS - 2) { - memmove(thought, thought + 1, sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); + memmove(thought, thought + 1, sizeof(PeepThought) * (PEEP_MAX_THOUGHTS - i - 1)); } break; } } - memmove(&Thoughts[1], &Thoughts[0], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - 1)); + memmove(&Thoughts[1], &Thoughts[0], sizeof(PeepThought) * (PEEP_MAX_THOUGHTS - 1)); Thoughts[0].type = thoughtType; Thoughts[0].item = thoughtArguments; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 48d9e7e7e8..5b1ff8ff82 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -887,8 +887,7 @@ static void peep_update_thoughts(Guest* peep) // Clear top thought, push others up if (i < PEEP_MAX_THOUGHTS - 2) { - memmove( - &peep->Thoughts[i], &peep->Thoughts[i + 1], sizeof(rct_peep_thought) * (PEEP_MAX_THOUGHTS - i - 1)); + memmove(&peep->Thoughts[i], &peep->Thoughts[i + 1], sizeof(PeepThought) * (PEEP_MAX_THOUGHTS - i - 1)); } peep->Thoughts[PEEP_MAX_THOUGHTS - 1].type = PeepThoughtType::None; } diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index ceab4cbde7..3a4a446898 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -485,7 +485,7 @@ enum PeepRideDecision PEEP_RIDE_DECISION_THINKING = 1 << 2, }; -struct rct_peep_thought +struct PeepThought { PeepThoughtType type; // 0 uint8_t item; // 1 @@ -703,7 +703,7 @@ public: int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance ride_id_t PreviousRide; uint16_t PreviousRideTimeOut; - std::array Thoughts; + std::array Thoughts; // 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc uint8_t LitterCount; // 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc @@ -1002,7 +1002,7 @@ void peep_stop_crowd_noise(); void peep_update_crowd_noise(); void peep_update_days_in_queue(); void peep_applause(); -void peep_thought_set_format_args(const rct_peep_thought* thought, Formatter& ft); +void peep_thought_set_format_args(const PeepThought* thought, Formatter& ft); int32_t get_peep_face_sprite_small(Guest* peep); int32_t get_peep_face_sprite_large(Guest* peep); void peep_sprite_remove(Peep* peep);