Clean up voucher arguments

This commit is contained in:
Gymnasiast committed 2020-07-07 21:13:40 +02:00
1 parent db764445ed
commit e8d6383f57
13 files changed
+25 -17

No files matched your search

+2 -2
View File
@@ -1988,7 +1988,7 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item
ft.Add<const char*>(parkName);
break;
case VOUCHER_TYPE_RIDE_FREE:
ride = get_ride(peep->VoucherArguments);
ride = get_ride(peep->VoucherRideId);
if (ride != nullptr)
{
ft.Rewind();
@@ -2008,7 +2008,7 @@ static rct_string_id window_guest_inventory_format_item(Peep* peep, int32_t item
ft.Rewind();
ft.Increment(6);
ft.Add<rct_string_id>(STR_PEEP_INVENTORY_VOUCHER_FOOD_OR_DRINK_FREE);
ft.Add<rct_string_id>(ShopItems[peep->VoucherArguments].Naming.Singular);
ft.Add<rct_string_id>(ShopItems[peep->VoucherShopItem].Naming.Singular);
break;
}
break;
+1 -1
View File
@@ -304,7 +304,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, AmountOfSouvenirs);
COMPARE_FIELD(Peep, VandalismSeen);
COMPARE_FIELD(Peep, VoucherType);
COMPARE_FIELD(Peep, VoucherArguments);
COMPARE_FIELD(Peep, VoucherRideId);
COMPARE_FIELD(Peep, SurroundingsThoughtTimeout);
COMPARE_FIELD(Peep, Angriness);
COMPARE_FIELD(Peep, TimeLost);
+1 -1
View File
@@ -176,7 +176,7 @@ private:
// remove any free voucher for this ride from peep
if (peep->ItemStandardFlags & PEEP_ITEM_VOUCHER)
{
if (peep->VoucherType == VOUCHER_TYPE_RIDE_FREE && peep->VoucherArguments == _rideIndex)
if (peep->VoucherType == VOUCHER_TYPE_RIDE_FREE && peep->VoucherRideId == _rideIndex)
{
peep->ItemStandardFlags &= ~(PEEP_ITEM_VOUCHER);
}
+2 -2
View File
@@ -141,7 +141,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType)
case ADVERTISING_CAMPAIGN_RIDE_FREE:
peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER;
peep->VoucherType = VOUCHER_TYPE_RIDE_FREE;
peep->VoucherArguments = campaign->RideId;
peep->VoucherRideId = campaign->RideId;
peep->GuestHeadingToRideId = campaign->RideId;
peep->GuestIsLostCountdown = 240;
break;
@@ -152,7 +152,7 @@ void marketing_set_guest_campaign(Peep* peep, int32_t campaignType)
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:
peep->ItemStandardFlags |= PEEP_ITEM_VOUCHER;
peep->VoucherType = VOUCHER_TYPE_FOOD_OR_DRINK_FREE;
peep->VoucherArguments = campaign->ShopItemType;
peep->VoucherShopItem = campaign->ShopItemType;
break;
case ADVERTISING_CAMPAIGN_PARK:
break;
+2 -1
View File
@@ -12,6 +12,7 @@
#include "../Cheats.h"
#include "../common.h"
#include "../peep/Peep.h"
#include "../ride/ShopItem.h"
#include <vector>
@@ -48,7 +49,7 @@ struct MarketingCampaign
union
{
ride_id_t RideId{};
uint8_t ShopItemType;
ShopItemIndex ShopItemType;
};
};
+4 -4
View File
@@ -1483,7 +1483,7 @@ bool Guest::DecideAndBuyItem(Ride* ride, int32_t shopItem, money32 price)
bool hasVoucher = false;
if ((ItemStandardFlags & PEEP_ITEM_VOUCHER) && (VoucherType == VOUCHER_TYPE_FOOD_OR_DRINK_FREE)
&& (VoucherArguments == shopItem))
&& (VoucherShopItem == shopItem))
{
hasVoucher = true;
}
@@ -2415,7 +2415,7 @@ void Guest::ReadMap()
static bool peep_has_voucher_for_free_ride(Peep* peep, Ride* ride)
{
return peep->ItemStandardFlags & PEEP_ITEM_VOUCHER && peep->VoucherType == VOUCHER_TYPE_RIDE_FREE
&& peep->VoucherArguments == ride->id;
&& peep->VoucherRideId == ride->id;
}
/**
@@ -2636,7 +2636,7 @@ static void peep_update_ride_at_entrance_try_leave(Guest* peep)
static bool peep_check_ride_price_at_entrance(Guest* peep, Ride* ride, money32 ridePrice)
{
if ((peep->ItemStandardFlags & PEEP_ITEM_VOUCHER) && peep->VoucherType == VOUCHER_TYPE_RIDE_FREE
&& peep->VoucherArguments == peep->CurrentRide)
&& peep->VoucherRideId == peep->CurrentRide)
return true;
if (peep->CashInPocket <= 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
@@ -3856,7 +3856,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride)
if (ridePrice != 0)
{
if ((ItemStandardFlags & PEEP_ITEM_VOUCHER) && (VoucherType == VOUCHER_TYPE_RIDE_FREE)
&& (VoucherArguments == CurrentRide))
&& (VoucherRideId == CurrentRide))
{
ItemStandardFlags &= ~PEEP_ITEM_VOUCHER;
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
+6 -1
View File
@@ -15,6 +15,7 @@
#include "../rct12/RCT12.h"
#include "../ride/Ride.h"
#include "../ride/RideTypes.h"
#include "../ride/ShopItem.h"
#include "../world/Location.hpp"
#include "../world/SpriteBase.h"
@@ -743,7 +744,11 @@ struct Peep : SpriteBase
uint8_t AmountOfSouvenirs;
uint8_t VandalismSeen; // 0xC0 vandalism thought timeout, 0x3F vandalism tiles seen
uint8_t VoucherType;
uint8_t VoucherArguments; // ride_id or string_offset_id
union
{
ride_id_t VoucherRideId;
ShopItemIndex VoucherShopItem;
};
uint8_t SurroundingsThoughtTimeout;
uint8_t Angriness;
uint8_t TimeLost; // the time the peep has been lost when it reaches 254 generates the lost thought
+1 -1
View File
@@ -1493,7 +1493,7 @@ private:
dst->PaidOnFood = src->paid_on_food;
dst->PaidOnSouvenirs = src->paid_on_souvenirs;
dst->VoucherArguments = src->voucher_arguments;
dst->VoucherRideId = src->voucher_arguments;
dst->VoucherType = src->voucher_type;
dst->SurroundingsThoughtTimeout = src->surroundings_thought_timeout;
+1 -1
View File
@@ -1228,7 +1228,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->no_of_souvenirs = src->AmountOfSouvenirs;
dst->vandalism_seen = src->VandalismSeen;
dst->voucher_type = src->VoucherType;
dst->voucher_arguments = src->VoucherArguments;
dst->voucher_arguments = src->VoucherRideId;
dst->surroundings_thought_timeout = src->SurroundingsThoughtTimeout;
dst->angriness = src->Angriness;
dst->time_lost = src->TimeLost;
+1 -1
View File
@@ -1510,7 +1510,7 @@ public:
dst->AmountOfSouvenirs = src->no_of_souvenirs;
dst->VandalismSeen = src->vandalism_seen;
dst->VoucherType = src->voucher_type;
dst->VoucherArguments = src->voucher_arguments;
dst->VoucherRideId = src->voucher_arguments;
dst->SurroundingsThoughtTimeout = src->surroundings_thought_timeout;
dst->Angriness = src->angriness;
dst->TimeLost = src->time_lost;
+1 -1
View File
@@ -165,7 +165,7 @@ struct RideTypeDescriptor
money16 DefaultPrices[NUM_SHOP_ITEMS_PER_RIDE];
uint8_t DefaultMusic;
/** rct2: 0x0097D7CB */
uint8_t PhotoItem;
ShopItemIndex PhotoItem;
/** rct2: 0x0097D21E */
uint8_t BonusValue;
track_colour_preset_list ColourPresets;
+2
View File
@@ -11,6 +11,8 @@
#include "../common.h"
using ShopItemIndex = uint8_t;
struct Ride;
enum
+1 -1
View File
@@ -256,7 +256,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right)
COMPARE_FIELD(AmountOfSouvenirs);
COMPARE_FIELD(VandalismSeen);
COMPARE_FIELD(VoucherType);
COMPARE_FIELD(VoucherArguments);
COMPARE_FIELD(VoucherRideId);
COMPARE_FIELD(SurroundingsThoughtTimeout);
COMPARE_FIELD(Angriness);
COMPARE_FIELD(TimeLost);