Rename Peep::cash_in_pocket to CashInPocket

This commit is contained in:
Tulio Leao 2020-06-06 10:19:37 -03:00
parent 0fc7bd1afd
commit 77af2326ff
12 changed files with 27 additions and 28 deletions

View File

@ -1786,7 +1786,7 @@ void window_guest_finance_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Cash in pocket
auto ft = Formatter::Common();
ft.Add<money32>(peep->cash_in_pocket);
ft.Add<money32>(peep->CashInPocket);
gfx_draw_string_left(dpi, STR_GUEST_STAT_CASH_IN_POCKET, gCommonFormatArgs, COLOUR_BLACK, x, y);
// Cash spent

View File

@ -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);

View File

@ -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;

View File

@ -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<money16>(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);
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}
};

View File

@ -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; });

View File

@ -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);