Merge pull request #13312 from Gymnasiast/refactor/ride-id-it

Use ride_id_t in more places
This commit is contained in:
Tulio Leao 2020-11-07 13:03:29 -03:00 committed by GitHub
commit b8f56fd980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 102 additions and 82 deletions

View file

@ -44,8 +44,8 @@ set(TITLE_SEQUENCE_SHA1 "304d13a126c15bf2c86ff13b81a2f2cc1856ac8d")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.18/objects.zip")
set(OBJECTS_SHA1 "4a3c32a0251c3babe014844f2c683fc32138b3f2")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.20/replays.zip")
set(REPLAYS_SHA1 "65532bcb21c39236cfc1b7301d30297506383b65")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.21/replays.zip")
set(REPLAYS_SHA1 "23BF9B52D2D0BDBAF7E2DE4F35ED53F6A416539D")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")

View file

@ -48,8 +48,8 @@
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.0.18/objects.zip</ObjectsUrl>
<ObjectsSha1>4a3c32a0251c3babe014844f2c683fc32138b3f2</ObjectsSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.20/replays.zip</ReplaysUrl>
<ReplaysSha1>65532bcb21c39236cfc1b7301d30297506383b65</ReplaysSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.21/replays.zip</ReplaysUrl>
<ReplaysSha1>23BF9B52D2D0BDBAF7E2DE4F35ED53F6A416539D</ReplaysSha1>
</PropertyGroup>
<ItemGroup>

View file

@ -296,7 +296,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor
return info;
}
ride = get_ride(tile_element_get_ride_index(tileElement));
ride = get_ride(tileElement->GetRideIndex());
if (ride == nullptr)
{
info.SpriteType = VIEWPORT_INTERACTION_ITEM_NONE;

View file

@ -273,7 +273,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
{
case GuestListFilterType::GuestsOnRide:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE);
@ -288,7 +288,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
}
case GuestListFilterType::GuestsInQueue:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(STR_QUEUING_FOR);
@ -303,7 +303,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
}
case GuestListFilterType::GuestsThinkingAboutRide:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(STR_NONE);

View file

@ -1133,7 +1133,7 @@ static void window_ride_draw_tab_images(rct_drawpixelinfo* dpi, rct_window* w)
static void window_ride_disable_tabs(rct_window* w)
{
uint32_t disabled_tabs = 0;
auto ride = get_ride(w->number & 0xFF);
auto ride = get_ride(w->number);
if (ride == nullptr)
return;
@ -1376,7 +1376,7 @@ static rct_window* window_ride_open_station(Ride* ride, StationIndex stationInde
rct_window* window_ride_open_track(TileElement* tileElement)
{
assert(tileElement != nullptr);
auto rideIndex = tile_element_get_ride_index(tileElement);
auto rideIndex = tileElement->GetRideIndex();
if (rideIndex != RIDE_ID_NULL)
{
auto ride = get_ride(rideIndex);
@ -3816,7 +3816,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
num_items = 1;
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
{
if (rideEntry->ride_type[j] != 0xFF)
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
break;
}
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;
@ -5175,7 +5175,7 @@ static void setup_scenery_selection(rct_window* w)
while (tool_set(w, WIDX_BACKGROUND, TOOL_CROSSHAIR))
;
gTrackDesignSaveRideIndex = static_cast<uint8_t>(w->number);
gTrackDesignSaveRideIndex = w->number;
track_design_save_init();
gGamePaused |= GAME_PAUSED_SAVING_TRACK;

View file

@ -186,12 +186,12 @@ void setup_in_use_selection_flags()
}
} while (tile_element_iterator_next(&iter));
for (uint8_t ride_index = 0; ride_index < 0xFF; ride_index++)
for (ride_id_t ride_index = 0; ride_index < MAX_RIDES; ride_index++)
{
auto ride = get_ride(ride_index);
if (ride != nullptr)
{
uint8_t type = ride->subtype;
ObjectEntryIndex type = ride->subtype;
Editor::SetSelectedObject(OBJECT_TYPE_RIDE, type, OBJECT_SELECTION_FLAG_SELECTED);
}
}

View file

@ -88,7 +88,7 @@ public:
if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
continue;
if (tile_element_get_ride_index(tileElement) != _rideIndex)
if (tileElement->GetRideIndex() != _rideIndex)
continue;
if (tileElement->AsEntrance()->GetStationIndex() != _stationNum)
@ -148,7 +148,7 @@ public:
if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
continue;
if (tile_element_get_ride_index(tileElement) != _rideIndex)
if (tileElement->GetRideIndex() != _rideIndex)
continue;
if (tileElement->AsEntrance()->GetStationIndex() != _stationNum)

View file

@ -174,7 +174,7 @@ GameActions::Result::Ptr TrackDesignAction::Execute() const
return MakeResult(GameActions::Status::Disallowed, error_reason);
}
if (entryIndex != 0xFF)
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
auto colour = ride_get_unused_preset_vehicle_colour(entryIndex);
auto rideSetVehicleAction = RideSetVehicleAction(ride->id, RideSetVehicleType::RideEntry, entryIndex, colour);

View file

@ -34,7 +34,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 "1"
#define NETWORK_STREAM_VERSION "2"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View file

@ -284,7 +284,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, PathElement
if (nextTileElement->AsPath()->IsWide())
return PATH_SEARCH_WIDE;
// Only queue tiles that are connected to a ride are returned as ride queues.
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->AsPath()->GetRideIndex() != 0xFF)
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->AsPath()->GetRideIndex() != RIDE_ID_NULL)
return PATH_SEARCH_RIDE_QUEUE;
return PATH_SEARCH_OTHER;

View file

@ -2316,7 +2316,7 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
{
// Default guest/staff behaviour attempting to enter a
// ride exit is to turn around.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
peep_return_to_centre_of_tile(peep);
return;
}
@ -2333,7 +2333,7 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
{
// Default staff behaviour attempting to enter a
// ride entrance is to turn around.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
peep_return_to_centre_of_tile(peep);
return;
}
@ -2774,7 +2774,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
else
{
// Queue got disconnected from the original ride.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
guest->RemoveFromQueue();
peep->SetState(PeepState::One);
peep_footpath_move_forward(peep, { coords, tile_element }, vandalism_present);
@ -2845,7 +2845,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
}
else
{
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
if (peep->State == PeepState::Queuing)
{
peep->RemoveFromQueue();
@ -3059,7 +3059,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
int16_t height = abs(tile_element_height(newLoc) - z);
if (height <= 3 || (AssignedPeepType == PeepType::Staff && height <= 32))
{
InteractionRideIndex = 0xFF;
InteractionRideIndex = RIDE_ID_NULL;
if (State == PeepState::Queuing)
{
RemoveFromQueue();

View file

@ -699,7 +699,7 @@ struct Peep : SpriteBase
uint8_t MazeLastEdge;
Direction PeepDirection; // Direction ?
};
uint8_t InteractionRideIndex;
ride_id_t InteractionRideIndex;
uint16_t TimeInQueue;
uint8_t RidesBeenOn[32];
// 255 bit bitmap of every ride the peep has been on see
@ -713,7 +713,7 @@ struct Peep : SpriteBase
int32_t HireDate;
};
int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance
uint8_t PreviousRide;
ride_id_t PreviousRide;
uint16_t PreviousRideTimeOut;
rct_peep_thought Thoughts[PEEP_MAX_THOUGHTS];
uint8_t PathCheckOptimisation; // see peep.checkForPath

View file

@ -367,7 +367,7 @@ struct rct1_peep : RCT12SpriteBase
uint8_t photo3_ride_ref; // 0x5D
uint8_t photo4_ride_ref; // 0x5E
uint8_t pad_5F[0x09]; // 0x5F
uint8_t current_ride; // 0x68
RCT12RideId current_ride; // 0x68
uint8_t current_ride_station; // 0x69
uint8_t current_train; // 0x6A
union
@ -406,7 +406,7 @@ struct rct1_peep : RCT12SpriteBase
uint8_t maze_last_edge; // 0x78
uint8_t direction; // Direction ?
};
uint8_t interaction_ride_index;
RCT12RideId interaction_ride_index;
uint16_t time_in_queue; // 0x7A
uint8_t rides_been_on[32]; // 0x7C
// 255 bit bitmap of every ride the peep has been on see
@ -416,21 +416,21 @@ struct rct1_peep : RCT12SpriteBase
money32 cash_spent; // 0xA4
int32_t park_entry_time; // 0xA8
int8_t rejoin_queue_timeout; // 0xAC
uint8_t previous_ride; // 0xAD
RCT12RideId previous_ride; // 0xAD
uint16_t previous_ride_time_out; // 0xAE
RCT12PeepThought thoughts[RCT12_PEEP_MAX_THOUGHTS]; // 0xB0
uint8_t pad_C4;
union
{
uint8_t staff_id; // 0xC5
uint8_t guest_heading_to_ride_id; // 0xC5
uint8_t staff_id; // 0xC5
RCT12RideId guest_heading_to_ride_id; // 0xC5
};
union
{
uint8_t staff_orders; // 0xC6
uint8_t peep_is_lost_countdown; // 0xC6
};
uint8_t photo1_ride_ref; // 0xC7
RCT12RideId photo1_ride_ref; // 0xC7
uint32_t peep_flags; // 0xC8
rct12_xyzd8 pathfind_goal; // 0xCC
rct12_xyzd8 pathfind_history[4]; // 0xD0
@ -453,7 +453,7 @@ struct rct1_peep : RCT12SpriteBase
uint8_t no_of_souvenirs; // 0xEE
uint8_t vandalism_seen; // 0xEF
uint8_t voucher_type; // 0xF0
uint8_t voucher_arguments; // 0xF1 ride_id or string_offset_id
RCT12RideId voucher_arguments; // 0xF1 ride_id or string_offset_id
uint8_t surroundings_thought_timeout; // 0xF2
uint8_t angriness; // 0xF3
uint8_t time_lost;
@ -461,7 +461,7 @@ struct rct1_peep : RCT12SpriteBase
uint8_t balloon_colour; // 0xF6
uint8_t umbrella_colour; // 0xF7
uint8_t hat_colour; // 0xF8
uint8_t favourite_ride; // 0xF9
RCT12RideId favourite_ride; // 0xF9
uint8_t favourite_ride_rating; // 0xFA
uint8_t pad_FB;
uint32_t item_standard_flags; // 0xFC

View file

@ -1477,7 +1477,7 @@ private:
dst->NauseaTolerance = static_cast<PeepNauseaTolerance>(src->nausea_tolerance);
dst->WindowInvalidateFlags = 0;
dst->CurrentRide = src->current_ride;
dst->CurrentRide = RCT12RideIdToOpenRCT2RideId(src->current_ride);
dst->CurrentRideStation = src->current_ride_station;
dst->CurrentTrain = src->current_train;
dst->CurrentCar = src->current_car;
@ -1485,7 +1485,7 @@ private:
dst->GuestTimeOnRide = src->time_on_ride;
dst->DaysInQueue = src->days_in_queue;
dst->InteractionRideIndex = src->interaction_ride_index;
dst->InteractionRideIndex = RCT12RideIdToOpenRCT2RideId(src->interaction_ride_index);
dst->Id = src->id;
dst->CashInPocket = src->cash_in_pocket;
@ -1506,7 +1506,7 @@ private:
dst->PaidOnFood = src->paid_on_food;
dst->PaidOnSouvenirs = src->paid_on_souvenirs;
dst->VoucherRideId = src->voucher_arguments;
dst->VoucherRideId = RCT12RideIdToOpenRCT2RideId(src->voucher_arguments);
dst->VoucherType = src->voucher_type;
dst->SurroundingsThoughtTimeout = src->surroundings_thought_timeout;
@ -1522,7 +1522,7 @@ private:
dst->RideTypesBeenOn[i] = src->ride_types_been_on[i];
}
dst->Photo1RideRef = src->photo1_ride_ref;
dst->Photo1RideRef = RCT12RideIdToOpenRCT2RideId(src->photo1_ride_ref);
for (size_t i = 0; i < std::size(src->thoughts); i++)
{
@ -1534,11 +1534,11 @@ private:
dstThought->fresh_timeout = srcThought->fresh_timeout;
}
dst->PreviousRide = src->previous_ride;
dst->PreviousRide = RCT12RideIdToOpenRCT2RideId(src->previous_ride);
dst->PreviousRideTimeOut = src->previous_ride_time_out;
dst->PathCheckOptimisation = 0;
dst->GuestHeadingToRideId = src->guest_heading_to_ride_id;
dst->GuestHeadingToRideId = RCT12RideIdToOpenRCT2RideId(src->guest_heading_to_ride_id);
// Doubles as staff orders
dst->GuestIsLostCountdown = src->peep_is_lost_countdown;
// The ID is fixed later
@ -1554,7 +1554,7 @@ private:
// Set it to N/A if the save comes from the original or AA.
if (_gameVersion == FILE_VERSION_RCT1_LL)
{
dst->FavouriteRide = src->favourite_ride;
dst->FavouriteRide = RCT12RideIdToOpenRCT2RideId(src->favourite_ride);
dst->FavouriteRideRating = src->favourite_ride_rating;
}
else

View file

@ -1024,3 +1024,19 @@ RCT12ObjectEntryIndex OpenRCT2EntryIndexToRCTEntryIndex(const ObjectEntryIndex i
return index;
}
ride_id_t RCT12RideIdToOpenRCT2RideId(const RCT12RideId rideId)
{
if (rideId == RCT12_RIDE_ID_NULL)
return RIDE_ID_NULL;
return rideId;
}
RCT12RideId OpenRCT2RideIdToRCT12RideId(const ride_id_t rideId)
{
if (rideId == RIDE_ID_NULL)
return RCT12_RIDE_ID_NULL;
return rideId;
}

View file

@ -13,6 +13,7 @@
#include "../common.h"
#include "../object/Object.h"
#include "../ride/RideTypes.h"
#include <string>
#include <string_view>
@ -41,7 +42,8 @@ constexpr const uint8_t RCT12_USER_STRING_MAX_LENGTH = 32;
constexpr const uint8_t RCT12_PEEP_MAX_THOUGHTS = 5;
constexpr const uint8_t RCT12_RIDE_ID_NULL = 255;
using RCT12RideId = uint8_t;
constexpr const RCT12RideId RCT12_RIDE_ID_NULL = 255;
constexpr const uint16_t RCT12_RIDE_MEASUREMENT_MAX_ITEMS = 4800;
constexpr uint16_t const RCT12_MAX_INVERSIONS = 31;
@ -858,3 +860,5 @@ assert_struct_size(RCT12ResearchItem, 5);
ObjectEntryIndex RCTEntryIndexToOpenRCT2EntryIndex(const RCT12ObjectEntryIndex index);
RCT12ObjectEntryIndex OpenRCT2EntryIndexToRCTEntryIndex(const ObjectEntryIndex index);
ride_id_t RCT12RideIdToOpenRCT2RideId(const RCT12RideId rideId);
RCT12RideId OpenRCT2RideIdToRCT12RideId(const ride_id_t rideId);

View file

@ -613,11 +613,11 @@ struct RCT2SpritePeep : RCT12SpriteBase
money16 paid_on_drink; // 0x46
uint8_t ride_types_been_on[16]; // 0x48
uint32_t item_extra_flags; // 0x58
uint8_t photo2_ride_ref; // 0x5C
uint8_t photo3_ride_ref; // 0x5D
uint8_t photo4_ride_ref; // 0x5E
RCT12RideId photo2_ride_ref; // 0x5C
RCT12RideId photo3_ride_ref; // 0x5D
RCT12RideId photo4_ride_ref; // 0x5E
uint8_t pad_5F[0x09]; // 0x5F
uint8_t current_ride; // 0x68
RCT12RideId current_ride; // 0x68
uint8_t current_ride_station; // 0x69
uint8_t current_train; // 0x6A
union
@ -653,7 +653,7 @@ struct RCT2SpritePeep : RCT12SpriteBase
uint8_t maze_last_edge; // 0x78
uint8_t direction;
};
uint8_t interaction_ride_index;
RCT12RideId interaction_ride_index;
uint16_t time_in_queue; // 0x7A
uint8_t rides_been_on[32]; // 0x7C
uint32_t id; // 0x9C
@ -661,21 +661,21 @@ struct RCT2SpritePeep : RCT12SpriteBase
money32 cash_spent; // 0xA4
int32_t park_entry_time; // 0xA8
int8_t rejoin_queue_timeout; // 0xAC
uint8_t previous_ride; // 0xAD
RCT12RideId previous_ride; // 0xAD
uint16_t previous_ride_time_out; // 0xAE
RCT12PeepThought thoughts[RCT12_PEEP_MAX_THOUGHTS]; // 0xB0
uint8_t path_check_optimisation; // 0xC4
union
{
uint8_t staff_id; // 0xC5
uint8_t guest_heading_to_ride_id; // 0xC5
uint8_t staff_id; // 0xC5
RCT12RideId guest_heading_to_ride_id; // 0xC5
};
union
{
uint8_t staff_orders; // 0xC6
uint8_t peep_is_lost_countdown; // 0xC6
};
uint8_t photo1_ride_ref; // 0xC7
RCT12RideId photo1_ride_ref; // 0xC7
uint32_t peep_flags; // 0xC8
rct12_xyzd8 pathfind_goal; // 0xCC
rct12_xyzd8 pathfind_history[4]; // 0xD0
@ -714,7 +714,7 @@ struct RCT2SpritePeep : RCT12SpriteBase
uint8_t no_of_souvenirs; // 0xEE
uint8_t vandalism_seen; // 0xEF 0xC0 vandalism thought timeout, 0x3F vandalism tiles seen
uint8_t voucher_type; // 0xF0
uint8_t voucher_arguments; // 0xF1 ride_id or string_offset_id
RCT12RideId voucher_arguments; // 0xF1 ride_id or string_offset_id
uint8_t surroundings_thought_timeout; // 0xF2
uint8_t angriness; // 0xF3
uint8_t time_lost; // 0xF4 the time the peep has been lost when it reaches 254 generates the lost thought
@ -722,7 +722,7 @@ struct RCT2SpritePeep : RCT12SpriteBase
uint8_t balloon_colour; // 0xF6
uint8_t umbrella_colour; // 0xF7
uint8_t hat_colour; // 0xF8
uint8_t favourite_ride; // 0xF9
RCT12RideId favourite_ride; // 0xF9
uint8_t favourite_ride_rating; // 0xFA
uint8_t pad_FB;
uint32_t item_standard_flags; // 0xFC

View file

@ -1174,10 +1174,10 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->ride_types_been_on[i] = src->RideTypesBeenOn[i];
}
dst->item_extra_flags = src->ItemExtraFlags;
dst->photo2_ride_ref = src->Photo2RideRef;
dst->photo3_ride_ref = src->Photo3RideRef;
dst->photo4_ride_ref = src->Photo4RideRef;
dst->current_ride = src->CurrentRide;
dst->photo2_ride_ref = OpenRCT2RideIdToRCT12RideId(src->Photo2RideRef);
dst->photo3_ride_ref = OpenRCT2RideIdToRCT12RideId(src->Photo3RideRef);
dst->photo4_ride_ref = OpenRCT2RideIdToRCT12RideId(src->Photo4RideRef);
dst->current_ride = OpenRCT2RideIdToRCT12RideId(src->CurrentRide);
dst->current_ride_station = src->CurrentRideStation;
dst->current_train = src->CurrentTrain;
dst->time_to_sitdown = src->TimeToSitdown;
@ -1190,7 +1190,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->step_progress = src->StepProgress;
dst->next_in_queue = src->GuestNextInQueue;
dst->direction = src->PeepDirection;
dst->interaction_ride_index = src->InteractionRideIndex;
dst->interaction_ride_index = OpenRCT2RideIdToRCT12RideId(src->InteractionRideIndex);
dst->time_in_queue = src->TimeInQueue;
for (size_t i = 0; i < std::size(src->RidesBeenOn); i++)
{
@ -1201,7 +1201,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->cash_spent = src->CashSpent;
dst->park_entry_time = src->ParkEntryTime;
dst->rejoin_queue_timeout = src->RejoinQueueTimeout;
dst->previous_ride = src->PreviousRide;
dst->previous_ride = OpenRCT2RideIdToRCT12RideId(src->PreviousRide);
dst->previous_ride_time_out = src->PreviousRideTimeOut;
for (size_t i = 0; i < std::size(src->Thoughts); i++)
{
@ -1213,9 +1213,9 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dstThought->fresh_timeout = srcThought->fresh_timeout;
}
dst->path_check_optimisation = src->PathCheckOptimisation;
dst->guest_heading_to_ride_id = src->GuestHeadingToRideId;
dst->guest_heading_to_ride_id = OpenRCT2RideIdToRCT12RideId(src->GuestHeadingToRideId);
dst->peep_is_lost_countdown = src->GuestIsLostCountdown;
dst->photo1_ride_ref = src->Photo1RideRef;
dst->photo1_ride_ref = OpenRCT2RideIdToRCT12RideId(src->Photo1RideRef);
dst->peep_flags = src->PeepFlags;
dst->pathfind_goal = src->PathfindGoal;
for (size_t i = 0; i < std::size(src->PathfindHistory); i++)
@ -1235,7 +1235,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->VoucherRideId;
dst->voucher_arguments = OpenRCT2RideIdToRCT12RideId(src->VoucherRideId);
dst->surroundings_thought_timeout = src->SurroundingsThoughtTimeout;
dst->angriness = src->Angriness;
dst->time_lost = src->TimeLost;
@ -1243,7 +1243,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->balloon_colour = src->BalloonColour;
dst->umbrella_colour = src->UmbrellaColour;
dst->hat_colour = src->HatColour;
dst->favourite_ride = src->FavouriteRide;
dst->favourite_ride = OpenRCT2RideIdToRCT12RideId(src->FavouriteRide);
dst->favourite_ride_rating = src->FavouriteRideRating;
dst->item_standard_flags = src->ItemStandardFlags;
}

View file

@ -1469,10 +1469,10 @@ public:
dst->RideTypesBeenOn[i] = src->ride_types_been_on[i];
}
dst->ItemExtraFlags = src->item_extra_flags;
dst->Photo2RideRef = src->photo2_ride_ref;
dst->Photo3RideRef = src->photo3_ride_ref;
dst->Photo4RideRef = src->photo4_ride_ref;
dst->CurrentRide = src->current_ride;
dst->Photo2RideRef = RCT12RideIdToOpenRCT2RideId(src->photo2_ride_ref);
dst->Photo3RideRef = RCT12RideIdToOpenRCT2RideId(src->photo3_ride_ref);
dst->Photo4RideRef = RCT12RideIdToOpenRCT2RideId(src->photo4_ride_ref);
dst->CurrentRide = RCT12RideIdToOpenRCT2RideId(src->current_ride);
dst->CurrentRideStation = src->current_ride_station;
dst->CurrentTrain = src->current_train;
dst->TimeToSitdown = src->time_to_sitdown;
@ -1485,7 +1485,7 @@ public:
dst->StepProgress = src->step_progress;
dst->GuestNextInQueue = src->next_in_queue;
dst->PeepDirection = src->direction;
dst->InteractionRideIndex = src->interaction_ride_index;
dst->InteractionRideIndex = RCT12RideIdToOpenRCT2RideId(src->interaction_ride_index);
dst->TimeInQueue = src->time_in_queue;
for (size_t i = 0; i < std::size(src->rides_been_on); i++)
{
@ -1496,7 +1496,7 @@ public:
dst->CashSpent = src->cash_spent;
dst->ParkEntryTime = src->park_entry_time;
dst->RejoinQueueTimeout = src->rejoin_queue_timeout;
dst->PreviousRide = src->previous_ride;
dst->PreviousRide = RCT12RideIdToOpenRCT2RideId(src->previous_ride);
dst->PreviousRideTimeOut = src->previous_ride_time_out;
for (size_t i = 0; i < std::size(src->thoughts); i++)
{
@ -1508,9 +1508,9 @@ public:
dstThought->fresh_timeout = srcThought->fresh_timeout;
}
dst->PathCheckOptimisation = src->path_check_optimisation;
dst->GuestHeadingToRideId = src->guest_heading_to_ride_id;
dst->GuestHeadingToRideId = RCT12RideIdToOpenRCT2RideId(src->guest_heading_to_ride_id);
dst->GuestIsLostCountdown = src->peep_is_lost_countdown;
dst->Photo1RideRef = src->photo1_ride_ref;
dst->Photo1RideRef = RCT12RideIdToOpenRCT2RideId(src->photo1_ride_ref);
dst->PeepFlags = src->peep_flags;
dst->PathfindGoal = src->pathfind_goal;
for (size_t i = 0; i < std::size(src->pathfind_history); i++)
@ -1530,7 +1530,7 @@ public:
dst->AmountOfSouvenirs = src->no_of_souvenirs;
dst->VandalismSeen = src->vandalism_seen;
dst->VoucherType = src->voucher_type;
dst->VoucherRideId = src->voucher_arguments;
dst->VoucherRideId = RCT12RideIdToOpenRCT2RideId(src->voucher_arguments);
dst->SurroundingsThoughtTimeout = src->surroundings_thought_timeout;
dst->Angriness = src->angriness;
dst->TimeLost = src->time_lost;
@ -1538,7 +1538,7 @@ public:
dst->BalloonColour = src->balloon_colour;
dst->UmbrellaColour = src->umbrella_colour;
dst->HatColour = src->hat_colour;
dst->FavouriteRide = src->favourite_ride;
dst->FavouriteRide = RCT12RideIdToOpenRCT2RideId(src->favourite_ride);
dst->FavouriteRideRating = src->favourite_ride_rating;
dst->ItemStandardFlags = src->item_standard_flags;
}

View file

@ -1821,7 +1821,7 @@ bool ride_modify(CoordsXYE* input)
if (tileElement.element == nullptr)
return false;
auto rideIndex = tile_element_get_ride_index(tileElement.element);
auto rideIndex = tileElement.element->GetRideIndex();
auto ride = get_ride(rideIndex);
if (ride == nullptr)
{

View file

@ -141,16 +141,16 @@ void tile_element_remove_banner_entry(TileElement* tileElement)
}
}
uint8_t tile_element_get_ride_index(const TileElement* tileElement)
ride_id_t TileElement::GetRideIndex() const
{
switch (tileElement->GetType())
switch (GetType())
{
case TILE_ELEMENT_TYPE_TRACK:
return tileElement->AsTrack()->GetRideIndex();
return AsTrack()->GetRideIndex();
case TILE_ELEMENT_TYPE_ENTRANCE:
return tileElement->AsEntrance()->GetRideIndex();
return AsEntrance()->GetRideIndex();
case TILE_ELEMENT_TYPE_PATH:
return tileElement->AsPath()->GetRideIndex();
return AsPath()->GetRideIndex();
default:
return RIDE_ID_NULL;
}

View file

@ -181,6 +181,8 @@ public:
}
void ClearAs(uint8_t newType);
ride_id_t GetRideIndex() const;
};
assert_struct_size(TileElement, 16);
@ -683,5 +685,3 @@ bool tile_element_is_underground(TileElement* tileElement);
// ~Oli414: The banner functions should probably be part of banner.
void tile_element_set_banner_index(TileElement* tileElement, BannerIndex bannerIndex);
void tile_element_remove_banner_entry(TileElement* tileElement);
uint8_t tile_element_get_ride_index(const TileElement* tileElement);

View file

@ -35,7 +35,7 @@ Ride gRideList[MAX_RIDES];
int16_t gMapSizeUnits;
int16_t gMapBaseZ;
bool gTrackDesignSaveMode = false;
uint8_t gTrackDesignSaveRideIndex = RIDE_ID_NULL;
ride_id_t gTrackDesignSaveRideIndex = RIDE_ID_NULL;
uint8_t gClipHeight = 255;
CoordsXY gClipSelectionA = { 0, 0 };
CoordsXY gClipSelectionB = { MAXIMUM_TILE_START_XY, MAXIMUM_TILE_START_XY };