Merge pull request #19315 from ZehMatt/ride-cleanup

Cleanup code around Vehicle/Ride
This commit is contained in:
Matthias Moninger 2023-02-05 19:39:50 +02:00 committed by GitHub
commit ccc234fe8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 358 additions and 369 deletions

View File

@ -1505,8 +1505,8 @@ private:
for (; ObjectEntryGetChunk(ObjectType::Ride, entry_index) == nullptr; entry_index++)
;
RideObjectEntry* ride_entry = GetRideEntryByIndex(entry_index);
auto rideType = ride_entry->GetFirstNonNullRideType();
const auto* rideEntry = GetRideEntryByIndex(entry_index);
auto rideType = rideEntry->GetFirstNonNullRideType();
auto intent = Intent(WindowClass::TrackDesignList);
intent.PutExtra(INTENT_EXTRA_RIDE_TYPE, rideType);
@ -1586,7 +1586,7 @@ void EditorLoadSelectedObjects()
auto entryIndex = ObjectManagerGetLoadedObjectEntryIndex(loadedObject);
if (objectType == ObjectType::Ride)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(entryIndex);
const auto* rideEntry = GetRideEntryByIndex(entryIndex);
auto rideType = rideEntry->GetFirstNonNullRideType();
ResearchCategory category = static_cast<ResearchCategory>(GetRideTypeDescriptor(rideType).Category);
ResearchInsertRideEntry(rideType, entryIndex, category, true);

View File

@ -680,7 +680,7 @@ private:
continue;
// Ride entries
RideObjectEntry* rideEntry = GetRideEntryByIndex(rideEntryIndex);
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
// Skip if the vehicle isn't the preferred vehicle for this generic track type
if (!gConfigInterface.ListRideVehiclesSeparately
@ -919,7 +919,7 @@ private:
void DrawRideInformation(DrawPixelInfo& dpi, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(item.EntryIndex);
const auto* rideEntry = GetRideEntryByIndex(item.EntryIndex);
RideNaming rideNaming = GetRideNaming(item.Type, *rideEntry);
auto ft = Formatter();
@ -1077,7 +1077,7 @@ void WindowNewRideFocus(RideSelection rideItem)
return;
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(rideItem.EntryIndex);
const auto* rideEntry = GetRideEntryByIndex(rideItem.EntryIndex);
if (rideEntry == nullptr)
return;

View File

@ -858,7 +858,7 @@ struct VehicleTypeLabel
};
static int32_t VehicleDropdownDataLanguage = LANGUAGE_UNDEFINED;
static RideObjectEntry* VehicleDropdownRideType = nullptr;
static const RideObjectEntry* VehicleDropdownRideType = nullptr;
static bool VehicleDropdownExpanded = false;
static std::vector<VehicleTypeLabel> VehicleDropdownData;
@ -970,7 +970,7 @@ static void WindowRideDrawTabVehicle(DrawPixelInfo* dpi, WindowBase* w)
}
const auto vehicle = RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, rideEntry->TabCar);
CarEntry* carEntry = &rideEntry->Cars[vehicle];
const auto& carEntry = rideEntry->Cars[vehicle];
auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->TabCar : 0;
VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleId);
@ -979,10 +979,10 @@ static void WindowRideDrawTabVehicle(DrawPixelInfo* dpi, WindowBase* w)
auto imageIndex = OpenRCT2::Entity::Yaw::YawFrom4(2) * 2;
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
imageIndex += w->frame_no;
imageIndex = carEntry->SpriteByYaw(imageIndex / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry->TabRotationMask;
imageIndex *= carEntry->base_num_frames;
imageIndex += carEntry->base_image_id;
imageIndex = carEntry.SpriteByYaw(imageIndex / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry.TabRotationMask;
imageIndex *= carEntry.base_num_frames;
imageIndex += carEntry.base_image_id;
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary);
GfxDrawSprite(&clipDPI, imageId, screenCoords);
}
@ -1073,7 +1073,7 @@ static void WindowRideDisableTabs(WindowBase* w)
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) != 0)
disabled_tabs |= (1uLL << WIDX_TAB_4 | 1uLL << WIDX_TAB_6 | 1uLL << WIDX_TAB_9 | 1uLL << WIDX_TAB_10); // 0x3280
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride->subtype);
const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr)
{
@ -1516,8 +1516,8 @@ static void WindowRideInitViewport(WindowBase* w)
if (viewSelectionIndex >= 0 && viewSelectionIndex < ride->NumTrains && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)
{
auto vehId = ride->vehicles[viewSelectionIndex];
RideObjectEntry* ride_entry = ride->GetRideEntry();
if (ride_entry != nullptr && ride_entry->TabCar != 0)
const auto* rideEntry = ride->GetRideEntry();
if (rideEntry != nullptr && rideEntry->TabCar != 0)
{
Vehicle* vehicle = GetEntity<Vehicle>(vehId);
if (vehicle == nullptr)
@ -2010,7 +2010,7 @@ static void WindowRideMainFollowRide(WindowBase* w)
static void PopulateVehicleTypeDropdown(const Ride& ride, bool forceRefresh)
{
auto& objManager = GetContext()->GetObjectManager();
RideObjectEntry* rideEntry = ride.GetRideEntry();
const auto* rideEntry = ride.GetRideEntry();
bool selectionShouldBeExpanded;
int32_t rideTypeIterator, rideTypeIteratorMax;
@ -2798,7 +2798,6 @@ static OpenRCT2String WindowRideVehicleTooltip(WindowBase* const w, const Widget
static void WindowRideVehicleInvalidate(WindowBase* w)
{
Widget* widgets;
RideObjectEntry* rideEntry;
StringId stringId;
int32_t carsPerTrain;
@ -2815,7 +2814,7 @@ static void WindowRideVehicleInvalidate(WindowBase* w)
if (ride == nullptr)
return;
rideEntry = ride->GetRideEntry();
const auto* rideEntry = ride->GetRideEntry();
w->widgets[WIDX_TITLE].text = STR_ARG_20_STRINGID;
@ -2970,7 +2969,7 @@ static void WindowRideVehicleScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int3
if (ride == nullptr)
return;
RideObjectEntry* rideEntry = ride->GetRideEntry();
const auto* rideEntry = ride->GetRideEntry();
// Background
GfxFillRect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width, dpi->y + dpi->height } }, PALETTE_INDEX_12);
@ -2979,8 +2978,8 @@ static void WindowRideVehicleScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int3
int32_t startX = std::max(2, (widget->width() - ((ride->NumTrains - 1) * 36)) / 2 - 25);
int32_t startY = widget->height() - 4;
CarEntry* carEntry = &rideEntry->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, 0)];
startY += carEntry->tab_height;
const auto& firstCarEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, 0)];
startY += firstCarEntry.tab_height;
// For each train
for (int32_t i = 0; i < ride->NumTrains; i++)
@ -2994,9 +2993,9 @@ static void WindowRideVehicleScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int3
static_assert(std::numeric_limits<decltype(ride->num_cars_per_train)>::max() <= std::size(trainCarImages));
for (int32_t j = 0; j < ride->num_cars_per_train; j++)
{
carEntry = &rideEntry->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, j)];
x += carEntry->spacing / 17432;
y -= (carEntry->spacing / 2) / 17432;
const auto& carEntry = rideEntry->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, j)];
x += carEntry.spacing / 17432;
y -= (carEntry.spacing / 2) / 17432;
// Get colour of vehicle
int32_t vehicleColourIndex = 0;
@ -3014,10 +3013,10 @@ static void WindowRideVehicleScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int3
}
VehicleColour vehicleColour = RideGetVehicleColour(*ride, vehicleColourIndex);
ImageIndex imageIndex = carEntry->SpriteByYaw(OpenRCT2::Entity::Yaw::BaseRotation / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry->TabRotationMask;
imageIndex *= carEntry->base_num_frames;
imageIndex += carEntry->base_image_id;
ImageIndex imageIndex = carEntry.SpriteByYaw(OpenRCT2::Entity::Yaw::BaseRotation / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry.TabRotationMask;
imageIndex *= carEntry.base_num_frames;
imageIndex += carEntry.base_image_id;
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary);
@ -3026,8 +3025,8 @@ static void WindowRideVehicleScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int3
nextSpriteToDraw->imageId = imageId;
nextSpriteToDraw++;
x += carEntry->spacing / 17432;
y -= (carEntry->spacing / 2) / 17432;
x += carEntry.spacing / 17432;
y -= (carEntry.spacing / 2) / 17432;
}
if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER)
@ -5021,17 +5020,17 @@ static void WindowRideColourScrollpaint(WindowBase* w, DrawPixelInfo* dpi, int32
auto trainCarIndex = (ride->colour_scheme_type & 3) == RIDE_COLOUR_SCHEME_MODE_DIFFERENT_PER_CAR ? w->vehicleIndex
: rideEntry->TabCar;
CarEntry* carEntry = &rideEntry
->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, trainCarIndex)];
const auto& carEntry = rideEntry
->Cars[RideEntryGetVehicleAtPosition(ride->subtype, ride->num_cars_per_train, trainCarIndex)];
screenCoords.y += carEntry->tab_height;
screenCoords.y += carEntry.tab_height;
// Draw the coloured spinning vehicle
// w->frame_no represents a SpritePrecision of 64
ImageIndex imageIndex = carEntry->SpriteByYaw(w->frame_no / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry->TabRotationMask;
imageIndex *= carEntry->base_num_frames;
imageIndex += carEntry->base_image_id;
ImageIndex imageIndex = carEntry.SpriteByYaw(w->frame_no / 2, SpriteGroupType::SlopeFlat);
imageIndex &= carEntry.TabRotationMask;
imageIndex *= carEntry.base_num_frames;
imageIndex += carEntry.base_image_id;
auto imageId = ImageId(imageIndex, vehicleColour.Body, vehicleColour.Trim, vehicleColour.Tertiary);
GfxDrawSprite(dpi, imageId, screenCoords);
}

View File

@ -362,7 +362,7 @@ public:
void OnPrepareDraw() override
{
StringId stringId = STR_NONE;
RideObjectEntry* entry = GetRideEntryByIndex(_window_track_list_item.EntryIndex);
const auto* entry = GetRideEntryByIndex(_window_track_list_item.EntryIndex);
if (entry != nullptr)
{

View File

@ -279,7 +279,7 @@ StringId LandSetHeightAction::CheckRideSupports() const
if (ride == nullptr)
continue;
RideObjectEntry* rideEntry = ride->GetRideEntry();
const auto* rideEntry = ride->GetRideEntry();
if (rideEntry == nullptr)
continue;

View File

@ -97,13 +97,13 @@ GameActions::Result RideCreateAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(rideEntryIndex);
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
if (rideEntry == nullptr)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
}
VehicleColourPresetList* presetList = rideEntry->vehicle_preset_list;
const auto* presetList = rideEntry->vehicle_preset_list;
if ((presetList->count > 0 && presetList->count != 255) && _colour2 >= presetList->count)
{
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_NONE);
@ -117,14 +117,13 @@ GameActions::Result RideCreateAction::Query() const
GameActions::Result RideCreateAction::Execute() const
{
RideObjectEntry* rideEntry;
auto res = GameActions::Result();
int32_t rideEntryIndex = RideGetEntryIndex(_rideType, _subType);
auto rideIndex = GetNextFreeRideId();
auto ride = GetOrAllocateRide(rideIndex);
rideEntry = GetRideEntryByIndex(rideEntryIndex);
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
if (rideEntry == nullptr)
{
LOG_WARNING("Invalid request for ride %u", rideIndex);

View File

@ -58,7 +58,7 @@ GameActions::Result RideSetPriceAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride->subtype);
const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr)
{
LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying());
@ -80,7 +80,7 @@ GameActions::Result RideSetPriceAction::Execute() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride->subtype);
const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr)
{
LOG_WARNING("Invalid game command for ride %u", _rideIndex.ToUnderlying());

View File

@ -74,7 +74,7 @@ GameActions::Result TrackPlaceAction::Query() const
return GameActions::Result(
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride->subtype);
const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr)
{
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());
@ -417,7 +417,7 @@ GameActions::Result TrackPlaceAction::Execute() const
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride->subtype);
const auto* rideEntry = GetRideEntryByIndex(ride->subtype);
if (rideEntry == nullptr)
{
LOG_WARNING("Invalid ride subtype for track placement, rideIndex = %d", _rideIndex.ToUnderlying());

View File

@ -2503,7 +2503,7 @@ void Guest::GoToRideEntrance(const Ride& ride)
int16_t y_shift = DirectionOffsets[location.direction].y;
uint8_t shift_multiplier = 21;
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
if (rideEntry != nullptr)
{
if (rideEntry->Cars[rideEntry->DefaultCar].flags & CAR_ENTRY_FLAG_MINI_GOLF
@ -3386,7 +3386,7 @@ void Guest::UpdateBuying()
}
else
{
RideObjectEntry* ride_type = GetRideEntryByIndex(ride->subtype);
const auto* ride_type = GetRideEntryByIndex(ride->subtype);
if (ride_type == nullptr)
{
return;
@ -3578,7 +3578,7 @@ void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride& ride, CoordsXYZD& ent
}
}
uint8_t Guest::GetWaypointedSeatLocation(const Ride& ride, CarEntry* vehicle_type, uint8_t track_direction) const
uint8_t Guest::GetWaypointedSeatLocation(const Ride& ride, const CarEntry* vehicle_type, uint8_t track_direction) const
{
// The seatlocation can be split into segments around the ride base
// to decide the segment first split off the segmentable seat location
@ -3619,18 +3619,18 @@ void Guest::UpdateRideLeaveEntranceWaypoints(const Ride& ride)
// TODO: Goto ride exit on failure.
return;
}
auto ride_entry = vehicle->GetRideEntry();
auto vehicle_type = &ride_entry->Cars[vehicle->vehicle_type];
const auto* rideEntry = vehicle->GetRideEntry();
const auto* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
Var37 = (direction_entrance | GetWaypointedSeatLocation(ride, vehicle_type, direction_track) * 4) * 4;
Var37 = (direction_entrance | GetWaypointedSeatLocation(ride, carEntry, direction_track) * 4) * 4;
const auto& rtd = ride.GetRideTypeDescriptor();
CoordsXY waypoint = rtd.GetGuestWaypointLocation(*vehicle, ride, CurrentRideStation);
const auto waypointIndex = Var37 / 4;
Guard::Assert(vehicle_type->peep_loading_waypoints.size() >= static_cast<size_t>(waypointIndex));
waypoint.x += vehicle_type->peep_loading_waypoints[waypointIndex][0].x;
waypoint.y += vehicle_type->peep_loading_waypoints[waypointIndex][0].y;
Guard::Assert(carEntry->peep_loading_waypoints.size() >= static_cast<size_t>(waypointIndex));
waypoint.x += carEntry->peep_loading_waypoints[waypointIndex][0].x;
waypoint.y += carEntry->peep_loading_waypoints[waypointIndex][0].y;
SetDestination(waypoint);
RideSubState = PeepRideSubState::ApproachVehicleWaypoints;
@ -3648,16 +3648,16 @@ void Guest::UpdateRideAdvanceThroughEntrance()
int16_t actionZ, xy_distance;
auto ride_entry = ride->GetRideEntry();
const auto* rideEntry = ride->GetRideEntry();
if (auto loc = UpdateAction(xy_distance); loc.has_value())
{
uint16_t distanceThreshold = 16;
if (ride_entry != nullptr)
if (rideEntry != nullptr)
{
uint8_t vehicle = ride_entry->DefaultCar;
if (ride_entry->Cars[vehicle].flags & CAR_ENTRY_FLAG_MINI_GOLF
|| ride_entry->Cars[vehicle].flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
uint8_t vehicle = rideEntry->DefaultCar;
if (rideEntry->Cars[vehicle].flags & CAR_ENTRY_FLAG_MINI_GOLF
|| rideEntry->Cars[vehicle].flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
{
distanceThreshold = 28;
}
@ -3709,13 +3709,13 @@ void Guest::UpdateRideAdvanceThroughEntrance()
return;
}
ride_entry = vehicle->GetRideEntry();
if (ride_entry == nullptr)
rideEntry = vehicle->GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
CarEntry* vehicle_type = &ride_entry->Cars[vehicle->vehicle_type];
const auto* vehicle_type = &rideEntry->Cars[vehicle->vehicle_type];
if (vehicle_type->flags & CAR_ENTRY_FLAG_LOADING_WAYPOINTS)
{
@ -3789,11 +3789,11 @@ static void PeepGoToRideExit(Peep* peep, const Ride& ride, int16_t x, int16_t y,
int16_t shift_multiplier = 20;
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
if (rideEntry != nullptr)
{
CarEntry* carEntry = &rideEntry->Cars[rideEntry->DefaultCar];
if (carEntry->flags & CAR_ENTRY_FLAG_MINI_GOLF || carEntry->flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
const CarEntry& carEntry = rideEntry->Cars[rideEntry->DefaultCar];
if (carEntry.flags & CAR_ENTRY_FLAG_MINI_GOLF || carEntry.flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
{
shift_multiplier = 32;
}
@ -3930,13 +3930,13 @@ void Guest::UpdateRideFreeVehicleCheck()
if (vehicle == nullptr)
return;
RideObjectEntry* ride_entry = vehicle->GetRideEntry();
if (ride_entry == nullptr)
const auto* rideEntry = vehicle->GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
if (ride_entry->Cars[0].flags & CAR_ENTRY_FLAG_MINI_GOLF)
if (rideEntry->Cars[0].flags & CAR_ENTRY_FLAG_MINI_GOLF)
{
vehicle->mini_golf_flags &= ~MiniGolfFlag::Flag5;
@ -4123,13 +4123,13 @@ void Guest::UpdateRideLeaveVehicle()
ride_station = bestStationIndex;
}
CurrentRideStation = ride_station;
RideObjectEntry* rideEntry = vehicle->GetRideEntry();
const auto* rideEntry = vehicle->GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
CarEntry* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
const auto* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
assert(CurrentRideStation.ToUnderlying() < OpenRCT2::Limits::MaxStationsPerRide);
auto& station = ride->GetStation(CurrentRideStation);
@ -4291,7 +4291,7 @@ void Guest::UpdateRideLeaveVehicle()
*/
void Guest::UpdateRidePrepareForExit()
{
auto ride = GetRide(CurrentRide);
const auto* ride = GetRide(CurrentRide);
if (ride == nullptr || CurrentRideStation.ToUnderlying() >= std::size(ride->GetStations()))
return;
@ -4302,11 +4302,11 @@ void Guest::UpdateRidePrepareForExit()
int16_t shiftMultiplier = 20;
RideObjectEntry* rideEntry = ride->GetRideEntry();
const auto* rideEntry = ride->GetRideEntry();
if (rideEntry != nullptr)
{
CarEntry* carEntry = &rideEntry->Cars[rideEntry->DefaultCar];
if (carEntry->flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
const auto& carEntry = rideEntry->Cars[rideEntry->DefaultCar];
if (carEntry.flags & (CAR_ENTRY_FLAG_CHAIRLIFT | CAR_ENTRY_FLAG_GO_KART))
{
shiftMultiplier = 32;
}
@ -4424,16 +4424,16 @@ void Guest::UpdateRideApproachVehicleWaypoints()
CoordsXY targetLoc = rtd.GetGuestWaypointLocation(*vehicle, *ride, CurrentRideStation);
RideObjectEntry* ride_entry = vehicle->GetRideEntry();
if (ride_entry == nullptr)
const auto* rideEntry = vehicle->GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
CarEntry* vehicle_type = &ride_entry->Cars[vehicle->vehicle_type];
const auto& vehicle_type = rideEntry->Cars[vehicle->vehicle_type];
Guard::Assert(waypoint < 3);
targetLoc.x += vehicle_type->peep_loading_waypoints[Var37 / 4][waypoint].x;
targetLoc.y += vehicle_type->peep_loading_waypoints[Var37 / 4][waypoint].y;
targetLoc.x += vehicle_type.peep_loading_waypoints[Var37 / 4][waypoint].x;
targetLoc.y += vehicle_type.peep_loading_waypoints[Var37 / 4][waypoint].y;
SetDestination(targetLoc);
}
@ -4516,7 +4516,7 @@ void Guest::UpdateRideApproachExitWaypoints()
return;
}
RideObjectEntry* rideEntry = vehicle->GetRideEntry();
const auto* rideEntry = vehicle->GetRideEntry();
if (rideEntry == nullptr)
return;

View File

@ -393,7 +393,7 @@ private:
void UpdateRideAtEntrance();
void UpdateRideAdvanceThroughEntrance();
void UpdateRideLeaveEntranceWaypoints(const Ride& ride);
uint8_t GetWaypointedSeatLocation(const Ride& ride, CarEntry* vehicle_type, uint8_t track_direction) const;
uint8_t GetWaypointedSeatLocation(const Ride& ride, const CarEntry* vehicle_type, uint8_t track_direction) const;
void UpdateRideFreeVehicleCheck();
void UpdateRideFreeVehicleEnterRide(Ride& ride);
void UpdateRideApproachVehicle();

View File

@ -1233,9 +1233,7 @@ static int32_t ConsoleCommandLoadObject(InteractiveConsole& console, const argum
if (objectType == ObjectType::Ride)
{
// Automatically research the ride so it's supported by the game.
RideObjectEntry* rideEntry;
rideEntry = GetRideEntryByIndex(groupIndex);
const auto* rideEntry = GetRideEntryByIndex(groupIndex);
for (int32_t j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
{

View File

@ -202,7 +202,7 @@ void ResearchFinishItem(ResearchItem* researchItem)
// Ride
auto base_ride_type = researchItem->baseRideType;
ObjectEntryIndex rideEntryIndex = researchItem->entryIndex;
RideObjectEntry* rideEntry = GetRideEntryByIndex(rideEntryIndex);
const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
if (rideEntry != nullptr && base_ride_type != RIDE_TYPE_NULL)
{
@ -234,7 +234,7 @@ void ResearchFinishItem(ResearchItem* researchItem)
{
if (!seenRideEntry[i])
{
RideObjectEntry* rideEntry2 = GetRideEntryByIndex(i);
const auto* rideEntry2 = GetRideEntryByIndex(i);
if (rideEntry2 != nullptr)
{
for (uint8_t j = 0; j < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; j++)
@ -475,7 +475,7 @@ void ResearchPopulateListRandom()
// Rides
for (int32_t i = 0; i < MAX_RIDE_OBJECTS; i++)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(i);
const auto* rideEntry = GetRideEntryByIndex(i);
if (rideEntry == nullptr)
{
continue;
@ -520,7 +520,7 @@ bool ResearchInsertRideEntry(ride_type_t rideType, ObjectEntryIndex entryIndex,
void ResearchInsertRideEntry(ObjectEntryIndex entryIndex, bool researched)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(entryIndex);
const auto* rideEntry = GetRideEntryByIndex(entryIndex);
if (rideEntry == nullptr)
return;
@ -707,7 +707,7 @@ StringId ResearchItem::GetName() const
{
if (type == Research::EntryType::Ride)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(entryIndex);
const auto* rideEntry = GetRideEntryByIndex(entryIndex);
if (rideEntry == nullptr)
{
return STR_EMPTY;

View File

@ -806,7 +806,7 @@ namespace RCT1
dst->subtype = _rideTypeToRideEntryMap[EnumValue(src->Type)];
}
RideObjectEntry* rideEntry = GetRideEntryByIndex(dst->subtype);
const auto* rideEntry = GetRideEntryByIndex(dst->subtype);
// This can happen with hacked parks
if (rideEntry == nullptr)
{
@ -2229,7 +2229,7 @@ namespace RCT1
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(entryIndex);
const auto* rideEntry = GetRideEntryByIndex(entryIndex);
if (rideEntry != nullptr)
{
@ -2248,7 +2248,7 @@ namespace RCT1
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(entryIndex);
const auto* rideEntry = GetRideEntryByIndex(entryIndex);
if (rideEntry != nullptr)
{

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ public:
void SetColourPreset(uint8_t index);
RideObjectEntry* GetRideEntry() const;
const RideObjectEntry* GetRideEntry() const;
size_t GetNumPrices() const;
int32_t GetAge() const;
@ -996,7 +996,7 @@ struct RideManager
RideManager GetRideManager();
RideId GetNextFreeRideId();
Ride* GetOrAllocateRide(RideId index);
RideObjectEntry* GetRideEntryByIndex(ObjectEntryIndex index);
const RideObjectEntry* GetRideEntryByIndex(ObjectEntryIndex index);
std::string_view GetRideEntryName(ObjectEntryIndex index);
extern money16 gTotalRideValueForMoney;

View File

@ -94,7 +94,7 @@ using namespace OpenRCT2::TrackMetaData;
static int32_t ride_check_if_construction_allowed(Ride& ride)
{
Formatter ft;
RideObjectEntry* rideEntry = ride.GetRideEntry();
const auto* rideEntry = ride.GetRideEntry();
if (rideEntry == nullptr)
{
ContextShowError(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE, ft);

View File

@ -976,7 +976,7 @@ static uint16_t ride_compute_upkeep(RideRatingUpdateState& state, const Ride& ri
*/
static void ride_ratings_apply_adjustments(const Ride& ride, RatingTuple* ratings)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
if (rideEntry == nullptr)
{
@ -1135,7 +1135,7 @@ static ShelteredEights get_num_of_sheltered_eighths(const Ride& ride)
}
uint8_t trackShelteredEighths = numShelteredEighths;
RideObjectEntry* rideType = GetRideEntryByIndex(ride.subtype);
const auto* rideType = GetRideEntryByIndex(ride.subtype);
if (rideType == nullptr)
{
return { 0, 0 };

View File

@ -280,7 +280,7 @@ static void ride_race_init_vehicle_speeds(const Ride& ride)
vehicle->ClearUpdateFlag(VEHICLE_UPDATE_FLAG_6);
RideObjectEntry* rideEntry = vehicle->GetRideEntry();
const auto* rideEntry = vehicle->GetRideEntry();
vehicle->speed = (ScenarioRand() & 15) - 8 + rideEntry->Cars[vehicle->vehicle_type].powered_max_speed;

View File

@ -811,7 +811,7 @@ OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority)
int32_t frequency = std::abs(velocity);
RideObjectEntry* rideType = GetRideEntry();
const auto* rideType = GetRideEntry();
if (rideType != nullptr)
{
if (rideType->Cars[vehicle_type].double_sound_frequency & 1)
@ -1322,15 +1322,15 @@ bool Vehicle::OpenRestraints()
continue;
}
CarEntry* carEntry = &rideEntry->Cars[vehicle->vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle->vehicle_type];
if (carEntry->flags & CAR_ENTRY_FLAG_SPINNING)
if (carEntry.flags & CAR_ENTRY_FLAG_SPINNING)
{
// If the vehicle is a spinner it must be spinning slow
// For vehicles without additional frames there are 4 rotations it can unload from
// For vehicles with additional frames it must be facing forward
if (abs(vehicle->spin_speed) <= VEHICLE_MAX_SPIN_SPEED_FOR_STOPPING && !(vehicle->spin_sprite & 0x30)
&& (!(carEntry->flags & CAR_ENTRY_FLAG_SPINNING_ADDITIONAL_FRAMES) || !(vehicle->spin_sprite & 0xF8)))
&& (!(carEntry.flags & CAR_ENTRY_FLAG_SPINNING_ADDITIONAL_FRAMES) || !(vehicle->spin_sprite & 0xF8)))
{
vehicle->spin_speed = 0;
}
@ -1351,7 +1351,7 @@ bool Vehicle::OpenRestraints()
continue;
}
}
if (carEntry->animation == CAR_ENTRY_ANIMATION_OBSERVATION_TOWER && vehicle->animation_frame != 0)
if (carEntry.animation == CAR_ENTRY_ANIMATION_OBSERVATION_TOWER && vehicle->animation_frame != 0)
{
if (vehicle->animationState <= 0xCCCC)
{
@ -1367,7 +1367,7 @@ bool Vehicle::OpenRestraints()
restraintsOpen = false;
continue;
}
if (carEntry->animation == CAR_ENTRY_ANIMATION_ANIMAL_FLYING
if (carEntry.animation == CAR_ENTRY_ANIMATION_ANIMAL_FLYING
&& (vehicle->animation_frame != 0 || vehicle->animationState > 0))
{
vehicle->UpdateAnimationAnimalFlying();
@ -2019,15 +2019,15 @@ void Vehicle::UpdateMovingToEndOfStation()
break;
default:
{
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle_type];
if (!(carEntry->flags & CAR_ENTRY_FLAG_POWERED))
if (!(carEntry.flags & CAR_ENTRY_FLAG_POWERED))
{
if (velocity <= 131940)
{
@ -2331,15 +2331,15 @@ void Vehicle::UpdateDodgemsMode()
if (curRide == nullptr)
return;
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
if (rideEntry == nullptr)
{
return;
}
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle_type];
// Mark the dodgem as in use.
if (carEntry->flags & CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS && animation_frame != 1)
if (carEntry.flags & CAR_ENTRY_FLAG_DODGEM_INUSE_LIGHTS && animation_frame != 1)
{
animation_frame = 1;
Invalidate();
@ -3100,7 +3100,7 @@ void Vehicle::UpdateDeparting()
if (curRide == nullptr)
return;
auto rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
if (rideEntry == nullptr)
return;
@ -3160,7 +3160,7 @@ void Vehicle::UpdateDeparting()
}
}
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle_type];
const auto& rtd = curRide->GetRideTypeDescriptor();
switch (curRide->mode)
{
@ -3191,7 +3191,7 @@ void Vehicle::UpdateDeparting()
case RideMode::RotatingLift:
case RideMode::FreefallDrop:
case RideMode::BoatHire:
if (carEntry->flags & CAR_ENTRY_FLAG_POWERED)
if (carEntry.flags & CAR_ENTRY_FLAG_POWERED)
break;
if (velocity <= 131940)
@ -3915,10 +3915,10 @@ void Vehicle::UpdateArriving()
stationBrakesWork = false;
}
RideObjectEntry* rideEntry = GetRideEntry();
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto* rideEntry = GetRideEntry();
const auto& carEntry = rideEntry->Cars[vehicle_type];
UpdateArrivingPassThroughStation(*curRide, *carEntry, stationBrakesWork);
UpdateArrivingPassThroughStation(*curRide, carEntry, stationBrakesWork);
curFlags = UpdateTrackMotion(nullptr);
if (curFlags & VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_COLLISION && !stationBrakesWork)
@ -3943,7 +3943,7 @@ void Vehicle::UpdateArriving()
}
var_C0++;
if ((curFlags & VEHICLE_UPDATE_MOTION_TRACK_FLAG_1) && (carEntry->flags & CAR_ENTRY_FLAG_GO_KART) && (var_C0 < 40))
if ((curFlags & VEHICLE_UPDATE_MOTION_TRACK_FLAG_1) && (carEntry.flags & CAR_ENTRY_FLAG_GO_KART) && (var_C0 < 40))
{
return;
}
@ -5466,17 +5466,17 @@ void Vehicle::UpdateSound()
if (rideEntry == nullptr)
return;
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle_type];
int32_t ecx = abs(velocity) - 0x10000;
if (ecx >= 0)
{
frictionSound.id = carEntry->friction_sound_id;
frictionSound.id = carEntry.friction_sound_id;
ecx >>= 15;
frictionSound.volume = std::min(208 + (ecx & 0xFF), 255);
}
switch (carEntry->sound_range)
switch (carEntry.sound_range)
{
case SOUND_RANGE_WHISTLE:
screamSound.id = scream_sound_id;
@ -5523,7 +5523,7 @@ void Vehicle::UpdateSound()
break;
default:
if ((carEntry->flags & CAR_ENTRY_FLAG_RIDERS_SCREAM))
if ((carEntry.flags & CAR_ENTRY_FLAG_RIDERS_SCREAM))
{
screamSound.id = UpdateScreamSound();
if (screamSound.id == OpenRCT2::Audio::SoundId::NoScream)
@ -5607,16 +5607,16 @@ OpenRCT2::Audio::SoundId Vehicle::UpdateScreamSound()
OpenRCT2::Audio::SoundId Vehicle::ProduceScreamSound(const int32_t totalNumPeeps)
{
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto& carEntry = rideEntry->Cars[vehicle_type];
if (scream_sound_id == OpenRCT2::Audio::SoundId::Null)
{
auto r = ScenarioRand();
if (totalNumPeeps >= static_cast<int32_t>(r % 16))
{
switch (carEntry->sound_range)
switch (carEntry.sound_range)
{
case SOUND_RANGE_SCREAMS_0:
scream_sound_id = _screamSet0[r % std::size(_screamSet0)];
@ -5892,10 +5892,10 @@ int32_t Vehicle::UpdateMotionDodgems()
{
eax /= mass;
}
RideObjectEntry* rideEntry = GetRideEntry();
CarEntry* carEntry = &rideEntry->Cars[vehicle_type];
const auto* rideEntry = GetRideEntry();
const auto& carEntry = rideEntry->Cars[vehicle_type];
if (!(carEntry->flags & CAR_ENTRY_FLAG_POWERED))
if (!(carEntry.flags & CAR_ENTRY_FLAG_POWERED))
{
acceleration = -eax;
return _vehicleMotionTrackFlags;
@ -5982,7 +5982,7 @@ std::optional<EntityId> Vehicle::DodgemsCarWouldCollideAt(const CoordsXY& coords
*/
void Vehicle::UpdateTrackMotionUpStopCheck() const
{
auto carEntry = Entry();
const auto* carEntry = Entry();
if (carEntry == nullptr)
{
return;
@ -7006,7 +7006,7 @@ static void vehicle_update_play_water_splash_sound()
*/
void Vehicle::UpdateHandleWaterSplash() const
{
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
auto trackType = GetTrackType();
if (!(rideEntry->flags & RIDE_ENTRY_FLAG_PLAY_SPLASH_SOUND))
@ -7299,7 +7299,7 @@ void Vehicle::ReverseReverserCar()
*/
void Vehicle::Sub6DBF3E()
{
CarEntry* carEntry = Entry();
const auto* carEntry = Entry();
acceleration /= _vehicleUnkF64E10;
if (TrackSubposition == VehicleTrackSubposition::ChairliftGoingBack)
@ -7507,7 +7507,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, const Rid
TrackLocation = location;
// TODO check if getting the vehicle entry again is necessary
CarEntry* carEntry = Entry();
const auto* carEntry = Entry();
if (carEntry == nullptr)
{
return false;
@ -7572,7 +7572,7 @@ bool Vehicle::UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, const Rid
*
* rct2: 0x006DAEB9
*/
bool Vehicle::UpdateTrackMotionForwards(CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry)
bool Vehicle::UpdateTrackMotionForwards(const CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry)
{
EntityId otherVehicleIndex = EntityId::GetNull();
Loc6DAEB9:
@ -7970,7 +7970,7 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, const Ri
*
* rct2: 0x006DBA33
*/
bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry)
bool Vehicle::UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry)
{
EntityId otherVehicleIndex = EntityId::GetNull();
@ -8118,7 +8118,7 @@ bool Vehicle::UpdateTrackMotionBackwards(CarEntry* carEntry, const Ride& curRide
*
*/
void Vehicle::UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const RideObjectEntry& rideEntry, CarEntry* carEntry)
void Vehicle::UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const RideObjectEntry& rideEntry, const CarEntry* carEntry)
{
EntityId otherVehicleIndex = EntityId::GetNull();
TileElement* tileElement = nullptr;
@ -8740,11 +8740,11 @@ int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
if (curRide == nullptr)
return 0;
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
if (rideEntry == nullptr)
return 0;
CarEntry* carEntry = Entry();
const auto* carEntry = Entry();
gCurrentVehicle = this;
_vehicleMotionTrackFlags = 0;
@ -8821,7 +8821,8 @@ static uint8_t modified_speed(uint16_t trackType, VehicleTrackSubposition trackS
return speed;
}
int32_t Vehicle::UpdateTrackMotionPoweredRideAcceleration(CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration)
int32_t Vehicle::UpdateTrackMotionPoweredRideAcceleration(
const CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration)
{
if (carEntry->flags & CAR_ENTRY_FLAG_POWERED_RIDE_UNRESTRICTED_GRAVITY)
{
@ -8903,8 +8904,8 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
if (curRide == nullptr)
return 0;
RideObjectEntry* rideEntry = GetRideEntry();
auto carEntry = Entry();
const auto* rideEntry = GetRideEntry();
const auto* carEntry = Entry();
if (carEntry == nullptr)
{
@ -9118,14 +9119,14 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
return _vehicleMotionTrackFlags;
}
RideObjectEntry* Vehicle::GetRideEntry() const
const RideObjectEntry* Vehicle::GetRideEntry() const
{
return GetRideEntryByIndex(ride_subtype);
}
CarEntry* Vehicle::Entry() const
const CarEntry* Vehicle::Entry() const
{
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
if (rideEntry == nullptr)
{
return nullptr;
@ -9285,7 +9286,7 @@ void Vehicle::UpdateCrossings() const
void Vehicle::Claxon() const
{
RideObjectEntry* rideEntry = GetRideEntry();
const auto* rideEntry = GetRideEntry();
switch (rideEntry->Cars[vehicle_type].sound_range)
{
case SOUND_RANGE_WHISTLE:

View File

@ -226,8 +226,8 @@ struct Vehicle : EntityBase
GForces GetGForces() const;
void SetMapToolbar() const;
int32_t IsUsedInPairs() const;
RideObjectEntry* GetRideEntry() const;
CarEntry* Entry() const;
const RideObjectEntry* GetRideEntry() const;
const CarEntry* Entry() const;
Ride* GetRide() const;
Vehicle* TrainHead() const;
Vehicle* TrainTail() const;
@ -333,9 +333,10 @@ private:
void UpdateAdditionalAnimation();
void CheckIfMissing();
bool CurrentTowerElementIsTop();
bool UpdateTrackMotionForwards(CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry);
bool UpdateTrackMotionBackwards(CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry);
int32_t UpdateTrackMotionPoweredRideAcceleration(CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration);
bool UpdateTrackMotionForwards(const CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry);
bool UpdateTrackMotionBackwards(const CarEntry* carEntry, const Ride& curRide, const RideObjectEntry& rideEntry);
int32_t UpdateTrackMotionPoweredRideAcceleration(
const CarEntry* carEntry, uint32_t totalMass, const int32_t curAcceleration);
int32_t NumPeepsUntilTrainTail() const;
void InvalidateWindow();
void TestReset();
@ -364,7 +365,7 @@ private:
void TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_seats);
int32_t UpdateTrackMotionMiniGolfCalculateAcceleration(const CarEntry& carEntry);
int32_t UpdateTrackMotionMiniGolf(int32_t* outStation);
void UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const RideObjectEntry& rideEntry, CarEntry* carEntry);
void UpdateTrackMotionMiniGolfVehicle(const Ride& curRide, const RideObjectEntry& rideEntry, const CarEntry* carEntry);
bool UpdateTrackMotionForwardsGetNewTrack(uint16_t trackType, const Ride& curRide, const RideObjectEntry& rideEntry);
bool UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, const Ride& curRide, uint16_t* progress);
bool UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* otherVehicleIndex);

View File

@ -40,7 +40,7 @@ static void PaintSpaceRingsStructure(
if (ride.num_stations == 0 || vehicleIndex < ride.NumTrains)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
int32_t frameNum = direction;

View File

@ -61,7 +61,7 @@ static constexpr const uint32_t SwingingInverterShipFrameSprites[] = {
static void PaintSwingingInverterShipStructure(
PaintSession& session, const Ride& ride, uint8_t direction, int8_t axisOffset, uint16_t height)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
if (rideEntry == nullptr)
return;

View File

@ -86,7 +86,7 @@ static void PaintSwingingShipRiders(
static void PaintSwingingShipStructure(
PaintSession& session, const Ride& ride, uint8_t direction, int8_t axisOffset, uint16_t height)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
if (rideEntry == nullptr)
return;

View File

@ -23,7 +23,7 @@
static void PaintTwistStructure(
PaintSession& session, const Ride& ride, uint8_t direction, int8_t xOffset, int8_t yOffset, uint16_t height)
{
RideObjectEntry* rideEntry = GetRideEntryByIndex(ride.subtype);
const auto* rideEntry = GetRideEntryByIndex(ride.subtype);
Vehicle* vehicle = nullptr;
if (rideEntry == nullptr)