From 3dd4adeb81a3dbf3234cb4816ed67486d85e5c66 Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Mon, 8 Jun 2020 23:10:18 -0300 Subject: [PATCH] Rename Peep::toilet to Toilet --- src/openrct2-ui/windows/Guest.cpp | 2 +- src/openrct2/GameStateSnapshots.cpp | 2 +- src/openrct2/actions/SetCheatAction.hpp | 2 +- src/openrct2/peep/Guest.cpp | 30 ++++++++++++------------- 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 +- src/openrct2/scripting/ScEntity.hpp | 4 ++-- test/tests/S6ImportExportTests.cpp | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 779f37b8b6..250be31373 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -1494,7 +1494,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi) y += LIST_ROW_HEIGHT; gfx_draw_string_left(dpi, STR_GUEST_STAT_TOILET_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y); - int32_t toilet = peep->toilet - 32; + int32_t toilet = peep->Toilet - 32; if (toilet > 210) toilet = 210; diff --git a/src/openrct2/GameStateSnapshots.cpp b/src/openrct2/GameStateSnapshots.cpp index 81ecc7ec9c..7e46a72efb 100644 --- a/src/openrct2/GameStateSnapshots.cpp +++ b/src/openrct2/GameStateSnapshots.cpp @@ -235,7 +235,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots COMPARE_FIELD(Peep, nausea_target); COMPARE_FIELD(Peep, hunger); COMPARE_FIELD(Peep, thirst); - COMPARE_FIELD(Peep, toilet); + COMPARE_FIELD(Peep, Toilet); COMPARE_FIELD(Peep, Mass); COMPARE_FIELD(Peep, TimeToConsume); COMPARE_FIELD(Peep, Intensity); diff --git a/src/openrct2/actions/SetCheatAction.hpp b/src/openrct2/actions/SetCheatAction.hpp index e812bbbff4..c26f0e4e8e 100644 --- a/src/openrct2/actions/SetCheatAction.hpp +++ b/src/openrct2/actions/SetCheatAction.hpp @@ -611,7 +611,7 @@ private: peep->NauseaTolerance = value; break; case GUEST_PARAMETER_TOILET: - peep->toilet = value; + peep->Toilet = value; break; case GUEST_PARAMETER_PREFERRED_RIDE_INTENSITY: peep->Intensity = IntensityRange(value, 15); diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 5675107583..8f41cc4d4e 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -734,8 +734,8 @@ void Guest::Tick128UpdateGuest(int32_t index) if (PeepFlags & PEEP_FLAGS_TOILET) { - if (toilet <= 180) - toilet += 50; + if (Toilet <= 180) + Toilet += 50; } if (PeepFlags & PEEP_FLAGS_HAPPINESS) @@ -861,7 +861,7 @@ void Guest::Tick128UpdateGuest(int32_t index) possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_THIRSTY; } - if (toilet >= 160) + if (Toilet >= 160) { possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_TOILET; } @@ -939,7 +939,7 @@ void Guest::Tick128UpdateGuest(int32_t index) if (thirst >= 5) { thirst -= 4; - toilet = std::min(255, toilet + 3); + Toilet = std::min(255, Toilet + 3); } if (nausea_target >= 50) @@ -1036,9 +1036,9 @@ void Guest::Tick128UpdateGuest(int32_t index) thirst = std::max(thirst - 1, 0); } - if (toilet >= 195) + if (Toilet >= 195) { - toilet--; + Toilet--; } if (state == PEEP_STATE_WALKING && nausea_target >= 128) @@ -1076,7 +1076,7 @@ void Guest::Tick128UpdateGuest(int32_t index) { hunger = std::min(hunger + 7, 255); thirst = std::max(thirst - 3, 0); - toilet = std::min(toilet + 2, 255); + Toilet = std::min(Toilet + 2, 255); } if (TimeToConsume == 0) @@ -2263,7 +2263,7 @@ bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop) if (ride->type == RIDE_TYPE_TOILETS) { - if (toilet < 70) + if (Toilet < 70) { ChoseNotToGoOnRide(ride, peepAtShop, true); return false; @@ -2271,7 +2271,7 @@ bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop) // The amount that peeps are willing to pay to use the Toilets scales with their toilet stat. // It effectively has a minimum of $0.10 (due to the check above) and a maximum of $0.60. - if (ride_get_price(ride) * 40 > toilet) + if (ride_get_price(ride) * 40 > Toilet) { if (peepAtShop) { @@ -2882,7 +2882,7 @@ static bool peep_should_go_on_ride_again(Peep* peep, Ride* ride) return false; if (peep->thirst < 20) return false; - if (peep->toilet > 170) + if (peep->Toilet > 170) return false; uint8_t r = (scenario_rand() & 0xFF); @@ -3052,7 +3052,7 @@ static void peep_update_hunger(Peep* peep) peep->hunger -= 2; peep->energy_target = std::min(peep->energy_target + 2, PEEP_MAX_ENERGY_TARGET); - peep->toilet = std::min(peep->toilet + 1, 255); + peep->Toilet = std::min(peep->Toilet + 1, 255); } } @@ -5073,9 +5073,9 @@ void Guest::UpdateRideShopInteract() return; } - if (toilet != 0) + if (Toilet != 0) { - toilet--; + Toilet--; return; } @@ -5418,7 +5418,7 @@ void Guest::UpdateWalking() if (happiness < 120) return; - if (toilet > 140) + if (Toilet > 140) return; uint16_t chance = HasFood() ? 13107 : 2849; @@ -6932,7 +6932,7 @@ void Guest::UpdateSpriteType() return; } - if (toilet > 220) + if (Toilet > 220) { SetSpriteType(PEEP_SPRITE_TYPE_REQUIRE_TOILET); return; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index b10f7c11ba..f165a175d0 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -1713,7 +1713,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords) /* Adjust by the delta, clamping at min=0 and max=255. */ peep->thirst = std::clamp(peep->thirst + thirstDelta, 0, PEEP_MAX_THIRST); - peep->toilet = 0; + peep->Toilet = 0; peep->TimeToConsume = 0; std::fill_n(peep->RidesBeenOn, 32, 0x00); diff --git a/src/openrct2/peep/Peep.h b/src/openrct2/peep/Peep.h index 62a4cff45e..189035a1c6 100644 --- a/src/openrct2/peep/Peep.h +++ b/src/openrct2/peep/Peep.h @@ -623,7 +623,7 @@ struct Peep : SpriteBase uint8_t nausea_target; uint8_t hunger; uint8_t thirst; - uint8_t toilet; + uint8_t Toilet; uint8_t Mass; uint8_t TimeToConsume; IntensityRange Intensity; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 7093225342..790f0e617e 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -1456,7 +1456,7 @@ private: dst->nausea_target = src->nausea_target; dst->hunger = src->hunger; dst->thirst = src->thirst; - dst->toilet = src->toilet; + dst->Toilet = src->toilet; dst->Mass = src->mass; dst->LitterCount = src->litter_count; diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index ed1619d111..bb509c8541 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -1157,7 +1157,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src) dst->nausea_target = src->nausea_target; dst->hunger = src->hunger; dst->thirst = src->thirst; - dst->toilet = src->toilet; + dst->toilet = src->Toilet; dst->mass = src->Mass; dst->time_to_consume = src->TimeToConsume; dst->intensity = static_cast(src->Intensity); diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index e5a4bf24e5..c0c88ac3cf 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -1422,7 +1422,7 @@ public: dst->nausea_target = src->nausea_target; dst->hunger = src->hunger; dst->thirst = src->thirst; - dst->toilet = src->toilet; + dst->Toilet = src->toilet; dst->Mass = src->mass; dst->TimeToConsume = src->time_to_consume; dst->Intensity = static_cast(src->intensity); diff --git a/src/openrct2/scripting/ScEntity.hpp b/src/openrct2/scripting/ScEntity.hpp index 829f7de549..d4210bae65 100644 --- a/src/openrct2/scripting/ScEntity.hpp +++ b/src/openrct2/scripting/ScEntity.hpp @@ -551,7 +551,7 @@ namespace OpenRCT2::Scripting uint8_t toilet_get() const { auto peep = GetPeep(); - return peep != nullptr ? peep->toilet : 0; + return peep != nullptr ? peep->Toilet : 0; } void toilet_set(uint8_t value) { @@ -559,7 +559,7 @@ namespace OpenRCT2::Scripting auto peep = GetPeep(); if (peep != nullptr) { - peep->toilet = value; + peep->Toilet = value; } } diff --git a/test/tests/S6ImportExportTests.cpp b/test/tests/S6ImportExportTests.cpp index 4899dcd137..8a11287119 100644 --- a/test/tests/S6ImportExportTests.cpp +++ b/test/tests/S6ImportExportTests.cpp @@ -179,7 +179,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right) COMPARE_FIELD(nausea_target); COMPARE_FIELD(hunger); COMPARE_FIELD(thirst); - COMPARE_FIELD(toilet); + COMPARE_FIELD(Toilet); COMPARE_FIELD(Mass); COMPARE_FIELD(TimeToConsume); COMPARE_FIELD(Intensity);