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