forked from rosebudai/OpenRCT2-Web
Merge pull request #11909 from Gymnasiast/fix/more-constants
Use more constants/specific types
This commit is contained in:
20 files changed
+58
-42
No files matched your search
+2
-2
@@ -29,8 +29,8 @@ set(TITLE_SEQUENCE_SHA1 "304d13a126c15bf2c86ff13b81a2f2cc1856ac8d")
|
||||
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.15/objects.zip")
|
||||
set(OBJECTS_SHA1 "dfd5864cf7d0449c0fb280c5c6b902a24816df6c")
|
||||
|
||||
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.13/replays.zip")
|
||||
set(REPLAYS_SHA1 "75598ff319fa18da782e38feb69b65d6d69d1458")
|
||||
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.14/replays.zip")
|
||||
set(REPLAYS_SHA1 "5A0198B4337A43199702F5ED6069161C8A735332")
|
||||
|
||||
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
|
||||
option(WITH_TESTS "Build tests")
|
||||
|
||||
+2
-2
@@ -48,8 +48,8 @@
|
||||
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
|
||||
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.0.15/objects.zip</ObjectsUrl>
|
||||
<ObjectsSha1>dfd5864cf7d0449c0fb280c5c6b902a24816df6c</ObjectsSha1>
|
||||
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.13/replays.zip</ReplaysUrl>
|
||||
<ReplaysSha1>75598ff319fa18da782e38feb69b65d6d69d1458</ReplaysSha1>
|
||||
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.14/replays.zip</ReplaysUrl>
|
||||
<ReplaysSha1>5A0198B4337A43199702F5ED6069161C8A735332</ReplaysSha1>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -453,8 +453,8 @@ void game_fix_save_vars()
|
||||
{
|
||||
if (peep->CurrentRideStation >= MAX_STATIONS)
|
||||
{
|
||||
const uint8_t srcStation = peep->CurrentRideStation;
|
||||
const uint8_t rideIdx = peep->CurrentRide;
|
||||
const auto srcStation = peep->CurrentRideStation;
|
||||
const auto rideIdx = peep->CurrentRide;
|
||||
if (rideIdx == RIDE_ID_NULL)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
// This string specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "19"
|
||||
#define NETWORK_STREAM_VERSION "20"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
static Peep* _pickup_peep = nullptr;
|
||||
|
||||
@@ -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;
|
||||
@@ -6925,5 +6925,5 @@ void Guest::UpdateSpriteType()
|
||||
|
||||
bool Guest::HeadingForRideOrParkExit() const
|
||||
{
|
||||
return (PeepFlags & PEEP_FLAGS_LEAVING_PARK) || (GuestHeadingToRideId != 0xFF);
|
||||
return (PeepFlags & PEEP_FLAGS_LEAVING_PARK) || (GuestHeadingToRideId != RIDE_ID_NULL);
|
||||
}
|
||||
@@ -1645,15 +1645,15 @@ static int32_t guest_path_find_leaving_park(Peep* peep, uint8_t edges)
|
||||
static int32_t guest_path_find_park_entrance(Peep* peep, uint8_t edges)
|
||||
{
|
||||
// If entrance no longer exists, choose a new one
|
||||
if ((peep->PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN) && peep->CurrentRide >= gParkEntrances.size())
|
||||
if ((peep->PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN) && peep->ChosenParkEntrance >= gParkEntrances.size())
|
||||
{
|
||||
peep->CurrentRide = RIDE_ID_NULL;
|
||||
peep->ChosenParkEntrance = PARK_ENTRANCE_INDEX_NULL;
|
||||
peep->PeepFlags &= ~(PEEP_FLAGS_PARK_ENTRANCE_CHOSEN);
|
||||
}
|
||||
|
||||
if (!(peep->PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN))
|
||||
{
|
||||
uint8_t chosenEntrance = 0xFF;
|
||||
uint8_t chosenEntrance = PARK_ENTRANCE_INDEX_NULL;
|
||||
uint16_t nearestDist = 0xFFFF;
|
||||
uint8_t entranceNum = 0;
|
||||
for (const auto& entrance : gParkEntrances)
|
||||
@@ -1670,11 +1670,11 @@ static int32_t guest_path_find_park_entrance(Peep* peep, uint8_t edges)
|
||||
if (chosenEntrance == 0xFF)
|
||||
return guest_path_find_aimless(peep, edges);
|
||||
|
||||
peep->CurrentRide = chosenEntrance;
|
||||
peep->ChosenParkEntrance = chosenEntrance;
|
||||
peep->PeepFlags |= PEEP_FLAGS_PARK_ENTRANCE_CHOSEN;
|
||||
}
|
||||
|
||||
const auto& entrance = gParkEntrances[peep->CurrentRide];
|
||||
const auto& entrance = gParkEntrances[peep->ChosenParkEntrance];
|
||||
|
||||
gPeepPathFindGoalPosition = TileCoordsXYZ(entrance);
|
||||
gPeepPathFindIgnoreForeignQueues = true;
|
||||
@@ -2052,7 +2052,7 @@ int32_t guest_path_finding(Guest* peep)
|
||||
return guest_path_find_park_entrance(peep, edges);
|
||||
}
|
||||
|
||||
if (peep->GuestHeadingToRideId == 0xFF)
|
||||
if (peep->GuestHeadingToRideId == RIDE_ID_NULL)
|
||||
{
|
||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
if (gPathFindDebug)
|
||||
|
||||
@@ -1181,7 +1181,7 @@ void peep_problem_warnings_update()
|
||||
break;
|
||||
|
||||
case PEEP_THOUGHT_TYPE_HUNGRY: // 0x14
|
||||
if (peep->GuestHeadingToRideId == 0xFF)
|
||||
if (peep->GuestHeadingToRideId == RIDE_ID_NULL)
|
||||
{
|
||||
hunger_counter++;
|
||||
break;
|
||||
@@ -1192,7 +1192,7 @@ void peep_problem_warnings_update()
|
||||
break;
|
||||
|
||||
case PEEP_THOUGHT_TYPE_THIRSTY:
|
||||
if (peep->GuestHeadingToRideId == 0xFF)
|
||||
if (peep->GuestHeadingToRideId == RIDE_ID_NULL)
|
||||
{
|
||||
thirst_counter++;
|
||||
break;
|
||||
@@ -1203,7 +1203,7 @@ void peep_problem_warnings_update()
|
||||
break;
|
||||
|
||||
case PEEP_THOUGHT_TYPE_TOILET:
|
||||
if (peep->GuestHeadingToRideId == 0xFF)
|
||||
if (peep->GuestHeadingToRideId == RIDE_ID_NULL)
|
||||
{
|
||||
toilet_counter++;
|
||||
break;
|
||||
@@ -2940,7 +2940,7 @@ static bool peep_interact_with_shop(Peep* peep, int16_t x, int16_t y, TileElemen
|
||||
else
|
||||
{
|
||||
if (peep->GuestHeadingToRideId == rideIndex)
|
||||
peep->GuestHeadingToRideId = 0xFF;
|
||||
peep->GuestHeadingToRideId = RIDE_ID_NULL;
|
||||
peep->ActionSpriteImageOffset = _unk_F1AEF0;
|
||||
peep->SetState(PEEP_STATE_BUYING);
|
||||
peep->CurrentRide = rideIndex;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -49,6 +50,7 @@ class Formatter;
|
||||
struct TileElement;
|
||||
struct Ride;
|
||||
class GameActionResult;
|
||||
using ParkEntranceIndex = uint8_t;
|
||||
|
||||
enum PeepType : uint8_t
|
||||
{
|
||||
@@ -633,10 +635,14 @@ struct Peep : SpriteBase
|
||||
money16 PaidOnDrink;
|
||||
uint8_t RideTypesBeenOn[16];
|
||||
uint32_t ItemExtraFlags;
|
||||
uint8_t Photo2RideRef;
|
||||
uint8_t Photo3RideRef;
|
||||
uint8_t Photo4RideRef;
|
||||
uint8_t CurrentRide;
|
||||
ride_id_t Photo2RideRef;
|
||||
ride_id_t Photo3RideRef;
|
||||
ride_id_t Photo4RideRef;
|
||||
union
|
||||
{
|
||||
ride_id_t CurrentRide;
|
||||
ParkEntranceIndex ChosenParkEntrance;
|
||||
};
|
||||
StationIndex CurrentRideStation;
|
||||
uint8_t CurrentTrain;
|
||||
union
|
||||
@@ -690,14 +696,14 @@ struct Peep : SpriteBase
|
||||
union
|
||||
{
|
||||
uint8_t StaffId;
|
||||
uint8_t GuestHeadingToRideId;
|
||||
ride_id_t GuestHeadingToRideId;
|
||||
};
|
||||
union
|
||||
{
|
||||
uint8_t StaffOrders;
|
||||
uint8_t GuestIsLostCountdown;
|
||||
};
|
||||
uint8_t Photo1RideRef;
|
||||
ride_id_t Photo1RideRef;
|
||||
uint32_t PeepFlags;
|
||||
rct12_xyzd8 PathfindGoal;
|
||||
rct12_xyzd8 PathfindHistory[4];
|
||||
@@ -738,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
|
||||
@@ -746,7 +756,7 @@ struct Peep : SpriteBase
|
||||
uint8_t BalloonColour;
|
||||
uint8_t UmbrellaColour;
|
||||
uint8_t HatColour;
|
||||
uint8_t FavouriteRide;
|
||||
ride_id_t FavouriteRide;
|
||||
uint8_t FavouriteRideRating;
|
||||
uint32_t ItemStandardFlags;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
using ShopItemIndex = uint8_t;
|
||||
|
||||
struct Ride;
|
||||
|
||||
enum
|
||||
|
||||
@@ -40,6 +40,9 @@ extern CoordsXYZD gParkEntranceGhostPosition;
|
||||
|
||||
constexpr int32_t MaxRideEntranceOrExitHeight = 244 * COORDS_Z_STEP;
|
||||
|
||||
using ParkEntranceIndex = uint8_t;
|
||||
constexpr const ParkEntranceIndex PARK_ENTRANCE_INDEX_NULL = 255;
|
||||
|
||||
extern std::vector<CoordsXYZD> gParkEntrances;
|
||||
|
||||
extern CoordsXYZD gRideEntranceExitGhostPosition;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user