mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use ride references instead of pointers
This commit is contained in:
parent
6017983e8f
commit
412bf8f8be
|
@ -190,9 +190,9 @@ public:
|
|||
case WD_NEW_CAMPAIGN:
|
||||
return WindowNewCampaignOpen(id);
|
||||
case WD_DEMOLISH_RIDE:
|
||||
return WindowRideDemolishPromptOpen(get_ride(RideId::FromUnderlying(id)));
|
||||
return WindowRideDemolishPromptOpen(*get_ride(RideId::FromUnderlying(id)));
|
||||
case WD_REFURBISH_RIDE:
|
||||
return WindowRideRefurbishPromptOpen(get_ride(RideId::FromUnderlying(id)));
|
||||
return WindowRideRefurbishPromptOpen(*get_ride(RideId::FromUnderlying(id)));
|
||||
case WD_SIGN:
|
||||
return WindowSignOpen(id);
|
||||
case WD_SIGN_SMALL:
|
||||
|
@ -269,7 +269,7 @@ public:
|
|||
{
|
||||
const auto rideId = RideId::FromUnderlying(intent->GetSIntExtra(INTENT_EXTRA_RIDE_ID));
|
||||
auto ride = get_ride(rideId);
|
||||
return ride == nullptr ? nullptr : WindowRideMainOpen(ride);
|
||||
return ride == nullptr ? nullptr : WindowRideMainOpen(*ride);
|
||||
}
|
||||
case WindowClass::TrackDesignPlace:
|
||||
return WindowTrackPlaceOpen(
|
||||
|
|
|
@ -45,9 +45,9 @@ class DemolishRidePromptWindow final : public Window
|
|||
money32 _demolishRideCost;
|
||||
|
||||
public:
|
||||
void SetRide(Ride* currentRide)
|
||||
void SetRide(const Ride& currentRide)
|
||||
{
|
||||
rideId = currentRide->id;
|
||||
rideId = currentRide.id;
|
||||
_demolishRideCost = -ride_get_refund_price(currentRide);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
rct_window* WindowRideDemolishPromptOpen(Ride* ride)
|
||||
rct_window* WindowRideDemolishPromptOpen(const Ride& ride)
|
||||
{
|
||||
rct_window* w;
|
||||
DemolishRidePromptWindow* newWindow;
|
||||
|
|
|
@ -1242,7 +1242,7 @@ private:
|
|||
uint8_t currListPosition = 0;
|
||||
for (const auto& r : GetRideManager())
|
||||
{
|
||||
if (r.IsRide() && guest->HasRidden(&r))
|
||||
if (r.IsRide() && guest->HasRidden(r))
|
||||
{
|
||||
list_item_positions[currListPosition] = r.id.ToUnderlying();
|
||||
currListPosition++;
|
||||
|
|
|
@ -363,7 +363,7 @@ private:
|
|||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
|
||||
auto currentRide = get_ride(rideIndex);
|
||||
if (currentRide != nullptr && ride_are_all_possible_entrances_and_exits_built(currentRide).Successful)
|
||||
if (currentRide != nullptr && ride_are_all_possible_entrances_and_exits_built(*currentRide).Successful)
|
||||
{
|
||||
tool_cancel();
|
||||
if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
|
|
|
@ -44,9 +44,9 @@ class RefurbishRidePromptWindow final : public Window
|
|||
money32 _demolishRideCost;
|
||||
|
||||
public:
|
||||
void SetRide(Ride* currentRide)
|
||||
void SetRide(const Ride& currentRide)
|
||||
{
|
||||
rideId = currentRide->id;
|
||||
rideId = currentRide.id;
|
||||
_demolishRideCost = -ride_get_refund_price(currentRide);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
rct_window* WindowRideRefurbishPromptOpen(Ride* ride)
|
||||
rct_window* WindowRideRefurbishPromptOpen(const Ride& ride)
|
||||
{
|
||||
rct_window* w;
|
||||
RefurbishRidePromptWindow* newWindow;
|
||||
|
|
|
@ -72,7 +72,7 @@ static constexpr const StringId WINDOW_TITLE = STR_RIDE_WINDOW_TITLE;
|
|||
static constexpr const int32_t WH = 207;
|
||||
static constexpr const int32_t WW = 316;
|
||||
|
||||
static void PopulateVehicleTypeDropdown(Ride* ride, bool forceRefresh = false);
|
||||
static void PopulateVehicleTypeDropdown(const Ride& ride, bool forceRefresh = false);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -973,7 +973,7 @@ static void WindowRideDrawTabVehicle(rct_drawpixelinfo* dpi, rct_window* w)
|
|||
CarEntry* carEntry = &rideEntry->Cars[vehicle];
|
||||
|
||||
auto vehicleId = ((ride->colour_scheme_type & 3) == VEHICLE_COLOUR_SCHEME_PER_VEHICLE) ? rideEntry->TabCar : 0;
|
||||
VehicleColour vehicleColour = ride_get_vehicle_colour(ride, vehicleId);
|
||||
VehicleColour vehicleColour = ride_get_vehicle_colour(*ride, vehicleId);
|
||||
|
||||
// imageIndex represents a precision of 64
|
||||
auto imageIndex = OpenRCT2::Entity::Yaw::YawFrom4(2) * 2;
|
||||
|
@ -1088,7 +1088,7 @@ static void WindowRideDisableTabs(rct_window* w)
|
|||
w->disabled_widgets = disabled_tabs;
|
||||
}
|
||||
|
||||
static void WindowRideUpdateOverallView(Ride* ride)
|
||||
static void WindowRideUpdateOverallView(const Ride& ride)
|
||||
{
|
||||
// Calculate x, y, z bounds of the entire ride using its track elements
|
||||
tile_element_iterator it;
|
||||
|
@ -1105,7 +1105,7 @@ static void WindowRideUpdateOverallView(Ride* ride)
|
|||
if (it.element->GetType() != TileElementType::Track)
|
||||
continue;
|
||||
|
||||
if (it.element->AsTrack()->GetRideIndex() != ride->id)
|
||||
if (it.element->AsTrack()->GetRideIndex() != ride.id)
|
||||
continue;
|
||||
|
||||
auto location = TileCoordsXY(it.x, it.y).ToCoordsXY();
|
||||
|
@ -1121,7 +1121,7 @@ static void WindowRideUpdateOverallView(Ride* ride)
|
|||
max.z = std::max(max.z, clearZ);
|
||||
}
|
||||
|
||||
const auto rideIndex = ride->id.ToUnderlying();
|
||||
const auto rideIndex = ride.id.ToUnderlying();
|
||||
if (rideIndex >= ride_overall_views.size())
|
||||
{
|
||||
ride_overall_views.resize(rideIndex + 1);
|
||||
|
@ -1153,14 +1153,14 @@ static void WindowRideUpdateOverallView(Ride* ride)
|
|||
*
|
||||
* rct2: 0x006AEAB4
|
||||
*/
|
||||
static rct_window* WindowRideOpen(Ride* ride)
|
||||
static rct_window* WindowRideOpen(const Ride& ride)
|
||||
{
|
||||
rct_window* w;
|
||||
|
||||
w = WindowCreateAutoPos(316, 207, window_ride_page_events[0], WindowClass::Ride, WF_10 | WF_RESIZABLE);
|
||||
w->widgets = window_ride_page_widgets[WINDOW_RIDE_PAGE_MAIN];
|
||||
w->hold_down_widgets = window_ride_page_hold_down_widgets[WINDOW_RIDE_PAGE_MAIN];
|
||||
w->rideId = ride->id;
|
||||
w->rideId = ride.id;
|
||||
|
||||
w->page = WINDOW_RIDE_PAGE_MAIN;
|
||||
w->vehicleIndex = 0;
|
||||
|
@ -1185,21 +1185,21 @@ static rct_window* WindowRideOpen(Ride* ride)
|
|||
*
|
||||
* rct2: 0x006ACC28
|
||||
*/
|
||||
rct_window* WindowRideMainOpen(Ride* ride)
|
||||
rct_window* WindowRideMainOpen(const Ride& ride)
|
||||
{
|
||||
if (ride->type >= RIDE_TYPE_COUNT)
|
||||
if (ride.type >= RIDE_TYPE_COUNT)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rct_window* w = window_bring_to_front_by_number(WindowClass::Ride, ride->id.ToUnderlying());
|
||||
rct_window* w = window_bring_to_front_by_number(WindowClass::Ride, ride.id.ToUnderlying());
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowRideOpen(ride);
|
||||
w->ride.var_482 = -1;
|
||||
w->ride.view = 0;
|
||||
}
|
||||
else if (w->ride.view >= (1 + ride->NumTrains + ride->num_stations))
|
||||
else if (w->ride.view >= (1 + ride.NumTrains + ride.num_stations))
|
||||
{
|
||||
w->ride.view = 0;
|
||||
}
|
||||
|
@ -1225,15 +1225,15 @@ rct_window* WindowRideMainOpen(Ride* ride)
|
|||
*
|
||||
* rct2: 0x006ACCCE
|
||||
*/
|
||||
static rct_window* WindowRideOpenStation(Ride* ride, StationIndex stationIndex)
|
||||
static rct_window* WindowRideOpenStation(const Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
if (ride->type >= RIDE_TYPE_COUNT)
|
||||
if (ride.type >= RIDE_TYPE_COUNT)
|
||||
return nullptr;
|
||||
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
||||
return WindowRideMainOpen(ride);
|
||||
|
||||
auto w = window_bring_to_front_by_number(WindowClass::Ride, ride->id.ToUnderlying());
|
||||
auto w = window_bring_to_front_by_number(WindowClass::Ride, ride.id.ToUnderlying());
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowRideOpen(ride);
|
||||
|
@ -1261,13 +1261,13 @@ static rct_window* WindowRideOpenStation(Ride* ride, StationIndex stationIndex)
|
|||
// View
|
||||
for (int32_t i = stationIndex.ToUnderlying(); i >= 0; i--)
|
||||
{
|
||||
if (ride->GetStations()[i].Start.IsNull())
|
||||
if (ride.GetStations()[i].Start.IsNull())
|
||||
{
|
||||
stationIndex = StationIndex::FromUnderlying(stationIndex.ToUnderlying() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
w->ride.view = 1 + ride->NumTrains + stationIndex.ToUnderlying();
|
||||
w->ride.view = 1 + ride.NumTrains + stationIndex.ToUnderlying();
|
||||
WindowRideInitViewport(w);
|
||||
|
||||
return w;
|
||||
|
@ -1288,7 +1288,7 @@ rct_window* WindowRideOpenTrack(TileElement* tileElement)
|
|||
// Open ride window in station view
|
||||
auto entranceElement = tileElement->AsEntrance();
|
||||
auto stationIndex = entranceElement->GetStationIndex();
|
||||
return WindowRideOpenStation(ride, stationIndex);
|
||||
return WindowRideOpenStation(*ride, stationIndex);
|
||||
}
|
||||
else if (type == TileElementType::Track)
|
||||
{
|
||||
|
@ -1299,12 +1299,12 @@ rct_window* WindowRideOpenTrack(TileElement* tileElement)
|
|||
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
|
||||
{
|
||||
auto stationIndex = trackElement->GetStationIndex();
|
||||
return WindowRideOpenStation(ride, stationIndex);
|
||||
return WindowRideOpenStation(*ride, stationIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Open ride window in overview mode
|
||||
return WindowRideMainOpen(ride);
|
||||
return WindowRideMainOpen(*ride);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -1379,7 +1379,7 @@ rct_window* WindowRideOpenVehicle(Vehicle* vehicle)
|
|||
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowRideOpen(ride);
|
||||
w = WindowRideOpen(*ride);
|
||||
w->ride.var_482 = -1;
|
||||
}
|
||||
|
||||
|
@ -1785,18 +1785,17 @@ static void WindowRideShowViewDropdown(rct_window* w, Widget* widget)
|
|||
Dropdown::SetChecked(w->ride.view, true);
|
||||
}
|
||||
|
||||
static RideStatus WindowRideGetNextDefaultStatus(const Ride* ride)
|
||||
static RideStatus WindowRideGetNextDefaultStatus(const Ride& ride)
|
||||
{
|
||||
switch (ride->status)
|
||||
switch (ride.status)
|
||||
{
|
||||
default:
|
||||
case RideStatus::Closed:
|
||||
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
|
||||
|| (ride->lifecycle_flags & RIDE_LIFECYCLE_HAS_STALLED_VEHICLE))
|
||||
if ((ride.lifecycle_flags & RIDE_LIFECYCLE_CRASHED) || (ride.lifecycle_flags & RIDE_LIFECYCLE_HAS_STALLED_VEHICLE))
|
||||
{
|
||||
return RideStatus::Closed;
|
||||
}
|
||||
if (ride->SupportsStatus(RideStatus::Testing) && !(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
if (ride.SupportsStatus(RideStatus::Testing) && !(ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
{
|
||||
return RideStatus::Testing;
|
||||
}
|
||||
|
@ -1804,7 +1803,7 @@ static RideStatus WindowRideGetNextDefaultStatus(const Ride* ride)
|
|||
case RideStatus::Simulating:
|
||||
return RideStatus::Testing;
|
||||
case RideStatus::Testing:
|
||||
return (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) ? RideStatus::Open : RideStatus::Closed;
|
||||
return (ride.lifecycle_flags & RIDE_LIFECYCLE_TESTED) ? RideStatus::Open : RideStatus::Closed;
|
||||
case RideStatus::Open:
|
||||
return RideStatus::Closed;
|
||||
}
|
||||
|
@ -1848,7 +1847,7 @@ static void WindowRideShowOpenDropdown(rct_window* w, Widget* widget)
|
|||
return;
|
||||
|
||||
info.CurrentStatus = info.Ride->status;
|
||||
info.DefaultStatus = WindowRideGetNextDefaultStatus(info.Ride);
|
||||
info.DefaultStatus = WindowRideGetNextDefaultStatus(*info.Ride);
|
||||
WindowRideSetDropdown(info, RideStatus::Closed, STR_CLOSE_RIDE);
|
||||
#ifdef __SIMULATE_IN_RIDE_WINDOW__
|
||||
window_ride_set_dropdown(info, RideStatus::Simulating, STR_SIMULATE_RIDE);
|
||||
|
@ -1987,17 +1986,17 @@ static void WindowRideMainFollowRide(rct_window* w)
|
|||
}
|
||||
}
|
||||
|
||||
static void PopulateVehicleTypeDropdown(Ride* ride, bool forceRefresh)
|
||||
static void PopulateVehicleTypeDropdown(const Ride& ride, bool forceRefresh)
|
||||
{
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
||||
rct_ride_entry* rideEntry = ride.GetRideEntry();
|
||||
|
||||
bool selectionShouldBeExpanded;
|
||||
int32_t rideTypeIterator, rideTypeIteratorMax;
|
||||
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
const auto& rtd = ride.GetRideTypeDescriptor();
|
||||
if (gCheatsShowVehiclesFromOtherTrackTypes
|
||||
&& !(rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) || ride->type == RIDE_TYPE_MINI_GOLF))
|
||||
&& !(rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE) || ride.type == RIDE_TYPE_MINI_GOLF))
|
||||
{
|
||||
selectionShouldBeExpanded = true;
|
||||
rideTypeIterator = 0;
|
||||
|
@ -2006,8 +2005,8 @@ static void PopulateVehicleTypeDropdown(Ride* ride, bool forceRefresh)
|
|||
else
|
||||
{
|
||||
selectionShouldBeExpanded = false;
|
||||
rideTypeIterator = ride->type;
|
||||
rideTypeIteratorMax = ride->type;
|
||||
rideTypeIterator = ride.type;
|
||||
rideTypeIteratorMax = ride.type;
|
||||
}
|
||||
|
||||
// Don't repopulate the list if we just did.
|
||||
|
@ -2058,7 +2057,7 @@ static void WindowRideShowVehicleTypeDropdown(rct_window* w, Widget* widget)
|
|||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
PopulateVehicleTypeDropdown(ride);
|
||||
PopulateVehicleTypeDropdown(*ride);
|
||||
|
||||
size_t numItems = std::min<size_t>(VehicleDropdownData.size(), Dropdown::ItemsMaxSize);
|
||||
|
||||
|
@ -2992,7 +2991,7 @@ static void WindowRideVehicleScrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
vehicleColourIndex = j;
|
||||
break;
|
||||
}
|
||||
VehicleColour vehicleColour = ride_get_vehicle_colour(ride, vehicleColourIndex);
|
||||
VehicleColour vehicleColour = ride_get_vehicle_colour(*ride, vehicleColourIndex);
|
||||
|
||||
ImageIndex imageIndex = carEntry->SpriteByYaw(OpenRCT2::Entity::Yaw::BaseRotation / 2, SpriteGroupType::SlopeFlat);
|
||||
imageIndex &= carEntry->TabRotationMask;
|
||||
|
@ -3745,11 +3744,11 @@ static void WindowRideLocateMechanic(rct_window* w)
|
|||
return;
|
||||
|
||||
// First check if there is a mechanic assigned
|
||||
Peep* mechanic = ride_get_assigned_mechanic(ride);
|
||||
Peep* mechanic = ride_get_assigned_mechanic(*ride);
|
||||
|
||||
// Otherwise find the closest mechanic
|
||||
if (mechanic == nullptr)
|
||||
mechanic = ride_find_closest_mechanic(ride, 1);
|
||||
mechanic = ride_find_closest_mechanic(*ride, 1);
|
||||
|
||||
if (mechanic == nullptr)
|
||||
ContextShowError(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {});
|
||||
|
@ -4024,7 +4023,7 @@ static void WindowRideMaintenanceDropdown(rct_window* w, WidgetIndex widgetIndex
|
|||
num_items++;
|
||||
}
|
||||
}
|
||||
ride_prepare_breakdown(ride, i);
|
||||
ride_prepare_breakdown(*ride, i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -4218,13 +4217,13 @@ static void WindowRideMaintenancePaint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
#pragma region Colour
|
||||
|
||||
static int32_t WindowRideHasTrackColour(Ride* ride, int32_t trackColour)
|
||||
static int32_t WindowRideHasTrackColour(const Ride& ride, int32_t trackColour)
|
||||
{
|
||||
// Get station flags (shops don't have them)
|
||||
auto stationObjFlags = 0;
|
||||
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY))
|
||||
if (!ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY))
|
||||
{
|
||||
auto stationObj = ride->GetStationObject();
|
||||
auto stationObj = ride.GetStationObject();
|
||||
if (stationObj != nullptr)
|
||||
{
|
||||
stationObjFlags = stationObj->Flags;
|
||||
|
@ -4235,12 +4234,12 @@ static int32_t WindowRideHasTrackColour(Ride* ride, int32_t trackColour)
|
|||
{
|
||||
case 0:
|
||||
return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_PRIMARY_COLOUR)
|
||||
|| ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN);
|
||||
|| ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_MAIN);
|
||||
case 1:
|
||||
return (stationObjFlags & STATION_OBJECT_FLAGS::HAS_SECONDARY_COLOUR)
|
||||
|| ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL);
|
||||
|| ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_ADDITIONAL);
|
||||
case 2:
|
||||
return ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS);
|
||||
return ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_TRACK_COLOUR_SUPPORTS);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -4453,15 +4452,15 @@ static void WindowRideColourMousedown(rct_window* w, WidgetIndex widgetIndex, Wi
|
|||
Dropdown::SetChecked(w->vehicleIndex, true);
|
||||
break;
|
||||
case WIDX_VEHICLE_BODY_COLOUR:
|
||||
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
||||
vehicleColour = ride_get_vehicle_colour(*ride, w->vehicleIndex);
|
||||
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Body);
|
||||
break;
|
||||
case WIDX_VEHICLE_TRIM_COLOUR:
|
||||
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
||||
vehicleColour = ride_get_vehicle_colour(*ride, w->vehicleIndex);
|
||||
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Trim);
|
||||
break;
|
||||
case WIDX_VEHICLE_TERNARY_COLOUR:
|
||||
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
||||
vehicleColour = ride_get_vehicle_colour(*ride, w->vehicleIndex);
|
||||
WindowDropdownShowColour(w, widget, w->colours[1], vehicleColour.Tertiary);
|
||||
break;
|
||||
}
|
||||
|
@ -4669,7 +4668,7 @@ static void WindowRideColourInvalidate(rct_window* w)
|
|||
}
|
||||
|
||||
// Track main colour
|
||||
if (WindowRideHasTrackColour(ride, 0))
|
||||
if (WindowRideHasTrackColour(*ride, 0))
|
||||
{
|
||||
window_ride_colour_widgets[WIDX_TRACK_MAIN_COLOUR].type = WindowWidgetType::ColourBtn;
|
||||
window_ride_colour_widgets[WIDX_TRACK_MAIN_COLOUR].image = GetColourButtonImage(trackColour.main);
|
||||
|
@ -4680,7 +4679,7 @@ static void WindowRideColourInvalidate(rct_window* w)
|
|||
}
|
||||
|
||||
// Track additional colour
|
||||
if (WindowRideHasTrackColour(ride, 1))
|
||||
if (WindowRideHasTrackColour(*ride, 1))
|
||||
{
|
||||
window_ride_colour_widgets[WIDX_TRACK_ADDITIONAL_COLOUR].type = WindowWidgetType::ColourBtn;
|
||||
window_ride_colour_widgets[WIDX_TRACK_ADDITIONAL_COLOUR].image = GetColourButtonImage(trackColour.additional);
|
||||
|
@ -4709,7 +4708,7 @@ static void WindowRideColourInvalidate(rct_window* w)
|
|||
}
|
||||
|
||||
// Track supports colour
|
||||
if (WindowRideHasTrackColour(ride, 2) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
if (WindowRideHasTrackColour(*ride, 2) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
{
|
||||
window_ride_colour_widgets[WIDX_TRACK_SUPPORT_COLOUR].type = WindowWidgetType::ColourBtn;
|
||||
window_ride_colour_widgets[WIDX_TRACK_SUPPORT_COLOUR].image = GetColourButtonImage(trackColour.supports);
|
||||
|
@ -4757,7 +4756,7 @@ static void WindowRideColourInvalidate(rct_window* w)
|
|||
if (vehicleColourSchemeType == 0)
|
||||
w->vehicleIndex = 0;
|
||||
|
||||
vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
||||
vehicleColour = ride_get_vehicle_colour(*ride, w->vehicleIndex);
|
||||
|
||||
window_ride_colour_widgets[WIDX_VEHICLE_PREVIEW].type = WindowWidgetType::Scroll;
|
||||
window_ride_colour_widgets[WIDX_VEHICLE_BODY_COLOUR].type = WindowWidgetType::ColourBtn;
|
||||
|
@ -4990,7 +4989,7 @@ static void WindowRideColourScrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
|
|||
return;
|
||||
|
||||
auto vehiclePreviewWidget = &window_ride_colour_widgets[WIDX_VEHICLE_PREVIEW];
|
||||
auto vehicleColour = ride_get_vehicle_colour(ride, w->vehicleIndex);
|
||||
auto vehicleColour = ride_get_vehicle_colour(*ride, w->vehicleIndex);
|
||||
|
||||
// Background colour
|
||||
gfx_fill_rect(dpi, { { dpi->x, dpi->y }, { dpi->x + dpi->width - 1, dpi->y + dpi->height - 1 } }, PALETTE_INDEX_12);
|
||||
|
@ -5656,7 +5655,7 @@ static void WindowRideMeasurementsPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto ft = Formatter();
|
||||
ft.Add<uint32_t>(ride->excitement);
|
||||
ft.Add<StringId>(ratingName);
|
||||
StringId stringId = !ride_has_ratings(ride) ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING;
|
||||
StringId stringId = !ride_has_ratings(*ride) ? STR_EXCITEMENT_RATING_NOT_YET_AVAILABLE : STR_EXCITEMENT_RATING;
|
||||
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
||||
|
@ -5667,7 +5666,7 @@ static void WindowRideMeasurementsPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ft.Add<StringId>(ratingName);
|
||||
|
||||
stringId = STR_INTENSITY_RATING;
|
||||
if (!ride_has_ratings(ride))
|
||||
if (!ride_has_ratings(*ride))
|
||||
stringId = STR_INTENSITY_RATING_NOT_YET_AVAILABLE;
|
||||
else if (ride->intensity >= RIDE_RATING(10, 00))
|
||||
stringId = STR_INTENSITY_RATING_RED;
|
||||
|
@ -5680,7 +5679,7 @@ static void WindowRideMeasurementsPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ft = Formatter();
|
||||
ft.Add<uint32_t>(ride->nausea);
|
||||
ft.Add<StringId>(ratingName);
|
||||
stringId = !ride_has_ratings(ride) ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING;
|
||||
stringId = !ride_has_ratings(*ride) ? STR_NAUSEA_RATING_NOT_YET_AVAILABLE : STR_NAUSEA_RATING;
|
||||
DrawTextBasic(dpi, screenCoords, stringId, ft);
|
||||
screenCoords.y += 2 * LIST_ROW_HEIGHT;
|
||||
|
||||
|
@ -6660,7 +6659,7 @@ static void WindowRideIncomeInvalidate(rct_window* w)
|
|||
window_ride_income_widgets[WIDX_PRIMARY_PRICE_SAME_THROUGHOUT_PARK].type = WindowWidgetType::Empty;
|
||||
|
||||
window_ride_income_widgets[WIDX_PRIMARY_PRICE].text = STR_BOTTOM_TOOLBAR_CASH;
|
||||
money16 ridePrimaryPrice = ride_get_price(ride);
|
||||
money16 ridePrimaryPrice = ride_get_price(*ride);
|
||||
ft.Rewind();
|
||||
ft.Add<money64>(ridePrimaryPrice);
|
||||
if (ridePrimaryPrice == 0)
|
||||
|
@ -6983,7 +6982,7 @@ static void WindowRideCustomerPaint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
// Customers per hour
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(ride_customers_per_hour(ride));
|
||||
ft.Add<int32_t>(ride_customers_per_hour(*ride));
|
||||
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, ft);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
||||
|
|
|
@ -170,10 +170,10 @@ static constexpr const StringId RideConstructionSeatAngleRotationStrings[] = {
|
|||
|
||||
static void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZD& piecePos, int32_t type);
|
||||
|
||||
static int32_t RideGetAlternativeType(Ride* ride)
|
||||
static int32_t RideGetAlternativeType(const Ride& ride)
|
||||
{
|
||||
return (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE) ? ride->GetRideTypeDescriptor().AlternateType
|
||||
: ride->type;
|
||||
return (_currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_TYPE) ? ride.GetRideTypeDescriptor().AlternateType
|
||||
: ride.type;
|
||||
}
|
||||
|
||||
/* move to ride.c */
|
||||
|
@ -186,7 +186,7 @@ static void CloseRideWindowForConstruction(RideId rideId)
|
|||
|
||||
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActions::Result* result);
|
||||
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result);
|
||||
static void CloseConstructWindowOnCompletion(Ride* ride);
|
||||
static void CloseConstructWindowOnCompletion(const Ride& ride);
|
||||
|
||||
class RideConstructionWindow final : public Window
|
||||
{
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
if (ride_try_get_origin_element(currentRide, nullptr))
|
||||
if (ride_try_get_origin_element(*currentRide, nullptr))
|
||||
{
|
||||
// Auto open shops if required.
|
||||
if (currentRide->mode == RideMode::ShopStall && gConfigGeneral.AutoOpenShops)
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
int32_t rideType = RideGetAlternativeType(currentRide);
|
||||
int32_t rideType = RideGetAlternativeType(*currentRide);
|
||||
|
||||
uint64_t disabledWidgets = 0;
|
||||
|
||||
|
@ -1531,7 +1531,7 @@ public:
|
|||
{
|
||||
return;
|
||||
}
|
||||
int32_t rideType = RideGetAlternativeType(currentRide);
|
||||
int32_t rideType = RideGetAlternativeType(*currentRide);
|
||||
|
||||
hold_down_widgets = 0;
|
||||
if (GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY) || !currentRide->HasStation())
|
||||
|
@ -2372,7 +2372,7 @@ private:
|
|||
const auto& rtd = currentRide->GetRideTypeDescriptor();
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) && !rtd.HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY))
|
||||
{
|
||||
ride_initialise_construction_window(currentRide);
|
||||
ride_initialise_construction_window(*currentRide);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2412,9 +2412,9 @@ private:
|
|||
if (tool_set(*this, WIDX_ENTRANCE, Tool::Crosshair))
|
||||
{
|
||||
auto currentRide = get_ride(_currentRideIndex);
|
||||
if (currentRide != nullptr && !ride_try_get_origin_element(currentRide, nullptr))
|
||||
if (currentRide != nullptr && !ride_try_get_origin_element(*currentRide, nullptr))
|
||||
{
|
||||
ride_initialise_construction_window(currentRide);
|
||||
ride_initialise_construction_window(*currentRide);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2438,9 +2438,9 @@ private:
|
|||
if (tool_set(*this, WIDX_EXIT, Tool::Crosshair))
|
||||
{
|
||||
auto currentRide = get_ride(_currentRideIndex);
|
||||
if (!ride_try_get_origin_element(currentRide, nullptr))
|
||||
if (!ride_try_get_origin_element(*currentRide, nullptr))
|
||||
{
|
||||
ride_initialise_construction_window(currentRide);
|
||||
ride_initialise_construction_window(*currentRide);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2569,7 +2569,7 @@ private:
|
|||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
|
||||
auto currentRide = get_ride(gRideEntranceExitPlaceRideIndex);
|
||||
if (currentRide != nullptr && ride_are_all_possible_entrances_and_exits_built(currentRide).Successful)
|
||||
if (currentRide != nullptr && ride_are_all_possible_entrances_and_exits_built(*currentRide).Successful)
|
||||
{
|
||||
tool_cancel();
|
||||
if (currentRide->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
|
@ -2788,7 +2788,7 @@ rct_window* WindowRideConstructionOpen()
|
|||
return WindowCreate<RideConstructionWindow>(WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
static void CloseConstructWindowOnCompletion(Ride* ride)
|
||||
static void CloseConstructWindowOnCompletion(const Ride& ride)
|
||||
{
|
||||
if (_rideConstructionState == RideConstructionState::State0)
|
||||
{
|
||||
|
@ -2821,7 +2821,7 @@ static void window_ride_construction_do_entrance_exit_check()
|
|||
w = window_find_by_class(WindowClass::RideConstruction);
|
||||
if (w != nullptr)
|
||||
{
|
||||
if (!ride_are_all_possible_entrances_and_exits_built(ride).Successful)
|
||||
if (!ride_are_all_possible_entrances_and_exits_built(*ride).Successful)
|
||||
{
|
||||
window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE);
|
||||
}
|
||||
|
@ -2847,7 +2847,7 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
|
|||
}
|
||||
|
||||
CoordsXYE next_track;
|
||||
if (track_block_get_next_from_zero(trackPos, ride, trackDirection, &next_track, &trackPos.z, &trackDirection, false))
|
||||
if (track_block_get_next_from_zero(trackPos, *ride, trackDirection, &next_track, &trackPos.z, &trackDirection, false))
|
||||
{
|
||||
_currentTrackBegin.x = next_track.x;
|
||||
_currentTrackBegin.y = next_track.y;
|
||||
|
@ -2870,7 +2870,8 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
|
|||
}
|
||||
|
||||
window_close_by_class(WindowClass::Error);
|
||||
CloseConstructWindowOnCompletion(ride);
|
||||
if (ride != nullptr)
|
||||
CloseConstructWindowOnCompletion(*ride);
|
||||
}
|
||||
|
||||
static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga, const GameActions::Result* result)
|
||||
|
@ -2891,7 +2892,7 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
|
|||
}
|
||||
|
||||
track_begin_end trackBeginEnd;
|
||||
if (track_block_get_previous_from_zero(trackPos, ride, trackDirection, &trackBeginEnd))
|
||||
if (track_block_get_previous_from_zero(trackPos, *ride, trackDirection, &trackBeginEnd))
|
||||
{
|
||||
_currentTrackBegin.x = trackBeginEnd.begin_x;
|
||||
_currentTrackBegin.y = trackBeginEnd.begin_y;
|
||||
|
@ -2913,7 +2914,8 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
|
|||
}
|
||||
|
||||
window_close_by_class(WindowClass::Error);
|
||||
CloseConstructWindowOnCompletion(ride);
|
||||
if (ride != nullptr)
|
||||
CloseConstructWindowOnCompletion(*ride);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3078,7 +3080,7 @@ void WindowRideConstructionUpdateEnabledTrackPieces()
|
|||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
int32_t rideType = RideGetAlternativeType(ride);
|
||||
int32_t rideType = RideGetAlternativeType(*ride);
|
||||
UpdateEnabledRidePieces(rideType);
|
||||
}
|
||||
|
||||
|
@ -3461,7 +3463,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor
|
|||
if (ride != nullptr)
|
||||
{
|
||||
_currentTrackPrice = RideEntranceExitPlaceGhost(
|
||||
ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum);
|
||||
*ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum);
|
||||
}
|
||||
window_ride_construction_update_active_elements();
|
||||
}
|
||||
|
@ -3653,7 +3655,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords)
|
|||
int32_t saveCurrentTrackAlternative = _currentTrackAlternative;
|
||||
int32_t saveCurrentTrackLiftHill = _currentTrackLiftHill;
|
||||
|
||||
ride_initialise_construction_window(ride);
|
||||
ride_initialise_construction_window(*ride);
|
||||
|
||||
_currentTrackPieceDirection = saveTrackDirection;
|
||||
_currentTrackCurve = saveCurrentTrackCurve;
|
||||
|
@ -4562,9 +4564,9 @@ static void window_ride_construction_mouseup_demolish_next_piece(const CoordsXYZ
|
|||
ride_construction_set_default_next_piece();
|
||||
window_ride_construction_update_active_elements();
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (!ride_try_get_origin_element(ride, nullptr))
|
||||
if (!ride_try_get_origin_element(*ride, nullptr))
|
||||
{
|
||||
ride_initialise_construction_window(ride);
|
||||
ride_initialise_construction_window(*ride);
|
||||
_currentTrackPieceDirection = piecePos.direction & 3;
|
||||
if (!(savedCurrentTrackCurve & RideConstructionSpecialPieceSelected))
|
||||
{
|
||||
|
|
|
@ -607,7 +607,7 @@ public:
|
|||
break;
|
||||
case INFORMATION_TYPE_CUSTOMERS:
|
||||
formatSecondary = STR_RIDE_LIST_CUSTOMERS_PER_HOUR_LABEL;
|
||||
ft.Add<uint32_t>(ride_customers_per_hour(ridePtr));
|
||||
ft.Add<uint32_t>(ride_customers_per_hour(*ridePtr));
|
||||
break;
|
||||
case INFORMATION_TYPE_AGE:
|
||||
{
|
||||
|
@ -696,7 +696,7 @@ public:
|
|||
break;
|
||||
case INFORMATION_TYPE_EXCITEMENT:
|
||||
formatSecondary = STR_RATING_UKNOWN_LABEL;
|
||||
if (ride_has_ratings(ridePtr))
|
||||
if (ride_has_ratings(*ridePtr))
|
||||
{
|
||||
formatSecondary = STR_EXCITEMENT_LABEL;
|
||||
ft.Add<uint16_t>(ridePtr->excitement);
|
||||
|
@ -704,7 +704,7 @@ public:
|
|||
break;
|
||||
case INFORMATION_TYPE_INTENSITY:
|
||||
formatSecondary = STR_RATING_UKNOWN_LABEL;
|
||||
if (ride_has_ratings(ridePtr))
|
||||
if (ride_has_ratings(*ridePtr))
|
||||
{
|
||||
formatSecondary = STR_INTENSITY_LABEL;
|
||||
ft.Add<uint16_t>(ridePtr->intensity);
|
||||
|
@ -712,7 +712,7 @@ public:
|
|||
break;
|
||||
case INFORMATION_TYPE_NAUSEA:
|
||||
formatSecondary = STR_RATING_UKNOWN_LABEL;
|
||||
if (ride_has_ratings(ridePtr))
|
||||
if (ride_has_ratings(*ridePtr))
|
||||
{
|
||||
formatSecondary = STR_NAUSEA_LABEL;
|
||||
ft.Add<uint16_t>(ridePtr->nausea);
|
||||
|
@ -796,7 +796,7 @@ private:
|
|||
for (auto& rideRef : GetRideManager())
|
||||
{
|
||||
if (rideRef.GetClassification() != static_cast<RideClassification>(page)
|
||||
|| (rideRef.status == RideStatus::Closed && !ride_has_any_track_elements(&rideRef)))
|
||||
|| (rideRef.status == RideStatus::Closed && !ride_has_any_track_elements(rideRef)))
|
||||
continue;
|
||||
|
||||
if (rideRef.window_invalidate_flags & RIDE_INVALIDATE_RIDE_LIST)
|
||||
|
@ -847,7 +847,7 @@ private:
|
|||
case INFORMATION_TYPE_CUSTOMERS:
|
||||
currentListPosition = SortList(
|
||||
currentListPosition, rideRef, [](const Ride& thisRide, const Ride& otherRide) -> bool {
|
||||
return ride_customers_per_hour(&thisRide) <= ride_customers_per_hour(&otherRide);
|
||||
return ride_customers_per_hour(thisRide) <= ride_customers_per_hour(otherRide);
|
||||
});
|
||||
break;
|
||||
case INFORMATION_TYPE_AGE:
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
if (mapCoords == _placementLoc)
|
||||
{
|
||||
TrackDesignPreviewDrawOutlines(
|
||||
tds, _trackDesign.get(), GetOrAllocateRide(PreviewRideId), { mapCoords, 0, _currentTrackPieceDirection });
|
||||
tds, _trackDesign.get(), *GetOrAllocateRide(PreviewRideId), { mapCoords, 0, _currentTrackPieceDirection });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
widget_invalidate(*this, WIDX_PRICE);
|
||||
}
|
||||
|
||||
TrackDesignPreviewDrawOutlines(tds, _trackDesign.get(), GetOrAllocateRide(PreviewRideId), trackLoc);
|
||||
TrackDesignPreviewDrawOutlines(tds, _trackDesign.get(), *GetOrAllocateRide(PreviewRideId), trackLoc);
|
||||
}
|
||||
|
||||
void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
ride_initialise_construction_window(getRide);
|
||||
ride_initialise_construction_window(*getRide);
|
||||
auto wnd = window_find_by_class(WindowClass::RideConstruction);
|
||||
window_event_mouse_up_call(wnd, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ public:
|
|||
auto provRide = get_ride(_placementGhostRideId);
|
||||
if (provRide != nullptr)
|
||||
{
|
||||
TrackDesignPreviewRemoveGhosts(_trackDesign.get(), provRide, _placementGhostLoc);
|
||||
TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *provRide, _placementGhostLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ private:
|
|||
auto newRide = get_ride(_placementGhostRideId);
|
||||
if (newRide != nullptr)
|
||||
{
|
||||
TrackDesignPreviewRemoveGhosts(_trackDesign.get(), newRide, _placementGhostLoc);
|
||||
TrackDesignPreviewRemoveGhosts(_trackDesign.get(), *newRide, _placementGhostLoc);
|
||||
_hasPlacementGhost = false;
|
||||
}
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ private:
|
|||
|
||||
return z
|
||||
+ TrackDesignGetZPlacement(
|
||||
_trackDesign.get(), GetOrAllocateRide(PreviewRideId), { loc, z, _currentTrackPieceDirection });
|
||||
_trackDesign.get(), *GetOrAllocateRide(PreviewRideId), { loc, z, _currentTrackPieceDirection });
|
||||
}
|
||||
|
||||
void DrawMiniPreviewTrack(TrackDesign* td6, int32_t pass, const CoordsXY& origin, CoordsXY min, CoordsXY max)
|
||||
|
|
|
@ -89,8 +89,8 @@ rct_window* WindowParkObjectiveOpen();
|
|||
rct_window* WindowParkRatingOpen();
|
||||
|
||||
rct_window* WindowBannerOpen(rct_windownumber number);
|
||||
rct_window* WindowRideDemolishPromptOpen(Ride* ride);
|
||||
rct_window* WindowRideRefurbishPromptOpen(Ride* ride);
|
||||
rct_window* WindowRideDemolishPromptOpen(const Ride& ride);
|
||||
rct_window* WindowRideRefurbishPromptOpen(const Ride& ride);
|
||||
rct_window* WindowSignOpen(rct_windownumber number);
|
||||
rct_window* WindowSignSmallOpen(rct_windownumber number);
|
||||
rct_window* WindowPlayerOpen(uint8_t id);
|
||||
|
@ -131,7 +131,7 @@ void WindowNewRideFocus(RideSelection rideItem);
|
|||
rct_window* WindowRideListOpen();
|
||||
void WindowRideListRefreshList(rct_window* w);
|
||||
|
||||
rct_window* WindowRideMainOpen(Ride* ride);
|
||||
rct_window* WindowRideMainOpen(const Ride& ride);
|
||||
rct_window* WindowRideOpenTrack(TileElement* tileElement);
|
||||
rct_window* WindowRideOpenVehicle(Vehicle* vehicle);
|
||||
void WindowRideMeasurementsDesignCancel();
|
||||
|
|
|
@ -382,7 +382,7 @@ void game_fix_save_vars()
|
|||
log_warning(
|
||||
"Peep %u (%s) has invalid ride station = %u for ride %u.", peep->sprite_index, curName.c_str(),
|
||||
srcStation.ToUnderlying(), rideIdx);
|
||||
auto station = ride_get_first_valid_station_exit(ride);
|
||||
auto station = ride_get_first_valid_station_exit(*ride);
|
||||
if (station.IsNull())
|
||||
{
|
||||
log_warning("Couldn't find station, removing peep %u", peep->sprite_index);
|
||||
|
|
|
@ -450,13 +450,13 @@ void CheatSetAction::FixBrokenRides() const
|
|||
if ((ride.mechanic_status != RIDE_MECHANIC_STATUS_FIXING)
|
||||
&& (ride.lifecycle_flags & (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN)))
|
||||
{
|
||||
auto mechanic = ride_get_assigned_mechanic(&ride);
|
||||
auto mechanic = ride_get_assigned_mechanic(ride);
|
||||
if (mechanic != nullptr)
|
||||
{
|
||||
mechanic->RemoveFromRide();
|
||||
}
|
||||
|
||||
ride_fix_breakdown(&ride, 0);
|
||||
ride_fix_breakdown(ride, 0);
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ GameActions::Result RideCreateAction::Execute() const
|
|||
{
|
||||
if (shop_item_has_common_price(ShopItem::Admission))
|
||||
{
|
||||
money32 price = ride_get_common_price(ride);
|
||||
money32 price = ride_get_common_price(*ride);
|
||||
if (price != MONEY32_UNDEFINED)
|
||||
{
|
||||
ride->price[0] = static_cast<money16>(price);
|
||||
|
@ -318,7 +318,7 @@ GameActions::Result RideCreateAction::Execute() const
|
|||
ride->mode = ride->GetDefaultMode();
|
||||
ride->MinCarsPerTrain = rideEntry->min_cars_in_train;
|
||||
ride->MaxCarsPerTrain = rideEntry->max_cars_in_train;
|
||||
ride_set_vehicle_colours_to_random_preset(ride, _colour2);
|
||||
ride_set_vehicle_colours_to_random_preset(*ride, _colour2);
|
||||
window_invalidate_by_class(WindowClass::RideList);
|
||||
|
||||
res.Expenditure = ExpenditureType::RideConstruction;
|
||||
|
|
|
@ -93,7 +93,7 @@ GameActions::Result RideDemolishAction::Query() const
|
|||
}
|
||||
|
||||
result.ErrorTitle = STR_CANT_REFURBISH_RIDE;
|
||||
result.Cost = GetRefurbishPrice(ride);
|
||||
result.Cost = GetRefurbishPrice(*ride);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -111,34 +111,34 @@ GameActions::Result RideDemolishAction::Execute() const
|
|||
switch (_modifyType)
|
||||
{
|
||||
case RIDE_MODIFY_DEMOLISH:
|
||||
return DemolishRide(ride);
|
||||
return DemolishRide(*ride);
|
||||
case RIDE_MODIFY_RENEW:
|
||||
return RefurbishRide(ride);
|
||||
return RefurbishRide(*ride);
|
||||
}
|
||||
|
||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_DO_THIS, STR_NONE);
|
||||
}
|
||||
|
||||
GameActions::Result RideDemolishAction::DemolishRide(Ride* ride) const
|
||||
GameActions::Result RideDemolishAction::DemolishRide(Ride& ride) const
|
||||
{
|
||||
money32 refundPrice = DemolishTracks();
|
||||
|
||||
ride_clear_for_construction(ride);
|
||||
ride->RemovePeeps();
|
||||
ride->StopGuestsQueuing();
|
||||
ride.RemovePeeps();
|
||||
ride.StopGuestsQueuing();
|
||||
|
||||
ride->ValidateStations();
|
||||
ride.ValidateStations();
|
||||
ride_clear_leftover_entrances(ride);
|
||||
|
||||
const auto rideId = ride->id;
|
||||
const auto rideId = ride.id;
|
||||
News::DisableNewsItems(News::ItemType::Ride, rideId.ToUnderlying());
|
||||
|
||||
UnlinkAllBannersForRide(ride->id);
|
||||
UnlinkAllBannersForRide(ride.id);
|
||||
|
||||
RideUse::GetHistory().RemoveValue(ride->id);
|
||||
RideUse::GetHistory().RemoveValue(ride.id);
|
||||
for (auto peep : EntityList<Guest>())
|
||||
{
|
||||
peep->RemoveRideFromMemory(ride->id);
|
||||
peep->RemoveRideFromMemory(ride.id);
|
||||
}
|
||||
|
||||
MarketingCancelCampaignsForRide(_rideIndex);
|
||||
|
@ -147,13 +147,13 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride* ride) const
|
|||
res.Expenditure = ExpenditureType::RideConstruction;
|
||||
res.Cost = refundPrice;
|
||||
|
||||
if (!ride->overall_view.IsNull())
|
||||
if (!ride.overall_view.IsNull())
|
||||
{
|
||||
auto xy = ride->overall_view.ToTileCentre();
|
||||
auto xy = ride.overall_view.ToTileCentre();
|
||||
res.Position = { xy, TileElementHeight(xy) };
|
||||
}
|
||||
|
||||
ride->Delete();
|
||||
ride.Delete();
|
||||
gParkValue = GetContext()->GetGameState()->GetPark().CalculateParkValue();
|
||||
|
||||
// Close windows related to the demolished ride
|
||||
|
@ -265,22 +265,22 @@ money32 RideDemolishAction::DemolishTracks() const
|
|||
return refundPrice;
|
||||
}
|
||||
|
||||
GameActions::Result RideDemolishAction::RefurbishRide(Ride* ride) const
|
||||
GameActions::Result RideDemolishAction::RefurbishRide(Ride& ride) const
|
||||
{
|
||||
auto res = GameActions::Result();
|
||||
res.Expenditure = ExpenditureType::RideConstruction;
|
||||
res.Cost = GetRefurbishPrice(ride);
|
||||
|
||||
ride->Renew();
|
||||
ride.Renew();
|
||||
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_EVER_BEEN_OPENED;
|
||||
ride->last_crash_type = RIDE_CRASH_TYPE_NONE;
|
||||
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_EVER_BEEN_OPENED;
|
||||
ride.last_crash_type = RIDE_CRASH_TYPE_NONE;
|
||||
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE | RIDE_INVALIDATE_RIDE_CUSTOMER;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE | RIDE_INVALIDATE_RIDE_CUSTOMER;
|
||||
|
||||
if (!ride->overall_view.IsNull())
|
||||
if (!ride.overall_view.IsNull())
|
||||
{
|
||||
auto location = ride->overall_view.ToTileCentre();
|
||||
auto location = ride.overall_view.ToTileCentre();
|
||||
res.Position = { location, TileElementHeight(location) };
|
||||
}
|
||||
|
||||
|
@ -289,12 +289,12 @@ GameActions::Result RideDemolishAction::RefurbishRide(Ride* ride) const
|
|||
return res;
|
||||
}
|
||||
|
||||
money32 RideDemolishAction::GetRefurbishPrice(const Ride* ride) const
|
||||
money32 RideDemolishAction::GetRefurbishPrice(const Ride& ride) const
|
||||
{
|
||||
return -GetRefundPrice(ride) / 2;
|
||||
}
|
||||
|
||||
money32 RideDemolishAction::GetRefundPrice(const Ride* ride) const
|
||||
money32 RideDemolishAction::GetRefundPrice(const Ride& ride) const
|
||||
{
|
||||
return ride_get_refund_price(ride);
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ public:
|
|||
GameActions::Result Execute() const override;
|
||||
|
||||
private:
|
||||
GameActions::Result DemolishRide(Ride* ride) const;
|
||||
GameActions::Result DemolishRide(Ride& ride) const;
|
||||
money32 MazeRemoveTrack(const CoordsXYZD& coords) const;
|
||||
money32 DemolishTracks() const;
|
||||
GameActions::Result RefurbishRide(Ride* ride) const;
|
||||
money32 GetRefurbishPrice(const Ride* ride) const;
|
||||
money32 GetRefundPrice(const Ride* ride) const;
|
||||
GameActions::Result RefurbishRide(Ride& ride) const;
|
||||
money32 GetRefurbishPrice(const Ride& ride) const;
|
||||
money32 GetRefundPrice(const Ride& ride) const;
|
||||
};
|
||||
|
|
|
@ -142,7 +142,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const
|
|||
|
||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
}
|
||||
|
||||
|
|
|
@ -119,9 +119,9 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const
|
|||
const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||
if (!isGhost)
|
||||
{
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
}
|
||||
|
||||
auto* entranceElement = FindEntranceElement(
|
||||
|
|
|
@ -114,15 +114,15 @@ GameActions::Result RideSetAppearanceAction::Execute() const
|
|||
break;
|
||||
case RideSetAppearanceType::VehicleColourBody:
|
||||
ride->vehicle_colours[_index].Body = _value;
|
||||
ride_update_vehicle_colours(ride);
|
||||
ride_update_vehicle_colours(*ride);
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourTrim:
|
||||
ride->vehicle_colours[_index].Trim = _value;
|
||||
ride_update_vehicle_colours(ride);
|
||||
ride_update_vehicle_colours(*ride);
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourTernary:
|
||||
ride->vehicle_colours[_index].Tertiary = _value;
|
||||
ride_update_vehicle_colours(ride);
|
||||
ride_update_vehicle_colours(*ride);
|
||||
break;
|
||||
case RideSetAppearanceType::VehicleColourScheme:
|
||||
ride->colour_scheme_type &= ~(
|
||||
|
@ -132,7 +132,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const
|
|||
{
|
||||
ride->vehicle_colours[i] = ride->vehicle_colours[0];
|
||||
}
|
||||
ride_update_vehicle_colours(ride);
|
||||
ride_update_vehicle_colours(*ride);
|
||||
break;
|
||||
case RideSetAppearanceType::EntranceStyle:
|
||||
ride->entrance_style = _value;
|
||||
|
|
|
@ -64,7 +64,7 @@ GameActions::Result RideSetSettingAction::Query() const
|
|||
GameActions::Status::Disallowed, STR_CANT_CHANGE_OPERATING_MODE, STR_MUST_BE_CLOSED_FIRST);
|
||||
}
|
||||
|
||||
if (!ride_is_mode_valid(ride) && !gCheatsShowAllOperatingModes)
|
||||
if (!ride_is_mode_valid(*ride) && !gCheatsShowAllOperatingModes)
|
||||
{
|
||||
log_warning("Invalid ride mode: %u", _value);
|
||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
|
||||
|
@ -87,11 +87,11 @@ GameActions::Result RideSetSettingAction::Query() const
|
|||
}
|
||||
break;
|
||||
case RideSetSetting::Operation:
|
||||
if (!ride_is_valid_operation_option(ride))
|
||||
if (!ride_is_valid_operation_option(*ride))
|
||||
{
|
||||
log_warning("Invalid operation option value: %u", _value);
|
||||
return GameActions::Result(
|
||||
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, GetOperationErrorMessage(ride));
|
||||
GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, GetOperationErrorMessage(*ride));
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::InspectionInterval:
|
||||
|
@ -115,7 +115,7 @@ GameActions::Result RideSetSettingAction::Query() const
|
|||
break;
|
||||
}
|
||||
case RideSetSetting::LiftHillSpeed:
|
||||
if (!ride_is_valid_lift_hill_speed(ride))
|
||||
if (!ride_is_valid_lift_hill_speed(*ride))
|
||||
{
|
||||
log_warning("Invalid lift hill speed: %u", _value);
|
||||
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_CHANGE_OPERATING_MODE, STR_NONE);
|
||||
|
@ -162,8 +162,8 @@ GameActions::Result RideSetSettingAction::Execute() const
|
|||
switch (_setting)
|
||||
{
|
||||
case RideSetSetting::Mode:
|
||||
invalidate_test_results(ride);
|
||||
ride_clear_for_construction(ride);
|
||||
invalidate_test_results(*ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
|
||||
ride->mode = static_cast<RideMode>(_value);
|
||||
|
@ -182,7 +182,7 @@ GameActions::Result RideSetSettingAction::Execute() const
|
|||
ride->min_waiting_time = std::min(_value, ride->min_waiting_time);
|
||||
break;
|
||||
case RideSetSetting::Operation:
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
ride->operation_option = _value;
|
||||
break;
|
||||
case RideSetSetting::InspectionInterval:
|
||||
|
@ -212,14 +212,14 @@ GameActions::Result RideSetSettingAction::Execute() const
|
|||
if (_value != ride->lift_hill_speed)
|
||||
{
|
||||
ride->lift_hill_speed = _value;
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
}
|
||||
break;
|
||||
case RideSetSetting::NumCircuits:
|
||||
if (_value != ride->num_circuits)
|
||||
{
|
||||
ride->num_circuits = _value;
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -240,15 +240,15 @@ GameActions::Result RideSetSettingAction::Execute() const
|
|||
return res;
|
||||
}
|
||||
|
||||
bool RideSetSettingAction::ride_is_mode_valid(Ride* ride) const
|
||||
bool RideSetSettingAction::ride_is_mode_valid(const Ride& ride) const
|
||||
{
|
||||
return ride->GetRideTypeDescriptor().RideModes & (1uLL << _value);
|
||||
return ride.GetRideTypeDescriptor().RideModes & (1uLL << _value);
|
||||
}
|
||||
|
||||
bool RideSetSettingAction::ride_is_valid_lift_hill_speed(Ride* ride) const
|
||||
bool RideSetSettingAction::ride_is_valid_lift_hill_speed(const Ride& ride) const
|
||||
{
|
||||
int32_t minSpeed = gCheatsUnlockOperatingLimits ? 0 : ride->GetRideTypeDescriptor().LiftData.minimum_speed;
|
||||
int32_t maxSpeed = gCheatsUnlockOperatingLimits ? 255 : ride->GetRideTypeDescriptor().LiftData.maximum_speed;
|
||||
int32_t minSpeed = gCheatsUnlockOperatingLimits ? 0 : ride.GetRideTypeDescriptor().LiftData.minimum_speed;
|
||||
int32_t maxSpeed = gCheatsUnlockOperatingLimits ? 255 : ride.GetRideTypeDescriptor().LiftData.maximum_speed;
|
||||
return _value >= minSpeed && _value <= maxSpeed;
|
||||
}
|
||||
|
||||
|
@ -259,9 +259,9 @@ bool RideSetSettingAction::ride_is_valid_num_circuits() const
|
|||
return _value >= minNumCircuits && _value <= maxNumCircuits;
|
||||
}
|
||||
|
||||
bool RideSetSettingAction::ride_is_valid_operation_option(Ride* ride) const
|
||||
bool RideSetSettingAction::ride_is_valid_operation_option(const Ride& ride) const
|
||||
{
|
||||
const auto& operatingSettings = ride->GetRideTypeDescriptor().OperatingSettings;
|
||||
const auto& operatingSettings = ride.GetRideTypeDescriptor().OperatingSettings;
|
||||
uint8_t minValue = operatingSettings.MinValue;
|
||||
uint8_t maxValue = operatingSettings.MaxValue;
|
||||
if (gCheatsUnlockOperatingLimits)
|
||||
|
@ -273,9 +273,9 @@ bool RideSetSettingAction::ride_is_valid_operation_option(Ride* ride) const
|
|||
return _value >= minValue && _value <= maxValue;
|
||||
}
|
||||
|
||||
StringId RideSetSettingAction::GetOperationErrorMessage(Ride* ride) const
|
||||
StringId RideSetSettingAction::GetOperationErrorMessage(const Ride& ride) const
|
||||
{
|
||||
switch (ride->mode)
|
||||
switch (ride.mode)
|
||||
{
|
||||
case RideMode::StationToStation:
|
||||
return STR_CANT_CHANGE_SPEED;
|
||||
|
@ -290,7 +290,7 @@ StringId RideSetSettingAction::GetOperationErrorMessage(Ride* ride) const
|
|||
case RideMode::BackwardRotation:
|
||||
return STR_CANT_CHANGE_NUMBER_OF_ROTATIONS;
|
||||
default:
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_NO_VEHICLES))
|
||||
{
|
||||
return STR_CANT_CHANGE_THIS;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ public:
|
|||
GameActions::Result Execute() const override;
|
||||
|
||||
private:
|
||||
bool ride_is_mode_valid(Ride* ride) const;
|
||||
bool ride_is_valid_lift_hill_speed(Ride* ride) const;
|
||||
bool ride_is_mode_valid(const Ride& ride) const;
|
||||
bool ride_is_valid_lift_hill_speed(const Ride& ride) const;
|
||||
bool ride_is_valid_num_circuits() const;
|
||||
bool ride_is_valid_operation_option(Ride* ride) const;
|
||||
StringId GetOperationErrorMessage(Ride* ride) const;
|
||||
bool ride_is_valid_operation_option(const Ride& ride) const;
|
||||
StringId GetOperationErrorMessage(const Ride& ride) const;
|
||||
};
|
||||
|
|
|
@ -150,7 +150,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
|
||||
{
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CRASHED;
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
case RideStatus::Simulating:
|
||||
{
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CRASHED;
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
|
||||
const auto modeSwitchResult = ride->Simulate(true);
|
||||
|
@ -195,7 +195,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
|
||||
if (ride->status == RideStatus::Simulating)
|
||||
{
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ GameActions::Result RideSetVehicleAction::Query() const
|
|||
break;
|
||||
case RideSetVehicleType::RideEntry:
|
||||
{
|
||||
if (!ride_is_vehicle_type_valid(ride))
|
||||
if (!ride_is_vehicle_type_valid(*ride))
|
||||
{
|
||||
log_error("Invalid vehicle type. type = %d", _value);
|
||||
return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
|
||||
|
@ -133,7 +133,7 @@ GameActions::Result RideSetVehicleAction::Execute() const
|
|||
switch (_type)
|
||||
{
|
||||
case RideSetVehicleType::NumTrains:
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
ride->vehicle_change_timeout = 100;
|
||||
|
||||
|
@ -141,11 +141,11 @@ GameActions::Result RideSetVehicleAction::Execute() const
|
|||
break;
|
||||
case RideSetVehicleType::NumCarsPerTrain:
|
||||
{
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
ride->vehicle_change_timeout = 100;
|
||||
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
auto rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
|
@ -163,11 +163,11 @@ GameActions::Result RideSetVehicleAction::Execute() const
|
|||
}
|
||||
case RideSetVehicleType::RideEntry:
|
||||
{
|
||||
ride_clear_for_construction(ride);
|
||||
ride_clear_for_construction(*ride);
|
||||
ride->RemovePeeps();
|
||||
ride->vehicle_change_timeout = 100;
|
||||
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
ride->subtype = _value;
|
||||
auto rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
|
@ -176,7 +176,7 @@ GameActions::Result RideSetVehicleAction::Execute() const
|
|||
return GameActions::Result(GameActions::Status::InvalidParameters, errTitle, STR_NONE);
|
||||
}
|
||||
|
||||
ride_set_vehicle_colours_to_random_preset(ride, _colour);
|
||||
ride_set_vehicle_colours_to_random_preset(*ride, _colour);
|
||||
if (!gCheatsDisableTrainLengthLimit)
|
||||
{
|
||||
ride->proposed_num_cars_per_train = std::clamp(
|
||||
|
@ -208,17 +208,17 @@ GameActions::Result RideSetVehicleAction::Execute() const
|
|||
return res;
|
||||
}
|
||||
|
||||
bool RideSetVehicleAction::ride_is_vehicle_type_valid(Ride* ride) const
|
||||
bool RideSetVehicleAction::ride_is_vehicle_type_valid(const Ride& ride) const
|
||||
{
|
||||
bool selectionShouldBeExpanded;
|
||||
int32_t rideTypeIterator, rideTypeIteratorMax;
|
||||
|
||||
{
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
const auto& rtd = ride.GetRideTypeDescriptor();
|
||||
if (gCheatsShowVehiclesFromOtherTrackTypes
|
||||
&& !(
|
||||
ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)
|
||||
|| ride->type == RIDE_TYPE_MINI_GOLF))
|
||||
ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE) || rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE)
|
||||
|| ride.type == RIDE_TYPE_MINI_GOLF))
|
||||
{
|
||||
selectionShouldBeExpanded = true;
|
||||
rideTypeIterator = 0;
|
||||
|
@ -227,8 +227,8 @@ bool RideSetVehicleAction::ride_is_vehicle_type_valid(Ride* ride) const
|
|||
else
|
||||
{
|
||||
selectionShouldBeExpanded = false;
|
||||
rideTypeIterator = ride->type;
|
||||
rideTypeIteratorMax = ride->type;
|
||||
rideTypeIterator = ride.type;
|
||||
rideTypeIteratorMax = ride.type;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
GameActions::Result Execute() const override;
|
||||
|
||||
private:
|
||||
bool ride_is_vehicle_type_valid(Ride* ride) const;
|
||||
bool ride_is_vehicle_type_valid(const Ride& ride) const;
|
||||
|
||||
static_assert(sizeof(_value) >= sizeof(ObjectEntryIndex));
|
||||
};
|
||||
|
|
|
@ -99,11 +99,11 @@ GameActions::Result TrackDesignAction::Query() const
|
|||
if (GetFlags() & GAME_COMMAND_FLAG_REPLAY)
|
||||
flags |= GAME_COMMAND_FLAG_REPLAY;
|
||||
|
||||
auto queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, ride, _loc);
|
||||
auto queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, *ride, _loc);
|
||||
if (_trackDesignPlaceStateSceneryUnavailable)
|
||||
{
|
||||
placeScenery = false;
|
||||
queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, ride, _loc);
|
||||
queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, *ride, _loc);
|
||||
}
|
||||
|
||||
auto gameAction = RideDemolishAction(ride->id, RIDE_MODIFY_DEMOLISH);
|
||||
|
@ -172,11 +172,11 @@ GameActions::Result TrackDesignAction::Execute() const
|
|||
if (GetFlags() & GAME_COMMAND_FLAG_REPLAY)
|
||||
flags |= GAME_COMMAND_FLAG_REPLAY;
|
||||
|
||||
auto queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, ride, _loc);
|
||||
auto queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, *ride, _loc);
|
||||
if (_trackDesignPlaceStateSceneryUnavailable)
|
||||
{
|
||||
placeScenery = false;
|
||||
queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, ride, _loc);
|
||||
queryRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, *ride, _loc);
|
||||
}
|
||||
|
||||
if (queryRes.Error != GameActions::Status::Ok)
|
||||
|
@ -196,7 +196,7 @@ GameActions::Result TrackDesignAction::Execute() const
|
|||
// Execute.
|
||||
flags |= GAME_COMMAND_FLAG_APPLY;
|
||||
|
||||
auto execRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, ride, _loc);
|
||||
auto execRes = TrackDesignPlace(const_cast<TrackDesign*>(&_td), flags, placeScenery, *ride, _loc);
|
||||
if (execRes.Error != GameActions::Status::Ok)
|
||||
{
|
||||
auto gameAction = RideDemolishAction(ride->id, RIDE_MODIFY_DEMOLISH);
|
||||
|
|
|
@ -527,7 +527,7 @@ GameActions::Result TrackPlaceAction::Execute() const
|
|||
|
||||
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
switch (_trackType)
|
||||
{
|
||||
case TrackElemType::OnRidePhoto:
|
||||
|
|
|
@ -438,7 +438,7 @@ GameActions::Result TrackRemoveAction::Execute() const
|
|||
surfaceElement->SetHasTrackThatNeedsWater(false);
|
||||
}
|
||||
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
FootpathQueueChainReset();
|
||||
if (!gCheatsDisableClearanceChecks || !(tileElement->IsGhost()))
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -327,25 +327,25 @@ public:
|
|||
bool HasDrink() const;
|
||||
bool HasFoodOrDrink() const;
|
||||
bool HasEmptyContainer() const;
|
||||
void OnEnterRide(Ride* ride);
|
||||
void OnExitRide(Ride* ride);
|
||||
void OnEnterRide(Ride& ride);
|
||||
void OnExitRide(Ride& ride);
|
||||
void UpdateSpriteType();
|
||||
bool HeadingForRideOrParkExit() const;
|
||||
void StopPurchaseThought(ride_type_t rideType);
|
||||
void TryGetUpFromSitting();
|
||||
bool ShouldRideWhileRaining(const Ride& ride);
|
||||
void ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide);
|
||||
void ChoseNotToGoOnRide(const Ride& ride, bool peepAtRide, bool updateLastRide);
|
||||
void PickRideToGoOn();
|
||||
void ReadMap();
|
||||
bool ShouldGoOnRide(Ride* ride, StationIndex entranceNum, bool atQueue, bool thinking);
|
||||
bool ShouldGoToShop(Ride* ride, bool peepAtShop);
|
||||
bool ShouldGoOnRide(Ride& ride, StationIndex entranceNum, bool atQueue, bool thinking);
|
||||
bool ShouldGoToShop(Ride& ride, bool peepAtShop);
|
||||
bool ShouldFindBench();
|
||||
bool UpdateWalkingFindBench();
|
||||
bool UpdateWalkingFindBin();
|
||||
void SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureType type);
|
||||
void SpendMoney(money32 amount, ExpenditureType type);
|
||||
void SetHasRidden(const Ride* ride);
|
||||
bool HasRidden(const Ride* ride) const;
|
||||
void SetHasRidden(const Ride& ride);
|
||||
bool HasRidden(const Ride& ride) const;
|
||||
void SetHasRiddenRideType(int32_t rideType);
|
||||
bool HasRiddenRideType(int32_t rideType) const;
|
||||
void SetParkEntryTime(int32_t entryTime);
|
||||
|
@ -353,7 +353,7 @@ public:
|
|||
void CheckIfLost();
|
||||
void CheckCantFindRide();
|
||||
void CheckCantFindExit();
|
||||
bool DecideAndBuyItem(Ride* ride, ShopItem shopItem, money32 price);
|
||||
bool DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price);
|
||||
void SetSpriteType(PeepSpriteType new_sprite_type);
|
||||
void HandleEasterEggName();
|
||||
int32_t GetEasterEggNameId() const;
|
||||
|
@ -395,7 +395,7 @@ private:
|
|||
void UpdateRideLeaveEntranceWaypoints(const Ride& ride);
|
||||
uint8_t GetWaypointedSeatLocation(const Ride& ride, CarEntry* vehicle_type, uint8_t track_direction) const;
|
||||
void UpdateRideFreeVehicleCheck();
|
||||
void UpdateRideFreeVehicleEnterRide(Ride* ride);
|
||||
void UpdateRideFreeVehicleEnterRide(Ride& ride);
|
||||
void UpdateRideApproachVehicle();
|
||||
void UpdateRideEnterVehicle();
|
||||
void UpdateRideLeaveVehicle();
|
||||
|
@ -423,8 +423,8 @@ private:
|
|||
void GivePassingPeepsIceCream(Guest* passingPeep);
|
||||
Ride* FindBestRideToGoOn();
|
||||
OpenRCT2::BitSet<OpenRCT2::Limits::MaxRidesInPark> FindRidesToGoOn();
|
||||
bool FindVehicleToEnter(Ride* ride, std::vector<uint8_t>& car_array);
|
||||
void GoToRideEntrance(Ride* ride);
|
||||
bool FindVehicleToEnter(const Ride& ride, std::vector<uint8_t>& car_array);
|
||||
void GoToRideEntrance(const Ride& ride);
|
||||
};
|
||||
|
||||
void UpdateRideApproachVehicleWaypointsMotionSimulator(Guest&, const CoordsXY&, int16_t&);
|
||||
|
@ -479,9 +479,9 @@ void increment_guests_heading_for_park();
|
|||
void decrement_guests_in_park();
|
||||
void decrement_guests_heading_for_park();
|
||||
|
||||
void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||
void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||
void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc);
|
||||
void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride& ride, CoordsXYZD& entrance_loc);
|
||||
void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride& ride, CoordsXYZD& entrance_loc);
|
||||
void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride& ride, CoordsXYZD& entrance_loc);
|
||||
|
||||
CoordsXY GetGuestWaypointLocationDefault(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||
CoordsXY GetGuestWaypointLocationEnterprise(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||
|
|
|
@ -1769,7 +1769,7 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
|
|||
// Guest walks up to the ride for the first time since entering
|
||||
// the path tile or since considering another ride attached to
|
||||
// the path tile.
|
||||
if (!guest->ShouldGoOnRide(ride, stationNum, false, false))
|
||||
if (!guest->ShouldGoOnRide(*ride, stationNum, false, false))
|
||||
{
|
||||
// Peep remembers that this is the last ride they
|
||||
// considered while on this path tile.
|
||||
|
@ -2202,7 +2202,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
|
|||
/* Peep is approaching the entrance of a ride queue.
|
||||
* Decide whether to go on the ride. */
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride != nullptr && guest->ShouldGoOnRide(ride, stationNum, true, false))
|
||||
if (ride != nullptr && guest->ShouldGoOnRide(*ride, stationNum, true, false))
|
||||
{
|
||||
// Peep has decided to go on the ride at the queue.
|
||||
guest->InteractionRideIndex = rideIndex;
|
||||
|
@ -2312,7 +2312,7 @@ static bool peep_interact_with_shop(Peep* peep, const CoordsXYE& coords)
|
|||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_PEEP_SHOULD_GO_INSIDE_FACILITY))
|
||||
{
|
||||
guest->TimeLost = 0;
|
||||
if (!guest->ShouldGoOnRide(ride, StationIndex::FromUnderlying(0), false, false))
|
||||
if (!guest->ShouldGoOnRide(*ride, StationIndex::FromUnderlying(0), false, false))
|
||||
{
|
||||
peep_return_to_centre_of_tile(guest);
|
||||
return true;
|
||||
|
|
|
@ -1954,26 +1954,26 @@ void Staff::UpdateFixing(int32_t steps)
|
|||
{
|
||||
case PEEP_FIXING_ENTER_STATION:
|
||||
NextFlags &= ~PEEP_NEXT_FLAG_IS_SLOPED;
|
||||
progressToNextSubstate = UpdateFixingEnterStation(ride);
|
||||
progressToNextSubstate = UpdateFixingEnterStation(*ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_MOVE_TO_BROKEN_DOWN_VEHICLE:
|
||||
progressToNextSubstate = UpdateFixingMoveToBrokenDownVehicle(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingMoveToBrokenDownVehicle(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FIX_VEHICLE_CLOSED_RESTRAINTS:
|
||||
case PEEP_FIXING_FIX_VEHICLE_CLOSED_DOORS:
|
||||
case PEEP_FIXING_FIX_VEHICLE_OPEN_RESTRAINTS:
|
||||
case PEEP_FIXING_FIX_VEHICLE_OPEN_DOORS:
|
||||
progressToNextSubstate = UpdateFixingFixVehicle(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingFixVehicle(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FIX_VEHICLE_MALFUNCTION:
|
||||
progressToNextSubstate = UpdateFixingFixVehicleMalfunction(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingFixVehicleMalfunction(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_MOVE_TO_STATION_END:
|
||||
progressToNextSubstate = UpdateFixingMoveToStationEnd(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingMoveToStationEnd(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FIX_STATION_END:
|
||||
|
@ -1981,27 +1981,27 @@ void Staff::UpdateFixing(int32_t steps)
|
|||
break;
|
||||
|
||||
case PEEP_FIXING_MOVE_TO_STATION_START:
|
||||
progressToNextSubstate = UpdateFixingMoveToStationStart(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingMoveToStationStart(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FIX_STATION_START:
|
||||
progressToNextSubstate = UpdateFixingFixStationStart(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingFixStationStart(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FIX_STATION_BRAKES:
|
||||
progressToNextSubstate = UpdateFixingFixStationBrakes(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingFixStationBrakes(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_MOVE_TO_STATION_EXIT:
|
||||
progressToNextSubstate = UpdateFixingMoveToStationExit(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingMoveToStationExit(firstRun, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_FINISH_FIX_OR_INSPECT:
|
||||
progressToNextSubstate = UpdateFixingFinishFixOrInspect(firstRun, steps, ride);
|
||||
progressToNextSubstate = UpdateFixingFinishFixOrInspect(firstRun, steps, *ride);
|
||||
break;
|
||||
|
||||
case PEEP_FIXING_LEAVE_BY_ENTRANCE_EXIT:
|
||||
progressToNextSubstate = UpdateFixingLeaveByEntranceExit(firstRun, ride);
|
||||
progressToNextSubstate = UpdateFixingLeaveByEntranceExit(firstRun, *ride);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2037,10 +2037,10 @@ void Staff::UpdateFixing(int32_t steps)
|
|||
* rct2: 0x006C0EEC
|
||||
* fixing SubState: enter_station - applies to fixing all break down reasons and ride inspections.
|
||||
*/
|
||||
bool Staff::UpdateFixingEnterStation(Ride* ride) const
|
||||
bool Staff::UpdateFixingEnterStation(Ride& ride) const
|
||||
{
|
||||
ride->mechanic_status = RIDE_MECHANIC_STATUS_FIXING;
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
ride.mechanic_status = RIDE_MECHANIC_STATUS_FIXING;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2050,7 +2050,7 @@ bool Staff::UpdateFixingEnterStation(Ride* ride) const
|
|||
* fixing SubState: move_to_broken_down_vehicle - applies to fixing all vehicle specific breakdown reasons
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
|
@ -2103,7 +2103,7 @@ bool Staff::UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride* ride)
|
|||
* 4. doors stuck open.
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
|
@ -2145,7 +2145,7 @@ bool Staff::UpdateFixingFixVehicle(bool firstRun, const Ride* ride)
|
|||
* fixing SubState: fix_vehicle_malfunction - applies fixing to vehicle malfunction.
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
|
@ -2195,16 +2195,16 @@ static constexpr const CoordsXY _StationFixingOffsets[] = {
|
|||
* inspection.
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingMoveToStationEnd(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingMoveToStationEnd(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
auto stationPos = ride->GetStation(CurrentRideStation).GetStart();
|
||||
auto stationPos = ride.GetStation(CurrentRideStation).GetStart();
|
||||
if (stationPos.IsNull())
|
||||
{
|
||||
return true;
|
||||
|
@ -2281,16 +2281,16 @@ bool Staff::UpdateFixingFixStationEnd(bool firstRun)
|
|||
* 3. applies to inspection.
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingMoveToStationStart(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingMoveToStationStart(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
auto stationPosition = ride->GetStation(CurrentRideStation).GetStart();
|
||||
auto stationPosition = ride.GetStation(CurrentRideStation).GetStart();
|
||||
if (stationPosition.IsNull())
|
||||
{
|
||||
return true;
|
||||
|
@ -2357,11 +2357,11 @@ bool Staff::UpdateFixingMoveToStationStart(bool firstRun, const Ride* ride)
|
|||
* 2. applies to inspection.
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_SINGLE_PIECE_STATION | RIDE_TYPE_FLAG_HAS_NO_TRACK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -2390,7 +2390,7 @@ bool Staff::UpdateFixingFixStationStart(bool firstRun, const Ride* ride)
|
|||
* fixing SubState: fix_station_brakes - applies to fixing brake failure
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride)
|
||||
bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
|
@ -2413,8 +2413,8 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride)
|
|||
|
||||
if (ActionFrame == 0x28)
|
||||
{
|
||||
ride->mechanic_status = RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES;
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
ride.mechanic_status = RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
}
|
||||
|
||||
if (ActionFrame == 0x13 || ActionFrame == 0x19 || ActionFrame == 0x1F || ActionFrame == 0x25 || ActionFrame == 0x2B)
|
||||
|
@ -2430,14 +2430,14 @@ bool Staff::UpdateFixingFixStationBrakes(bool firstRun, Ride* ride)
|
|||
* fixing SubState: move_to_station_exit - applies to fixing all failures & inspections
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingMoveToStationExit(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingMoveToStationExit(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
auto stationPosition = ride->GetStation(CurrentRideStation).Exit.ToCoordsXY();
|
||||
auto stationPosition = ride.GetStation(CurrentRideStation).Exit.ToCoordsXY();
|
||||
if (stationPosition.IsNull())
|
||||
{
|
||||
stationPosition = ride->GetStation(CurrentRideStation).Entrance.ToCoordsXY();
|
||||
stationPosition = ride.GetStation(CurrentRideStation).Entrance.ToCoordsXY();
|
||||
|
||||
if (stationPosition.IsNull())
|
||||
{
|
||||
|
@ -2468,7 +2468,7 @@ bool Staff::UpdateFixingMoveToStationExit(bool firstRun, const Ride* ride)
|
|||
* fixing SubState: finish_fix_or_inspect - applies to fixing all failures & inspections
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* ride)
|
||||
bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
|
@ -2478,7 +2478,7 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r
|
|||
|
||||
StaffRidesInspected++;
|
||||
WindowInvalidateFlags |= RIDE_INVALIDATE_RIDE_INCOME | RIDE_INVALIDATE_RIDE_LIST;
|
||||
ride->mechanic_status = RIDE_MECHANIC_STATUS_UNDEFINED;
|
||||
ride.mechanic_status = RIDE_MECHANIC_STATUS_UNDEFINED;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2501,7 +2501,7 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r
|
|||
}
|
||||
|
||||
ride_fix_breakdown(ride, steps);
|
||||
ride->mechanic_status = RIDE_MECHANIC_STATUS_UNDEFINED;
|
||||
ride.mechanic_status = RIDE_MECHANIC_STATUS_UNDEFINED;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2510,14 +2510,14 @@ bool Staff::UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* r
|
|||
* fixing SubState: leave_by_entrance_exit - applies to fixing all failures & inspections
|
||||
* - see FixingSubstatesForBreakdown[]
|
||||
*/
|
||||
bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride* ride)
|
||||
bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride)
|
||||
{
|
||||
if (!firstRun)
|
||||
{
|
||||
auto exitPosition = ride->GetStation(CurrentRideStation).Exit.ToCoordsXY();
|
||||
auto exitPosition = ride.GetStation(CurrentRideStation).Exit.ToCoordsXY();
|
||||
if (exitPosition.IsNull())
|
||||
{
|
||||
exitPosition = ride->GetStation(CurrentRideStation).Entrance.ToCoordsXY();
|
||||
exitPosition = ride.GetStation(CurrentRideStation).Entrance.ToCoordsXY();
|
||||
|
||||
if (exitPosition.IsNull())
|
||||
{
|
||||
|
@ -2538,10 +2538,10 @@ bool Staff::UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride* ride)
|
|||
int16_t xy_distance;
|
||||
if (auto loc = UpdateAction(xy_distance); loc.has_value())
|
||||
{
|
||||
auto stationHeight = ride->GetStation(CurrentRideStation).GetBaseZ();
|
||||
auto stationHeight = ride.GetStation(CurrentRideStation).GetBaseZ();
|
||||
if (xy_distance >= 16)
|
||||
{
|
||||
stationHeight += ride->GetRideTypeDescriptor().Heights.PlatformHeight;
|
||||
stationHeight += ride.GetRideTypeDescriptor().Heights.PlatformHeight;
|
||||
}
|
||||
|
||||
MoveTo({ loc.value(), stationHeight });
|
||||
|
|
|
@ -75,18 +75,18 @@ private:
|
|||
void UpdateWatering();
|
||||
void UpdateAnswering();
|
||||
void UpdateFixing(int32_t steps);
|
||||
bool UpdateFixingEnterStation(Ride* ride) const;
|
||||
bool UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingFixVehicle(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingMoveToStationEnd(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingEnterStation(Ride& ride) const;
|
||||
bool UpdateFixingMoveToBrokenDownVehicle(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFixVehicle(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFixVehicleMalfunction(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingMoveToStationEnd(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFixStationEnd(bool firstRun);
|
||||
bool UpdateFixingMoveToStationStart(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingFixStationStart(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingFixStationBrakes(bool firstRun, Ride* ride);
|
||||
bool UpdateFixingMoveToStationExit(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride* ride);
|
||||
bool UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride* ride);
|
||||
bool UpdateFixingMoveToStationStart(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFixStationStart(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFixStationBrakes(bool firstRun, Ride& ride);
|
||||
bool UpdateFixingMoveToStationExit(bool firstRun, const Ride& ride);
|
||||
bool UpdateFixingFinishFixOrInspect(bool firstRun, int32_t steps, Ride& ride);
|
||||
bool UpdateFixingLeaveByEntranceExit(bool firstRun, const Ride& ride);
|
||||
void UpdateRideInspected(RideId rideIndex);
|
||||
void UpdateHeadingToInspect();
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
else
|
||||
{
|
||||
ride->mode = static_cast<RideMode>(mode & 0xFF);
|
||||
invalidate_test_results(ride);
|
||||
invalidate_test_results(*ride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,7 @@ static bool award_is_deserved_most_disappointing(int32_t activeAwardTypes)
|
|||
auto disappointingRides = 0;
|
||||
for (const auto& ride : GetRideManager())
|
||||
{
|
||||
if (ride_has_ratings(&ride) && ride.popularity != 0xFF)
|
||||
if (ride_has_ratings(ride) && ride.popularity != 0xFF)
|
||||
{
|
||||
countedRides++;
|
||||
if (ride.popularity <= 6)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1017,61 +1017,61 @@ void reset_all_ride_build_dates();
|
|||
void ride_update_favourited_stat();
|
||||
void ride_check_all_reachable();
|
||||
|
||||
bool ride_try_get_origin_element(const Ride* ride, CoordsXYE* output);
|
||||
void ride_clear_blocked_tiles(Ride* ride);
|
||||
Staff* ride_get_mechanic(Ride* ride);
|
||||
Staff* ride_get_assigned_mechanic(Ride* ride);
|
||||
VehicleColour ride_get_vehicle_colour(Ride* ride, int32_t vehicleIndex);
|
||||
bool ride_try_get_origin_element(const Ride& ride, CoordsXYE* output);
|
||||
void ride_clear_blocked_tiles(const Ride& ride);
|
||||
Staff* ride_get_mechanic(const Ride& ride);
|
||||
Staff* ride_get_assigned_mechanic(const Ride& ride);
|
||||
VehicleColour ride_get_vehicle_colour(const Ride& ride, int32_t vehicleIndex);
|
||||
int32_t ride_get_unused_preset_vehicle_colour(ObjectEntryIndex subType);
|
||||
void ride_set_vehicle_colours_to_random_preset(Ride* ride, uint8_t preset_index);
|
||||
void ride_set_vehicle_colours_to_random_preset(Ride& ride, uint8_t preset_index);
|
||||
void ride_measurements_update();
|
||||
void ride_breakdown_add_news_item(Ride* ride);
|
||||
Staff* ride_find_closest_mechanic(Ride* ride, int32_t forInspection);
|
||||
int32_t ride_initialise_construction_window(Ride* ride);
|
||||
void ride_breakdown_add_news_item(const Ride& ride);
|
||||
Staff* ride_find_closest_mechanic(const Ride& ride, int32_t forInspection);
|
||||
int32_t ride_initialise_construction_window(Ride& ride);
|
||||
void ride_set_map_tooltip(TileElement* tileElement);
|
||||
void ride_prepare_breakdown(Ride* ride, int32_t breakdownReason);
|
||||
TileElement* ride_get_station_start_track_element(const Ride* ride, StationIndex stationIndex);
|
||||
void ride_prepare_breakdown(Ride& ride, int32_t breakdownReason);
|
||||
TileElement* ride_get_station_start_track_element(const Ride& ride, StationIndex stationIndex);
|
||||
TileElement* ride_get_station_exit_element(const CoordsXYZ& elementPos);
|
||||
int32_t ride_get_refund_price(const Ride* ride);
|
||||
int32_t ride_get_refund_price(const Ride& ride);
|
||||
int32_t ride_get_random_colour_preset_index(ride_type_t rideType);
|
||||
money32 ride_get_common_price(Ride* forRide);
|
||||
money32 ride_get_common_price(const Ride& forRide);
|
||||
|
||||
void ride_clear_for_construction(Ride* ride);
|
||||
void invalidate_test_results(Ride* ride);
|
||||
void ride_clear_for_construction(Ride& ride);
|
||||
void invalidate_test_results(Ride& ride);
|
||||
|
||||
void increment_turn_count_1_element(Ride* ride, uint8_t type);
|
||||
void increment_turn_count_2_elements(Ride* ride, uint8_t type);
|
||||
void increment_turn_count_3_elements(Ride* ride, uint8_t type);
|
||||
void increment_turn_count_4_plus_elements(Ride* ride, uint8_t type);
|
||||
int32_t get_turn_count_1_element(Ride* ride, uint8_t type);
|
||||
int32_t get_turn_count_2_elements(Ride* ride, uint8_t type);
|
||||
int32_t get_turn_count_3_elements(Ride* ride, uint8_t type);
|
||||
int32_t get_turn_count_4_plus_elements(Ride* ride, uint8_t type);
|
||||
void increment_turn_count_1_element(Ride& ride, uint8_t type);
|
||||
void increment_turn_count_2_elements(Ride& ride, uint8_t type);
|
||||
void increment_turn_count_3_elements(Ride& ride, uint8_t type);
|
||||
void increment_turn_count_4_plus_elements(Ride& ride, uint8_t type);
|
||||
int32_t get_turn_count_1_element(const Ride& ride, uint8_t type);
|
||||
int32_t get_turn_count_2_elements(const Ride& ride, uint8_t type);
|
||||
int32_t get_turn_count_3_elements(const Ride& ride, uint8_t type);
|
||||
int32_t get_turn_count_4_plus_elements(const Ride& ride, uint8_t type);
|
||||
|
||||
uint8_t ride_get_helix_sections(Ride* ride);
|
||||
uint8_t ride_get_helix_sections(const Ride& ride);
|
||||
|
||||
bool ride_has_any_track_elements(const Ride* ride);
|
||||
bool ride_has_any_track_elements(const Ride& ride);
|
||||
|
||||
bool track_block_get_next(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32_t* direction);
|
||||
bool track_block_get_next_from_zero(
|
||||
const CoordsXYZ& startPos, Ride* ride, uint8_t direction_start, CoordsXYE* output, int32_t* z, int32_t* direction,
|
||||
const CoordsXYZ& startPos, const Ride& ride, uint8_t direction_start, CoordsXYE* output, int32_t* z, int32_t* direction,
|
||||
bool isGhost);
|
||||
|
||||
bool track_block_get_previous(const CoordsXYE& trackPos, track_begin_end* outTrackBeginEnd);
|
||||
bool track_block_get_previous_from_zero(
|
||||
const CoordsXYZ& startPos, Ride* ride, uint8_t direction, track_begin_end* outTrackBeginEnd);
|
||||
const CoordsXYZ& startPos, const Ride& ride, uint8_t direction, track_begin_end* outTrackBeginEnd);
|
||||
|
||||
void ride_get_start_of_track(CoordsXYE* output);
|
||||
|
||||
void window_ride_construction_update_active_elements();
|
||||
money32 RideEntranceExitPlaceGhost(
|
||||
Ride* ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum);
|
||||
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum);
|
||||
|
||||
ResultWithMessage ride_are_all_possible_entrances_and_exits_built(Ride* ride);
|
||||
void ride_fix_breakdown(Ride* ride, int32_t reliabilityIncreaseFactor);
|
||||
ResultWithMessage ride_are_all_possible_entrances_and_exits_built(const Ride& ride);
|
||||
void ride_fix_breakdown(Ride& ride, int32_t reliabilityIncreaseFactor);
|
||||
|
||||
uint8_t ride_entry_get_vehicle_at_position(int32_t rideEntryIndex, int32_t numCarsPerTrain, int32_t position);
|
||||
void ride_update_vehicle_colours(Ride* ride);
|
||||
void ride_update_vehicle_colours(const Ride& ride);
|
||||
|
||||
OpenRCT2::BitSet<TRACK_GROUP_COUNT> ride_entry_get_supported_track_pieces(const rct_ride_entry* rideEntry);
|
||||
|
||||
|
@ -1081,17 +1081,17 @@ money32 set_operating_setting_nested(RideId rideId, RideSetSetting setting, uint
|
|||
|
||||
void UpdateGhostTrackAndArrow();
|
||||
|
||||
uint32_t ride_customers_per_hour(const Ride* ride);
|
||||
uint32_t ride_customers_in_last_5_minutes(const Ride* ride);
|
||||
uint32_t ride_customers_per_hour(const Ride& ride);
|
||||
uint32_t ride_customers_in_last_5_minutes(const Ride& ride);
|
||||
|
||||
Vehicle* ride_get_broken_vehicle(const Ride* ride);
|
||||
Vehicle* ride_get_broken_vehicle(const Ride& ride);
|
||||
|
||||
money16 ride_get_price(const Ride* ride);
|
||||
money16 ride_get_price(const Ride& ride);
|
||||
|
||||
TileElement* get_station_platform(const CoordsXYRangedZ& coords);
|
||||
bool ride_has_adjacent_station(Ride* ride);
|
||||
bool ride_has_station_shelter(Ride* ride);
|
||||
bool ride_has_ratings(const Ride* ride);
|
||||
bool ride_has_adjacent_station(const Ride& ride);
|
||||
bool ride_has_station_shelter(const Ride& ride);
|
||||
bool ride_has_ratings(const Ride& ride);
|
||||
|
||||
int32_t get_booster_speed(ride_type_t rideType, int32_t rawSpeed);
|
||||
void fix_invalid_vehicle_sprite_sizes();
|
||||
|
@ -1100,9 +1100,9 @@ bool ride_entry_has_category(const rct_ride_entry* rideEntry, uint8_t category);
|
|||
int32_t ride_get_entry_index(int32_t rideType, int32_t rideSubType);
|
||||
|
||||
void determine_ride_entrance_and_exit_locations();
|
||||
void ride_clear_leftover_entrances(Ride* ride);
|
||||
void ride_clear_leftover_entrances(const Ride& ride);
|
||||
|
||||
std::vector<RideId> GetTracklessRides();
|
||||
|
||||
void CircusMusicUpdate(Ride* ride);
|
||||
void DefaultMusicUpdate(Ride* ride);
|
||||
void CircusMusicUpdate(Ride& ride);
|
||||
void DefaultMusicUpdate(Ride& ride);
|
||||
|
|
|
@ -91,25 +91,25 @@ Direction gRideEntranceExitPlaceDirection;
|
|||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::TrackMetaData;
|
||||
|
||||
static int32_t ride_check_if_construction_allowed(Ride* ride)
|
||||
static int32_t ride_check_if_construction_allowed(Ride& ride)
|
||||
{
|
||||
Formatter ft;
|
||||
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
||||
rct_ride_entry* rideEntry = ride.GetRideEntry();
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
ContextShowError(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE, ft);
|
||||
return 0;
|
||||
}
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
if (ride.lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
{
|
||||
ride->FormatNameTo(ft);
|
||||
ride.FormatNameTo(ft);
|
||||
ContextShowError(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING, ft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ride->status != RideStatus::Closed && ride->status != RideStatus::Simulating)
|
||||
if (ride.status != RideStatus::Closed && ride.status != RideStatus::Simulating)
|
||||
{
|
||||
ride->FormatNameTo(ft);
|
||||
ride.FormatNameTo(ft);
|
||||
ContextShowError(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST, ft);
|
||||
return 0;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ static rct_window* ride_create_or_find_construction_window(RideId rideIndex)
|
|||
void RideConstructionStart(Ride& ride)
|
||||
{
|
||||
CoordsXYE trackElement;
|
||||
if (ride_try_get_origin_element(&ride, &trackElement))
|
||||
if (ride_try_get_origin_element(ride, &trackElement))
|
||||
{
|
||||
ride.FindTrackGap(trackElement, &trackElement);
|
||||
|
||||
|
@ -143,7 +143,7 @@ void RideConstructionStart(Ride& ride)
|
|||
}
|
||||
else
|
||||
{
|
||||
ride_initialise_construction_window(&ride);
|
||||
ride_initialise_construction_window(ride);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,12 +151,12 @@ void RideConstructionStart(Ride& ride)
|
|||
*
|
||||
* rct2: 0x006DD4D5
|
||||
*/
|
||||
static void ride_remove_cable_lift(Ride* ride)
|
||||
static void ride_remove_cable_lift(Ride& ride)
|
||||
{
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT)
|
||||
if (ride.lifecycle_flags & RIDE_LIFECYCLE_CABLE_LIFT)
|
||||
{
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CABLE_LIFT;
|
||||
auto spriteIndex = ride->cable_lift;
|
||||
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_CABLE_LIFT;
|
||||
auto spriteIndex = ride.cable_lift;
|
||||
do
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(spriteIndex);
|
||||
|
@ -219,12 +219,12 @@ void Ride::RemoveVehicles()
|
|||
*
|
||||
* rct2: 0x006DD4AC
|
||||
*/
|
||||
void ride_clear_for_construction(Ride* ride)
|
||||
void ride_clear_for_construction(Ride& ride)
|
||||
{
|
||||
ride->measurement = {};
|
||||
ride.measurement = {};
|
||||
|
||||
ride->lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN);
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
ride.lifecycle_flags &= ~(RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN);
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
|
||||
// Open circuit rides will go directly into building mode (creating ghosts) where it would normally clear the stats,
|
||||
// however this causes desyncs since it's directly run from the window and other clients would not get it.
|
||||
|
@ -235,10 +235,10 @@ void ride_clear_for_construction(Ride* ride)
|
|||
}
|
||||
|
||||
ride_remove_cable_lift(ride);
|
||||
ride->RemoveVehicles();
|
||||
ride.RemoveVehicles();
|
||||
ride_clear_blocked_tiles(ride);
|
||||
|
||||
auto w = window_find_by_number(WindowClass::Ride, ride->id.ToUnderlying());
|
||||
auto w = window_find_by_number(WindowClass::Ride, ride.id.ToUnderlying());
|
||||
if (w != nullptr)
|
||||
window_event_resize_call(w);
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ void ride_clear_for_construction(Ride* ride)
|
|||
void Ride::RemovePeeps()
|
||||
{
|
||||
// Find first station
|
||||
auto stationIndex = ride_get_first_valid_station_start(this);
|
||||
auto stationIndex = ride_get_first_valid_station_start(*this);
|
||||
|
||||
// Get exit position and direction
|
||||
auto exitPosition = CoordsXYZD{ 0, 0, 0, INVALID_DIRECTION };
|
||||
|
@ -340,7 +340,7 @@ void Ride::RemovePeeps()
|
|||
window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN;
|
||||
}
|
||||
|
||||
void ride_clear_blocked_tiles(Ride* ride)
|
||||
void ride_clear_blocked_tiles(const Ride& ride)
|
||||
{
|
||||
for (TileCoordsXY tilePos = {}; tilePos.x < gMapSize.x; ++tilePos.x)
|
||||
{
|
||||
|
@ -348,7 +348,7 @@ void ride_clear_blocked_tiles(Ride* ride)
|
|||
{
|
||||
for (auto* trackElement : TileElementsView<TrackElement>(tilePos.ToCoordsXY()))
|
||||
{
|
||||
if (trackElement->GetRideIndex() != ride->id)
|
||||
if (trackElement->GetRideIndex() != ride.id)
|
||||
continue;
|
||||
|
||||
// Unblock footpath element that is at same position
|
||||
|
@ -517,7 +517,7 @@ void ride_remove_provisional_track_piece()
|
|||
y -= CoordsDirectionDelta[direction].y;
|
||||
}
|
||||
CoordsXYE next_track;
|
||||
if (track_block_get_next_from_zero({ x, y, z }, ride, direction, &next_track, &z, &direction, true))
|
||||
if (track_block_get_next_from_zero({ x, y, z }, *ride, direction, &next_track, &z, &direction, true))
|
||||
{
|
||||
auto trackType = next_track.element->AsTrack()->GetTrackType();
|
||||
int32_t trackSequence = next_track.element->AsTrack()->GetSequenceIndex();
|
||||
|
@ -643,7 +643,7 @@ void ride_construction_set_default_next_piece()
|
|||
{
|
||||
case RideConstructionState::Front:
|
||||
direction = _currentTrackPieceDirection;
|
||||
if (!track_block_get_previous_from_zero(_currentTrackBegin, ride, direction, &trackBeginEnd))
|
||||
if (!track_block_get_previous_from_zero(_currentTrackBegin, *ride, direction, &trackBeginEnd))
|
||||
{
|
||||
ride_construction_reset_current_piece();
|
||||
return;
|
||||
|
@ -695,7 +695,7 @@ void ride_construction_set_default_next_piece()
|
|||
break;
|
||||
case RideConstructionState::Back:
|
||||
direction = DirectionReverse(_currentTrackPieceDirection);
|
||||
if (!track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &xyElement, &z, &direction, false))
|
||||
if (!track_block_get_next_from_zero(_currentTrackBegin, *ride, direction, &xyElement, &z, &direction, false))
|
||||
{
|
||||
ride_construction_reset_current_piece();
|
||||
return;
|
||||
|
@ -905,7 +905,7 @@ static bool ride_modify_entrance_or_exit(const CoordsXYE& tileElement)
|
|||
auto constructionWindow = window_find_by_class(WindowClass::RideConstruction);
|
||||
if (constructionWindow == nullptr)
|
||||
{
|
||||
if (!ride_initialise_construction_window(ride))
|
||||
if (!ride_initialise_construction_window(*ride))
|
||||
return false;
|
||||
|
||||
constructionWindow = window_find_by_class(WindowClass::RideConstruction);
|
||||
|
@ -1001,7 +1001,7 @@ bool ride_modify(const CoordsXYE& input)
|
|||
}
|
||||
|
||||
auto rideEntry = ride->GetRideEntry();
|
||||
if (rideEntry == nullptr || !ride_check_if_construction_allowed(ride))
|
||||
if (rideEntry == nullptr || !ride_check_if_construction_allowed(*ride))
|
||||
return false;
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
||||
|
@ -1096,7 +1096,7 @@ bool ride_modify(const CoordsXYE& input)
|
|||
*
|
||||
* rct2: 0x006CC3FB
|
||||
*/
|
||||
int32_t ride_initialise_construction_window(Ride* ride)
|
||||
int32_t ride_initialise_construction_window(Ride& ride)
|
||||
{
|
||||
rct_window* w;
|
||||
|
||||
|
@ -1106,24 +1106,20 @@ int32_t ride_initialise_construction_window(Ride* ride)
|
|||
return 0;
|
||||
|
||||
ride_clear_for_construction(ride);
|
||||
ride->RemovePeeps();
|
||||
ride.RemovePeeps();
|
||||
|
||||
w = ride_create_or_find_construction_window(ride->id);
|
||||
w = ride_create_or_find_construction_window(ride.id);
|
||||
|
||||
tool_set(*w, WC_RIDE_CONSTRUCTION__WIDX_CONSTRUCT, Tool::Crosshair);
|
||||
input_set_flag(INPUT_FLAG_6, true);
|
||||
|
||||
ride = get_ride(_currentRideIndex);
|
||||
if (ride == nullptr)
|
||||
return 0;
|
||||
|
||||
_currentTrackCurve = ride->GetRideTypeDescriptor().StartTrackPiece | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackCurve = ride.GetRideTypeDescriptor().StartTrackPiece | RideConstructionSpecialPieceSelected;
|
||||
_currentTrackSlopeEnd = 0;
|
||||
_currentTrackBankEnd = 0;
|
||||
_currentTrackLiftHill = 0;
|
||||
_currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES;
|
||||
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED))
|
||||
_currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_TYPE;
|
||||
|
||||
_previousTrackBankEnd = 0;
|
||||
|
@ -1141,7 +1137,7 @@ int32_t ride_initialise_construction_window(Ride* ride)
|
|||
*
|
||||
* rct2: 0x006CB7FB
|
||||
*/
|
||||
int32_t ride_get_refund_price(const Ride* ride)
|
||||
int32_t ride_get_refund_price(const Ride& ride)
|
||||
{
|
||||
CoordsXYE trackElement;
|
||||
money32 cost = 0;
|
||||
|
@ -1598,7 +1594,7 @@ bool ride_select_backwards_from_front()
|
|||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
track_begin_end trackBeginEnd;
|
||||
if (track_block_get_previous_from_zero(_currentTrackBegin, ride, _currentTrackPieceDirection, &trackBeginEnd))
|
||||
if (track_block_get_previous_from_zero(_currentTrackBegin, *ride, _currentTrackPieceDirection, &trackBeginEnd))
|
||||
{
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin.x = trackBeginEnd.begin_x;
|
||||
|
@ -1623,7 +1619,7 @@ bool ride_select_forwards_from_back()
|
|||
int32_t z = _currentTrackBegin.z;
|
||||
int32_t direction = DirectionReverse(_currentTrackPieceDirection);
|
||||
CoordsXYE next_track;
|
||||
if (track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &next_track, &z, &direction, false))
|
||||
if (track_block_get_next_from_zero(_currentTrackBegin, *ride, direction, &next_track, &z, &direction, false))
|
||||
{
|
||||
_rideConstructionState = RideConstructionState::Selected;
|
||||
_currentTrackBegin.x = next_track.x;
|
||||
|
@ -1642,12 +1638,12 @@ bool ride_select_forwards_from_back()
|
|||
*
|
||||
* rct2: 0x006B58EF
|
||||
*/
|
||||
ResultWithMessage ride_are_all_possible_entrances_and_exits_built(Ride* ride)
|
||||
ResultWithMessage ride_are_all_possible_entrances_and_exits_built(const Ride& ride)
|
||||
{
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY))
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_IS_SHOP_OR_FACILITY))
|
||||
return { true };
|
||||
|
||||
for (auto& station : ride->GetStations())
|
||||
for (auto& station : ride.GetStations())
|
||||
{
|
||||
if (station.Start.IsNull())
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
enum class ResearchCategory : uint8_t;
|
||||
|
||||
using ride_ratings_calculation = void (*)(Ride* ride, RideRatingUpdateState& state);
|
||||
using ride_ratings_calculation = void (*)(Ride& ride, RideRatingUpdateState& state);
|
||||
|
||||
struct RideComponentName
|
||||
{
|
||||
|
@ -158,15 +158,15 @@ struct UpkeepCostsDescriptor
|
|||
|
||||
using RideTrackGroup = OpenRCT2::BitSet<TRACK_GROUP_COUNT>;
|
||||
using UpdateRideApproachVehicleWaypointsFunction = void (*)(Guest&, const CoordsXY&, int16_t&);
|
||||
using RideMusicUpdateFunction = void (*)(Ride*);
|
||||
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride*, CoordsXYZD&);
|
||||
using RideMusicUpdateFunction = void (*)(Ride&);
|
||||
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride&, CoordsXYZD&);
|
||||
using StartRideMusicFunction = void (*)(const OpenRCT2::RideAudio::ViewportRideMusicInstance&);
|
||||
using LightFXAddLightsMagicVehicleFunction = void (*)(const Vehicle* vehicle);
|
||||
using RideLocationFunction = CoordsXY (*)(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation);
|
||||
using RideUpdateFunction = void (*)(Ride& ride);
|
||||
using RideUpdateMeasurementsSpecialElementsFunc = void (*)(Ride* ride, const track_type_t trackType);
|
||||
using RideUpdateMeasurementsSpecialElementsFunc = void (*)(Ride& ride, const track_type_t trackType);
|
||||
using MusicTrackOffsetLengthFunc = std::pair<size_t, size_t> (*)(const Ride& ride);
|
||||
using SpecialElementRatingAdjustmentFunc = void (*)(const Ride* ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
using SpecialElementRatingAdjustmentFunc = void (*)(const Ride& ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
|
||||
using UpdateRotatingFunction = void (*)(Vehicle& vehicle);
|
||||
enum class RideConstructionWindowContext : uint8_t
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,95 +59,95 @@ extern RideRatingUpdateState gRideRatingUpdateState;
|
|||
void ride_ratings_update_ride(const Ride& ride);
|
||||
void ride_ratings_update_all();
|
||||
|
||||
using ride_ratings_calculation = void (*)(Ride* ride, RideRatingUpdateState& state);
|
||||
using ride_ratings_calculation = void (*)(Ride& ride, RideRatingUpdateState& state);
|
||||
ride_ratings_calculation ride_ratings_get_calculate_func(ride_type_t rideType);
|
||||
|
||||
void ride_ratings_calculate_spiral_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_stand_up_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_suspended_swinging_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_junior_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_miniature_railway(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_monorail(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_suspended_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_boat_hire(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wooden_wild_mouse(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_steeplechase(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_car_ride(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_launched_freefall(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_bobsleigh_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_observation_tower(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_looping_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_dinghy_slide(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mine_train_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_chairlift(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_corkscrew_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_maze(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_spiral_slide(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_go_karts(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_log_flume(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_river_rapids(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_dodgems(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_swinging_ship(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverter_ship(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_food_stall(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_shop(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_merry_go_round(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_information_kiosk(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_toilets(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_ferris_wheel(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_motion_simulator(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_3d_cinema(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_top_spin(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_space_rings(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_reverse_freefall_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lift(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_vertical_drop_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_cash_machine(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_twist(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_haunted_house(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_first_aid(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_circus(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_ghost_train(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_twister_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wooden_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_side_friction_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wild_mouse(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_multi_dimension_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_flying_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_virginia_reel(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_splash_boats(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_helicopters(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lay_down_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_suspended_monorail(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_reverser_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_heartline_twister_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_golf(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_giga_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_roto_drop(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_flying_saucers(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_crooked_house(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_monorail_cycles(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_compact_inverted_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_water_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_air_powered_vertical_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_hairpin_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_magic_carpet(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_submarine_ride(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_river_rafts(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_enterprise(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_impulse_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mine_ride(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lim_launched_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_classic_mini_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_hybrid_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_single_rail_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_alpine_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_classic_wooden_roller_coaster(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_drink_stall(Ride* ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_spiral_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_stand_up_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_suspended_swinging_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_junior_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_miniature_railway(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_monorail(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_suspended_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_boat_hire(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wooden_wild_mouse(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_steeplechase(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_car_ride(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_launched_freefall(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_bobsleigh_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_observation_tower(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_looping_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_dinghy_slide(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mine_train_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_chairlift(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_corkscrew_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_maze(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_spiral_slide(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_go_karts(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_log_flume(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_river_rapids(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_dodgems(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_swinging_ship(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverter_ship(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_food_stall(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_shop(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_merry_go_round(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_information_kiosk(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_toilets(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_ferris_wheel(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_motion_simulator(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_3d_cinema(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_top_spin(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_space_rings(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_reverse_freefall_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lift(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_vertical_drop_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_cash_machine(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_twist(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_haunted_house(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_first_aid(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_circus(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_ghost_train(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_twister_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wooden_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_side_friction_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_wild_mouse(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_multi_dimension_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_flying_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_virginia_reel(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_splash_boats(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_helicopters(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lay_down_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_suspended_monorail(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_reverser_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_heartline_twister_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_golf(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_giga_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_roto_drop(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_flying_saucers(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_crooked_house(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_monorail_cycles(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_compact_inverted_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_water_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_air_powered_vertical_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_hairpin_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_magic_carpet(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_submarine_ride(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_river_rafts(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_enterprise(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_inverted_impulse_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mini_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_mine_ride(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_lim_launched_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_classic_mini_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_hybrid_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_single_rail_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_alpine_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_classic_wooden_roller_coaster(Ride& ride, RideRatingUpdateState& state);
|
||||
void ride_ratings_calculate_drink_stall(Ride& ride, RideRatingUpdateState& state);
|
||||
|
||||
// Special Track Element Adjustment functions for RTDs
|
||||
void SpecialTrackElementRatingsAjustment_Default(const Ride* ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
void SpecialTrackElementRatingsAjustment_GhostTrain(const Ride* ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
void SpecialTrackElementRatingsAjustment_LogFlume(const Ride* ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
void SpecialTrackElementRatingsAjustment_Default(const Ride& ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
void SpecialTrackElementRatingsAjustment_GhostTrain(const Ride& ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
void SpecialTrackElementRatingsAjustment_LogFlume(const Ride& ride, int32_t& excitement, int32_t& intensity, int32_t& nausea);
|
||||
|
|
|
@ -17,23 +17,23 @@
|
|||
#include "Track.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
static void ride_update_station_blocksection(Ride* ride, StationIndex stationIndex);
|
||||
static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex);
|
||||
static void ride_update_station_normal(Ride* ride, StationIndex stationIndex);
|
||||
static void ride_update_station_race(Ride* ride, StationIndex stationIndex);
|
||||
static void ride_race_init_vehicle_speeds(Ride* ride);
|
||||
static void ride_invalidate_station_start(Ride* ride, StationIndex stationIndex, bool greenLight);
|
||||
static void ride_update_station_blocksection(Ride& ride, StationIndex stationIndex);
|
||||
static void ride_update_station_dodgems(Ride& ride, StationIndex stationIndex);
|
||||
static void ride_update_station_normal(Ride& ride, StationIndex stationIndex);
|
||||
static void ride_update_station_race(Ride& ride, StationIndex stationIndex);
|
||||
static void ride_race_init_vehicle_speeds(const Ride& ride);
|
||||
static void ride_invalidate_station_start(Ride& ride, StationIndex stationIndex, bool greenLight);
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ABFFB
|
||||
*/
|
||||
void ride_update_station(Ride* ride, StationIndex stationIndex)
|
||||
void ride_update_station(Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
if (ride->GetStation(stationIndex).Start.IsNull())
|
||||
if (ride.GetStation(stationIndex).Start.IsNull())
|
||||
return;
|
||||
|
||||
switch (ride->mode)
|
||||
switch (ride.mode)
|
||||
{
|
||||
case RideMode::Race:
|
||||
ride_update_station_race(ride, stationIndex);
|
||||
|
@ -55,12 +55,12 @@ void ride_update_station(Ride* ride, StationIndex stationIndex)
|
|||
*
|
||||
* rct2: 0x006AC0A1
|
||||
*/
|
||||
static void ride_update_station_blocksection(Ride* ride, StationIndex stationIndex)
|
||||
static void ride_update_station_blocksection(Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
TileElement* tileElement = ride_get_station_start_track_element(ride, stationIndex);
|
||||
auto& station = ride->GetStation(stationIndex);
|
||||
auto& station = ride.GetStation(stationIndex);
|
||||
|
||||
if ((ride->status == RideStatus::Closed && ride->num_riders == 0)
|
||||
if ((ride.status == RideStatus::Closed && ride.num_riders == 0)
|
||||
|| (tileElement != nullptr && tileElement->AsTrack()->IsBrakeClosed()))
|
||||
{
|
||||
station.Depart &= ~STATION_DEPART_FLAG;
|
||||
|
@ -86,25 +86,25 @@ static void ride_update_station_blocksection(Ride* ride, StationIndex stationInd
|
|||
*
|
||||
* rct2: 0x006AC12B
|
||||
*/
|
||||
static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex)
|
||||
static void ride_update_station_dodgems(Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
auto& station = ride->GetStation(stationIndex);
|
||||
auto& station = ride.GetStation(stationIndex);
|
||||
|
||||
// Change of station depart flag should really call invalidate_station_start
|
||||
// but since dodgems do not have station lights there is no point.
|
||||
if (ride->status == RideStatus::Closed || (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)))
|
||||
if (ride.status == RideStatus::Closed || (ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)))
|
||||
{
|
||||
station.Depart &= ~STATION_DEPART_FLAG;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
|
||||
if (ride.lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
|
||||
{
|
||||
int32_t dx = ride->time_limit * 32;
|
||||
int32_t dx = ride.time_limit * 32;
|
||||
int32_t dh = (dx >> 8) & 0xFF;
|
||||
for (size_t i = 0; i < ride->NumTrains; i++)
|
||||
for (size_t i = 0; i < ride.NumTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
|
@ -112,7 +112,7 @@ static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex)
|
|||
continue;
|
||||
|
||||
// End match
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
station.Depart &= ~STATION_DEPART_FLAG;
|
||||
return;
|
||||
}
|
||||
|
@ -123,9 +123,9 @@ static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex)
|
|||
else
|
||||
{
|
||||
// Check if all vehicles are ready to go
|
||||
for (size_t i = 0; i < ride->NumTrains; i++)
|
||||
for (size_t i = 0; i < ride.NumTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
|
@ -137,9 +137,9 @@ static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex)
|
|||
}
|
||||
|
||||
// Begin the match
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
ride.lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
station.Depart |= STATION_DEPART_FLAG;
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,12 +147,12 @@ static void ride_update_station_dodgems(Ride* ride, StationIndex stationIndex)
|
|||
*
|
||||
* rct2: 0x006AC02C
|
||||
*/
|
||||
static void ride_update_station_normal(Ride* ride, StationIndex stationIndex)
|
||||
static void ride_update_station_normal(Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
auto& station = ride->GetStation(stationIndex);
|
||||
auto& station = ride.GetStation(stationIndex);
|
||||
int32_t time = station.Depart & STATION_DEPART_MASK;
|
||||
if ((ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
|| (ride->status == RideStatus::Closed && ride->num_riders == 0))
|
||||
if ((ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
|| (ride.status == RideStatus::Closed && ride.num_riders == 0))
|
||||
{
|
||||
if (time != 0 && time != 127 && !(gCurrentTicks & 7))
|
||||
time--;
|
||||
|
@ -182,10 +182,10 @@ static void ride_update_station_normal(Ride* ride, StationIndex stationIndex)
|
|||
*
|
||||
* rct2: 0x006AC1DF
|
||||
*/
|
||||
static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
||||
static void ride_update_station_race(Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
auto& station = ride->GetStation(stationIndex);
|
||||
if (ride->status == RideStatus::Closed || (ride->lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)))
|
||||
auto& station = ride.GetStation(stationIndex);
|
||||
if (ride.status == RideStatus::Closed || (ride.lifecycle_flags & (RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED)))
|
||||
{
|
||||
if (station.Depart & STATION_DEPART_FLAG)
|
||||
{
|
||||
|
@ -195,13 +195,13 @@ static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
|
||||
if (ride.lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
|
||||
{
|
||||
int32_t numLaps = ride->NumLaps;
|
||||
int32_t numLaps = ride.NumLaps;
|
||||
|
||||
for (size_t i = 0; i < ride->NumTrains; i++)
|
||||
for (size_t i = 0; i < ride.NumTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
|
@ -213,13 +213,13 @@ static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
|||
auto* peep = GetEntity<Guest>(vehicle->peep[0]);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
ride->race_winner = peep->sprite_index;
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
ride.race_winner = peep->sprite_index;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
// Race is over
|
||||
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
ride.lifecycle_flags &= ~RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
if (station.Depart & STATION_DEPART_FLAG)
|
||||
{
|
||||
station.Depart &= ~STATION_DEPART_FLAG;
|
||||
|
@ -235,9 +235,9 @@ static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
|||
else
|
||||
{
|
||||
// Check if all vehicles are ready to go
|
||||
for (size_t i = 0; i < ride->NumTrains; i++)
|
||||
for (size_t i = 0; i < ride.NumTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
|
@ -254,13 +254,13 @@ static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
|||
|
||||
// Begin the race
|
||||
ride_race_init_vehicle_speeds(ride);
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
ride.lifecycle_flags |= RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING;
|
||||
if (!(station.Depart & STATION_DEPART_FLAG))
|
||||
{
|
||||
station.Depart |= STATION_DEPART_FLAG;
|
||||
ride_invalidate_station_start(ride, stationIndex, true);
|
||||
}
|
||||
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,11 +270,11 @@ static void ride_update_station_race(Ride* ride, StationIndex stationIndex)
|
|||
* set the speed of the go kart type vehicle at the start to a random value or alter if peep name is an easter egg
|
||||
* @param ride (esi)
|
||||
*/
|
||||
static void ride_race_init_vehicle_speeds(Ride* ride)
|
||||
static void ride_race_init_vehicle_speeds(const Ride& ride)
|
||||
{
|
||||
for (size_t i = 0; i < ride->NumTrains; i++)
|
||||
for (size_t i = 0; i < ride.NumTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
|
@ -318,9 +318,9 @@ static void ride_race_init_vehicle_speeds(Ride* ride)
|
|||
*
|
||||
* rct2: 0x006AC2C7
|
||||
*/
|
||||
static void ride_invalidate_station_start(Ride* ride, StationIndex stationIndex, bool greenLight)
|
||||
static void ride_invalidate_station_start(Ride& ride, StationIndex stationIndex, bool greenLight)
|
||||
{
|
||||
auto startPos = ride->GetStation(stationIndex).Start;
|
||||
auto startPos = ride.GetStation(stationIndex).Start;
|
||||
TileElement* tileElement = ride_get_station_start_track_element(ride, stationIndex);
|
||||
|
||||
// If no station track found return
|
||||
|
@ -333,9 +333,9 @@ static void ride_invalidate_station_start(Ride* ride, StationIndex stationIndex,
|
|||
MapInvalidateTileZoom1({ startPos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
|
||||
}
|
||||
|
||||
TileElement* ride_get_station_start_track_element(const Ride* ride, StationIndex stationIndex)
|
||||
TileElement* ride_get_station_start_track_element(const Ride& ride, StationIndex stationIndex)
|
||||
{
|
||||
auto stationStart = ride->GetStation(stationIndex).GetStart();
|
||||
auto stationStart = ride.GetStation(stationIndex).GetStart();
|
||||
|
||||
// Find the station track element
|
||||
TileElement* tileElement = MapGetFirstElementAt(stationStart);
|
||||
|
@ -368,37 +368,37 @@ TileElement* ride_get_station_exit_element(const CoordsXYZ& elementPos)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
StationIndex ride_get_first_valid_station_exit(Ride* ride)
|
||||
StationIndex ride_get_first_valid_station_exit(const Ride& ride)
|
||||
{
|
||||
for (const auto& station : ride->GetStations())
|
||||
for (const auto& station : ride.GetStations())
|
||||
{
|
||||
if (!station.Exit.IsNull())
|
||||
{
|
||||
return ride->GetStationIndex(&station);
|
||||
return ride.GetStationIndex(&station);
|
||||
}
|
||||
}
|
||||
return StationIndex::GetNull();
|
||||
}
|
||||
|
||||
StationIndex ride_get_first_valid_station_start(const Ride* ride)
|
||||
StationIndex ride_get_first_valid_station_start(const Ride& ride)
|
||||
{
|
||||
for (const auto& station : ride->GetStations())
|
||||
for (const auto& station : ride.GetStations())
|
||||
{
|
||||
if (!station.Start.IsNull())
|
||||
{
|
||||
return ride->GetStationIndex(&station);
|
||||
return ride.GetStationIndex(&station);
|
||||
}
|
||||
}
|
||||
return StationIndex::GetNull();
|
||||
}
|
||||
|
||||
StationIndex ride_get_first_empty_station_start(const Ride* ride)
|
||||
StationIndex ride_get_first_empty_station_start(const Ride& ride)
|
||||
{
|
||||
for (const auto& station : ride->GetStations())
|
||||
for (const auto& station : ride.GetStations())
|
||||
{
|
||||
if (station.Start.IsNull())
|
||||
{
|
||||
return ride->GetStationIndex(&station);
|
||||
return ride.GetStationIndex(&station);
|
||||
}
|
||||
}
|
||||
return StationIndex::GetNull();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
struct Ride;
|
||||
struct TileCoordsXYZD;
|
||||
|
||||
void ride_update_station(Ride* ride, StationIndex stationIndex);
|
||||
StationIndex ride_get_first_valid_station_exit(Ride* ride);
|
||||
StationIndex ride_get_first_valid_station_start(const Ride* ride);
|
||||
StationIndex ride_get_first_empty_station_start(const Ride* ride);
|
||||
void ride_update_station(Ride& ride, StationIndex stationIndex);
|
||||
StationIndex ride_get_first_valid_station_exit(const Ride& ride);
|
||||
StationIndex ride_get_first_valid_station_start(const Ride& ride);
|
||||
StationIndex ride_get_first_empty_station_start(const Ride& ride);
|
||||
|
|
|
@ -93,15 +93,15 @@ static TileElement* find_station_element(const CoordsXYZD& loc, RideId rideIndex
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void ride_remove_station(Ride* ride, const CoordsXYZ& location)
|
||||
static void ride_remove_station(Ride& ride, const CoordsXYZ& location)
|
||||
{
|
||||
for (auto& station : ride->GetStations())
|
||||
for (auto& station : ride.GetStations())
|
||||
{
|
||||
auto stationStart = station.GetStart();
|
||||
if (stationStart == location)
|
||||
{
|
||||
station.Start.SetNull();
|
||||
ride->num_stations--;
|
||||
ride.num_stations--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ ResultWithMessage track_add_station_element(CoordsXYZD loc, RideId rideIndex, in
|
|||
}
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
auto stationIndex = ride_get_first_empty_station_start(ride);
|
||||
auto stationIndex = ride_get_first_empty_station_start(*ride);
|
||||
assert(!stationIndex.IsNull());
|
||||
|
||||
auto& station = ride->GetStation(stationIndex);
|
||||
|
@ -158,7 +158,7 @@ ResultWithMessage track_add_station_element(CoordsXYZD loc, RideId rideIndex, in
|
|||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
ride_remove_station(ride, loc);
|
||||
ride_remove_station(*ride, loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ ResultWithMessage track_add_station_element(CoordsXYZD loc, RideId rideIndex, in
|
|||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
ride_remove_station(ride, loc);
|
||||
ride_remove_station(*ride, loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ ResultWithMessage track_add_station_element(CoordsXYZD loc, RideId rideIndex, in
|
|||
track_type_t targetTrackType;
|
||||
if (stationFrontLoc == loc)
|
||||
{
|
||||
auto stationIndex = ride_get_first_empty_station_start(ride);
|
||||
auto stationIndex = ride_get_first_empty_station_start(*ride);
|
||||
if (stationIndex.IsNull())
|
||||
{
|
||||
log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides.");
|
||||
|
@ -280,7 +280,7 @@ ResultWithMessage track_remove_station_element(const CoordsXYZD& loc, RideId rid
|
|||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
ride_remove_station(ride, loc);
|
||||
ride_remove_station(*ride, loc);
|
||||
}
|
||||
}
|
||||
return { true };
|
||||
|
@ -296,7 +296,7 @@ ResultWithMessage track_remove_station_element(const CoordsXYZD& loc, RideId rid
|
|||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
ride_remove_station(ride, currentLoc);
|
||||
ride_remove_station(*ride, currentLoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ ResultWithMessage track_remove_station_element(const CoordsXYZD& loc, RideId rid
|
|||
{
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
ride_remove_station(ride, currentLoc);
|
||||
ride_remove_station(*ride, currentLoc);
|
||||
}
|
||||
}
|
||||
stationFrontLoc = currentLoc;
|
||||
|
@ -352,7 +352,7 @@ ResultWithMessage track_remove_station_element(const CoordsXYZD& loc, RideId rid
|
|||
track_type_t targetTrackType;
|
||||
if ((currentLoc == stationFrontLoc) || (currentLoc + CoordsDirectionDelta[currentLoc.direction] == removeLoc))
|
||||
{
|
||||
auto stationIndex = ride_get_first_empty_station_start(ride);
|
||||
auto stationIndex = ride_get_first_empty_station_start(*ride);
|
||||
if (stationIndex.IsNull())
|
||||
{
|
||||
log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides.");
|
||||
|
|
|
@ -175,7 +175,7 @@ ResultWithMessage TrackDesign::CreateTrackDesign(TrackDesignState& tds, const Ri
|
|||
ResultWithMessage TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, const Ride& ride)
|
||||
{
|
||||
CoordsXYE trackElement;
|
||||
if (!ride_try_get_origin_element(&ride, &trackElement))
|
||||
if (!ride_try_get_origin_element(ride, &trackElement))
|
||||
{
|
||||
return { false, STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY };
|
||||
}
|
||||
|
@ -336,7 +336,8 @@ ResultWithMessage TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, con
|
|||
}
|
||||
}
|
||||
|
||||
TrackDesignPreviewDrawOutlines(tds, this, GetOrAllocateRide(PreviewRideId), { 4096, 4096, 0, _currentTrackPieceDirection });
|
||||
TrackDesignPreviewDrawOutlines(
|
||||
tds, this, *GetOrAllocateRide(PreviewRideId), { 4096, 4096, 0, _currentTrackPieceDirection });
|
||||
|
||||
// Resave global vars for scenery reasons.
|
||||
tds.Origin = startPos;
|
||||
|
@ -455,7 +456,8 @@ ResultWithMessage TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, cons
|
|||
|
||||
// Save global vars as they are still used by scenery????
|
||||
int32_t startZ = tds.Origin.z;
|
||||
TrackDesignPreviewDrawOutlines(tds, this, GetOrAllocateRide(PreviewRideId), { 4096, 4096, 0, _currentTrackPieceDirection });
|
||||
TrackDesignPreviewDrawOutlines(
|
||||
tds, this, *GetOrAllocateRide(PreviewRideId), { 4096, 4096, 0, _currentTrackPieceDirection });
|
||||
tds.Origin = { startLoc.x, startLoc.y, startZ };
|
||||
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
|
@ -1346,7 +1348,8 @@ static GameActions::Result TrackDesignPlaceAllScenery(
|
|||
return res;
|
||||
}
|
||||
|
||||
static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesign* td6, const CoordsXYZ& coords, Ride* ride)
|
||||
static GameActions::Result TrackDesignPlaceMaze(
|
||||
TrackDesignState& tds, TrackDesign* td6, const CoordsXYZ& coords, const Ride& ride)
|
||||
{
|
||||
if (tds.PlaceOperation == PTD_OPERATION_DRAW_OUTLINES)
|
||||
{
|
||||
|
@ -1413,7 +1416,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
|
|||
flags |= GAME_COMMAND_FLAG_REPLAY;
|
||||
}
|
||||
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
|
||||
mapCoord, rotation, ride->id, StationIndex::FromUnderlying(0), false);
|
||||
mapCoord, rotation, ride.id, StationIndex::FromUnderlying(0), false);
|
||||
rideEntranceExitPlaceAction.SetFlags(flags);
|
||||
auto res = GameActions::ExecuteNested(&rideEntranceExitPlaceAction);
|
||||
if (res.Error != GameActions::Status::Ok)
|
||||
|
@ -1458,7 +1461,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
|
|||
flags |= GAME_COMMAND_FLAG_REPLAY;
|
||||
}
|
||||
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
|
||||
mapCoord, rotation, ride->id, StationIndex::FromUnderlying(0), true);
|
||||
mapCoord, rotation, ride.id, StationIndex::FromUnderlying(0), true);
|
||||
rideEntranceExitPlaceAction.SetFlags(flags);
|
||||
auto res = GameActions::ExecuteNested(&rideEntranceExitPlaceAction);
|
||||
if (res.Error != GameActions::Status::Ok)
|
||||
|
@ -1495,7 +1498,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
|
|||
flags |= GAME_COMMAND_FLAG_REPLAY;
|
||||
}
|
||||
|
||||
auto mazePlace = MazePlaceTrackAction({ mapCoord, coords.z }, ride->id, maze_entry);
|
||||
auto mazePlace = MazePlaceTrackAction({ mapCoord, coords.z }, ride.id, maze_entry);
|
||||
mazePlace.SetFlags(flags);
|
||||
auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&mazePlace)
|
||||
: GameActions::QueryNested(&mazePlace);
|
||||
|
@ -1546,7 +1549,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
|
|||
|
||||
if (tds.PlaceOperation == PTD_OPERATION_REMOVE_GHOST)
|
||||
{
|
||||
auto gameAction = RideDemolishAction(ride->id, RIDE_MODIFY_DEMOLISH);
|
||||
auto gameAction = RideDemolishAction(ride.id, RIDE_MODIFY_DEMOLISH);
|
||||
gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
|
||||
GameActions::Execute(&gameAction);
|
||||
}
|
||||
|
@ -1559,7 +1562,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
|
|||
return res;
|
||||
}
|
||||
|
||||
static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesign* td6, const CoordsXYZ& origin, Ride* ride)
|
||||
static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesign* td6, const CoordsXYZ& origin, Ride& ride)
|
||||
{
|
||||
tds.Origin = origin;
|
||||
if (tds.PlaceOperation == PTD_OPERATION_DRAW_OUTLINES)
|
||||
|
@ -1649,7 +1652,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
|
|||
}
|
||||
|
||||
auto trackPlaceAction = TrackPlaceAction(
|
||||
ride->id, trackType, ride->type, { newCoords, tempZ, static_cast<uint8_t>(rotation) }, brakeSpeed,
|
||||
ride.id, trackType, ride.type, { newCoords, tempZ, static_cast<uint8_t>(rotation) }, brakeSpeed,
|
||||
trackColour, seatRotation, liftHillAndAlternativeState, true);
|
||||
trackPlaceAction.SetFlags(flags);
|
||||
|
||||
|
@ -1786,7 +1789,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
|
|||
}
|
||||
|
||||
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
|
||||
newCoords, rotation, ride->id, stationIndex, entrance.isExit);
|
||||
newCoords, rotation, ride.id, stationIndex, entrance.isExit);
|
||||
rideEntranceExitPlaceAction.SetFlags(flags);
|
||||
auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&rideEntranceExitPlaceAction)
|
||||
: GameActions::QueryNested(&rideEntranceExitPlaceAction);
|
||||
|
@ -1823,8 +1826,8 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
|
|||
|
||||
if (tds.PlaceOperation == PTD_OPERATION_REMOVE_GHOST)
|
||||
{
|
||||
ride->ValidateStations();
|
||||
ride->Delete();
|
||||
ride.ValidateStations();
|
||||
ride.Delete();
|
||||
}
|
||||
|
||||
auto res = GameActions::Result(GameActions::Status::Ok, STR_NONE, STR_NONE);
|
||||
|
@ -1847,7 +1850,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
|
|||
* rct2: 0x006D01B3
|
||||
*/
|
||||
static GameActions::Result TrackDesignPlaceVirtual(
|
||||
TrackDesignState& tds, TrackDesign* td6, uint8_t ptdOperation, bool placeScenery, Ride* ride, const CoordsXYZD& coords)
|
||||
TrackDesignState& tds, TrackDesign* td6, uint8_t ptdOperation, bool placeScenery, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
_trackDesignPlaceStateSceneryUnavailable = false;
|
||||
_trackDesignPlaceStateEntranceExitPlaced = false;
|
||||
|
@ -1872,7 +1875,7 @@ static GameActions::Result TrackDesignPlaceVirtual(
|
|||
// NOTE: We need to save this, in networked games this would affect all clients otherwise.
|
||||
auto savedRideId = _currentRideIndex;
|
||||
auto savedTrackPieceDirection = _currentTrackPieceDirection;
|
||||
_currentRideIndex = ride->id;
|
||||
_currentRideIndex = ride.id;
|
||||
_currentTrackPieceDirection = coords.direction;
|
||||
|
||||
GameActions::Result trackPlaceRes;
|
||||
|
@ -1915,7 +1918,7 @@ static GameActions::Result TrackDesignPlaceVirtual(
|
|||
return res;
|
||||
}
|
||||
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool placeScenery, Ride* ride, const CoordsXYZD& coords)
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool placeScenery, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
uint32_t ptdOperation = (flags & GAME_COMMAND_FLAG_APPLY) != 0 ? PTD_OPERATION_PLACE : PTD_OPERATION_PLACE_QUERY;
|
||||
if ((flags & GAME_COMMAND_FLAG_APPLY) != 0 && (flags & GAME_COMMAND_FLAG_GHOST) != 0)
|
||||
|
@ -1929,18 +1932,18 @@ GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool plac
|
|||
return TrackDesignPlaceVirtual(tds, td6, ptdOperation, placeScenery, ride, coords);
|
||||
}
|
||||
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td6, Ride* ride, const CoordsXYZD& coords)
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
TrackDesignState tds{};
|
||||
TrackDesignPlaceVirtual(tds, td6, PTD_OPERATION_REMOVE_GHOST, true, ride, coords);
|
||||
}
|
||||
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td6, Ride* ride, const CoordsXYZD& coords)
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td6, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
TrackDesignPlaceVirtual(tds, td6, PTD_OPERATION_DRAW_OUTLINES, true, ride, coords);
|
||||
}
|
||||
|
||||
static int32_t TrackDesignGetZPlacement(TrackDesignState& tds, TrackDesign* td6, Ride* ride, const CoordsXYZD& coords)
|
||||
static int32_t TrackDesignGetZPlacement(TrackDesignState& tds, TrackDesign* td6, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
TrackDesignPlaceVirtual(tds, td6, PTD_OPERATION_GET_PLACE_Z, true, ride, coords);
|
||||
|
||||
|
@ -1949,7 +1952,7 @@ static int32_t TrackDesignGetZPlacement(TrackDesignState& tds, TrackDesign* td6,
|
|||
return tds.PlaceZ - tds.PlaceSceneryZ;
|
||||
}
|
||||
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride* ride, const CoordsXYZD& coords)
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords)
|
||||
{
|
||||
TrackDesignState tds{};
|
||||
return TrackDesignGetZPlacement(tds, td6, ride, coords);
|
||||
|
@ -2033,7 +2036,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
|
|||
|
||||
_currentTrackPieceDirection = 0;
|
||||
int32_t z = TrackDesignGetZPlacement(
|
||||
tds, td6, GetOrAllocateRide(PreviewRideId), { mapSize.x, mapSize.y, 16, _currentTrackPieceDirection });
|
||||
tds, td6, *GetOrAllocateRide(PreviewRideId), { mapSize.x, mapSize.y, 16, _currentTrackPieceDirection });
|
||||
|
||||
if (tds.HasScenery)
|
||||
{
|
||||
|
@ -2050,7 +2053,7 @@ static bool TrackDesignPlacePreview(TrackDesignState& tds, TrackDesign* td6, mon
|
|||
}
|
||||
|
||||
auto res = TrackDesignPlaceVirtual(
|
||||
tds, td6, PTD_OPERATION_PLACE_TRACK_PREVIEW, placeScenery, ride,
|
||||
tds, td6, PTD_OPERATION_PLACE_TRACK_PREVIEW, placeScenery, *ride,
|
||||
{ mapSize.x, mapSize.y, z, _currentTrackPieceDirection });
|
||||
gParkFlags = backup_park_flags;
|
||||
|
||||
|
|
|
@ -225,10 +225,10 @@ extern RideId gTrackDesignSaveRideIndex;
|
|||
|
||||
void TrackDesignMirror(TrackDesign* td6);
|
||||
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool placeScenery, Ride* ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td6, Ride* ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td6, Ride* ride, const CoordsXYZD& coords);
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride* ride, const CoordsXYZD& coords);
|
||||
GameActions::Result TrackDesignPlace(TrackDesign* td6, uint32_t flags, bool placeScenery, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewRemoveGhosts(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
void TrackDesignPreviewDrawOutlines(TrackDesignState& tds, TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride& ride, const CoordsXYZD& coords);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Track design preview
|
||||
|
|
|
@ -1266,7 +1266,7 @@ bool Vehicle::CloseRestraints()
|
|||
{
|
||||
curRide->lifecycle_flags |= RIDE_LIFECYCLE_BROKEN_DOWN;
|
||||
|
||||
ride_breakdown_add_news_item(curRide);
|
||||
ride_breakdown_add_news_item(*curRide);
|
||||
|
||||
curRide->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST
|
||||
| RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
@ -1382,7 +1382,7 @@ bool Vehicle::OpenRestraints()
|
|||
{
|
||||
curRide->lifecycle_flags |= RIDE_LIFECYCLE_BROKEN_DOWN;
|
||||
|
||||
ride_breakdown_add_news_item(curRide);
|
||||
ride_breakdown_add_news_item(*curRide);
|
||||
|
||||
curRide->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST
|
||||
| RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
@ -1413,33 +1413,33 @@ bool Vehicle::OpenRestraints()
|
|||
return restraintsOpen;
|
||||
}
|
||||
|
||||
void RideUpdateMeasurementsSpecialElements_Default(Ride* ride, const track_type_t trackType)
|
||||
void RideUpdateMeasurementsSpecialElements_Default(Ride& ride, const track_type_t trackType)
|
||||
{
|
||||
const auto& ted = GetTrackElementDescriptor(trackType);
|
||||
uint16_t trackFlags = ted.Flags;
|
||||
if (trackFlags & TRACK_ELEM_FLAG_NORMAL_TO_INVERSION)
|
||||
{
|
||||
if (ride->inversions < OpenRCT2::Limits::MaxInversions)
|
||||
ride->inversions++;
|
||||
if (ride.inversions < OpenRCT2::Limits::MaxInversions)
|
||||
ride.inversions++;
|
||||
}
|
||||
}
|
||||
|
||||
void RideUpdateMeasurementsSpecialElements_MiniGolf(Ride* ride, const track_type_t trackType)
|
||||
void RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const track_type_t trackType)
|
||||
{
|
||||
const auto& ted = GetTrackElementDescriptor(trackType);
|
||||
uint16_t trackFlags = ted.Flags;
|
||||
if (trackFlags & TRACK_ELEM_FLAG_IS_GOLF_HOLE)
|
||||
{
|
||||
if (ride->holes < OpenRCT2::Limits::MaxGolfHoles)
|
||||
ride->holes++;
|
||||
if (ride.holes < OpenRCT2::Limits::MaxGolfHoles)
|
||||
ride.holes++;
|
||||
}
|
||||
}
|
||||
|
||||
void RideUpdateMeasurementsSpecialElements_WaterCoaster(Ride* ride, const track_type_t trackType)
|
||||
void RideUpdateMeasurementsSpecialElements_WaterCoaster(Ride& ride, const track_type_t trackType)
|
||||
{
|
||||
if (trackType >= TrackElemType::FlatCovered && trackType <= TrackElemType::RightQuarterTurn3TilesCovered)
|
||||
{
|
||||
ride->special_track_elements |= RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
ride.special_track_elements |= RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1548,7 +1548,7 @@ void Vehicle::UpdateMeasurements()
|
|||
}
|
||||
|
||||
const auto& rtd = curRide->GetRideTypeDescriptor();
|
||||
rtd.UpdateMeasurementsSpecialElements(curRide, trackElemType);
|
||||
rtd.UpdateMeasurementsSpecialElements(*curRide, trackElemType);
|
||||
|
||||
switch (trackElemType)
|
||||
{
|
||||
|
@ -1600,16 +1600,16 @@ void Vehicle::UpdateMeasurements()
|
|||
switch (curRide->turn_count_default >> 11)
|
||||
{
|
||||
case 0:
|
||||
increment_turn_count_1_element(curRide, turnType);
|
||||
increment_turn_count_1_element(*curRide, turnType);
|
||||
break;
|
||||
case 1:
|
||||
increment_turn_count_2_elements(curRide, turnType);
|
||||
increment_turn_count_2_elements(*curRide, turnType);
|
||||
break;
|
||||
case 2:
|
||||
increment_turn_count_3_elements(curRide, turnType);
|
||||
increment_turn_count_3_elements(*curRide, turnType);
|
||||
break;
|
||||
default:
|
||||
increment_turn_count_4_plus_elements(curRide, turnType);
|
||||
increment_turn_count_4_plus_elements(*curRide, turnType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1711,7 +1711,7 @@ void Vehicle::UpdateMeasurements()
|
|||
|
||||
if (trackFlags & TRACK_ELEM_FLAG_HELIX)
|
||||
{
|
||||
uint8_t helixes = ride_get_helix_sections(curRide);
|
||||
uint8_t helixes = ride_get_helix_sections(*curRide);
|
||||
if (helixes != OpenRCT2::Limits::MaxHelices)
|
||||
helixes++;
|
||||
|
||||
|
@ -2129,20 +2129,20 @@ void Vehicle::TrainReadyToDepart(uint8_t num_peeps_on_train, uint8_t num_used_se
|
|||
SetState(Vehicle::Status::WaitingForPassengers);
|
||||
}
|
||||
|
||||
static std::optional<uint32_t> ride_get_train_index_from_vehicle(Ride* ride, EntityId spriteIndex)
|
||||
static std::optional<uint32_t> ride_get_train_index_from_vehicle(const Ride& ride, EntityId spriteIndex)
|
||||
{
|
||||
uint32_t trainIndex = 0;
|
||||
while (ride->vehicles[trainIndex] != spriteIndex)
|
||||
while (ride.vehicles[trainIndex] != spriteIndex)
|
||||
{
|
||||
trainIndex++;
|
||||
if (trainIndex >= ride->NumTrains)
|
||||
if (trainIndex >= ride.NumTrains)
|
||||
{
|
||||
// This should really return nullopt, but doing so
|
||||
// would break some hacked parks that hide track by setting tracked rides'
|
||||
// track type to, e.g., Crooked House
|
||||
break;
|
||||
}
|
||||
if (trainIndex >= std::size(ride->vehicles))
|
||||
if (trainIndex >= std::size(ride.vehicles))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@ -2175,7 +2175,7 @@ void Vehicle::UpdateWaitingForPassengers()
|
|||
return;
|
||||
}
|
||||
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(curRide, sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, sprite_index);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -2460,7 +2460,7 @@ void Vehicle::UpdateWaitingToDepart()
|
|||
int32_t direction;
|
||||
|
||||
uint8_t trackDirection = GetTrackDirection();
|
||||
if (track_block_get_next_from_zero(TrackLocation, curRide, trackDirection, &track, &zUnused, &direction, false))
|
||||
if (track_block_get_next_from_zero(TrackLocation, *curRide, trackDirection, &track, &zUnused, &direction, false))
|
||||
{
|
||||
if (track.element->AsTrack()->HasCableLift())
|
||||
{
|
||||
|
@ -3111,7 +3111,7 @@ void Vehicle::UpdateDeparting()
|
|||
return;
|
||||
|
||||
curRide->lifecycle_flags |= RIDE_LIFECYCLE_BROKEN_DOWN;
|
||||
ride_breakdown_add_news_item(curRide);
|
||||
ride_breakdown_add_news_item(*curRide);
|
||||
|
||||
curRide->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST
|
||||
| RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
@ -3452,7 +3452,7 @@ void Vehicle::UpdateCollisionSetup()
|
|||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -4141,7 +4141,7 @@ void Vehicle::UpdateTravellingCableLift()
|
|||
return;
|
||||
|
||||
curRide->lifecycle_flags |= RIDE_LIFECYCLE_BROKEN_DOWN;
|
||||
ride_breakdown_add_news_item(curRide);
|
||||
ride_breakdown_add_news_item(*curRide);
|
||||
curRide->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST
|
||||
| RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
|
||||
|
@ -5147,24 +5147,24 @@ static TileElement* vehicle_check_collision(const CoordsXYZ& vehiclePosition)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void ride_train_crash(Ride* ride, uint16_t numFatalities)
|
||||
static void ride_train_crash(Ride& ride, uint16_t numFatalities)
|
||||
{
|
||||
Formatter ft;
|
||||
ft.Add<uint16_t>(numFatalities);
|
||||
|
||||
uint8_t crashType = numFatalities == 0 ? RIDE_CRASH_TYPE_NO_FATALITIES : RIDE_CRASH_TYPE_FATALITIES;
|
||||
|
||||
if (crashType >= ride->last_crash_type)
|
||||
ride->last_crash_type = crashType;
|
||||
if (crashType >= ride.last_crash_type)
|
||||
ride.last_crash_type = crashType;
|
||||
|
||||
if (numFatalities != 0)
|
||||
{
|
||||
if (gConfigNotifications.RideCasualties)
|
||||
{
|
||||
ride->FormatNameTo(ft);
|
||||
ride.FormatNameTo(ft);
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::Ride, numFatalities == 1 ? STR_X_PERSON_DIED_ON_X : STR_X_PEOPLE_DIED_ON_X,
|
||||
ride->id.ToUnderlying(), ft);
|
||||
ride.id.ToUnderlying(), ft);
|
||||
}
|
||||
|
||||
if (gParkRatingCasualtyPenalty < 500)
|
||||
|
@ -5183,7 +5183,7 @@ void Vehicle::KillAllPassengersInTrain()
|
|||
if (curRide == nullptr)
|
||||
return;
|
||||
|
||||
ride_train_crash(curRide, NumPeepsUntilTrainTail());
|
||||
ride_train_crash(*curRide, NumPeepsUntilTrainTail());
|
||||
|
||||
for (Vehicle* trainCar = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
||||
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
|
@ -5239,7 +5239,7 @@ void Vehicle::CrashOnLand()
|
|||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -5307,7 +5307,7 @@ void Vehicle::CrashOnWater()
|
|||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -6667,7 +6667,7 @@ void Vehicle::UpdateAdditionalAnimation()
|
|||
auto curRide = GetRide();
|
||||
if (curRide != nullptr)
|
||||
{
|
||||
if (!ride_has_station_shelter(curRide)
|
||||
if (!ride_has_station_shelter(*curRide)
|
||||
|| (status != Vehicle::Status::MovingToEndOfStation && status != Vehicle::Status::Arriving))
|
||||
{
|
||||
int32_t typeIndex = [&] {
|
||||
|
|
|
@ -532,9 +532,9 @@ void vehicle_update_all();
|
|||
void vehicle_sounds_update();
|
||||
uint16_t vehicle_get_move_info_size(VehicleTrackSubposition trackSubposition, track_type_t type, uint8_t direction);
|
||||
|
||||
void RideUpdateMeasurementsSpecialElements_Default(Ride* ride, const track_type_t trackType);
|
||||
void RideUpdateMeasurementsSpecialElements_MiniGolf(Ride* ride, const track_type_t trackType);
|
||||
void RideUpdateMeasurementsSpecialElements_WaterCoaster(Ride* ride, const track_type_t trackType);
|
||||
void RideUpdateMeasurementsSpecialElements_Default(Ride& ride, const track_type_t trackType);
|
||||
void RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const track_type_t trackType);
|
||||
void RideUpdateMeasurementsSpecialElements_WaterCoaster(Ride& ride, const track_type_t trackType);
|
||||
|
||||
extern Vehicle* gCurrentVehicle;
|
||||
extern StationIndex _vehicleStationIndex;
|
||||
|
|
|
@ -112,10 +112,10 @@ void RideEntranceExitRemoveGhost()
|
|||
* rct2: 0x006CA28C
|
||||
*/
|
||||
money32 RideEntranceExitPlaceGhost(
|
||||
Ride* ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum)
|
||||
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum)
|
||||
{
|
||||
ride_construction_remove_ghosts();
|
||||
money32 result = RideEntranceExitPlaceGhost(ride->id, entranceExitCoords, direction, placeType, stationNum);
|
||||
money32 result = RideEntranceExitPlaceGhost(ride.id, entranceExitCoords, direction, placeType, stationNum);
|
||||
|
||||
if (result != MONEY32_UNDEFINED)
|
||||
{
|
||||
|
|
|
@ -423,7 +423,7 @@ int32_t Park::CalculateParkRating() const
|
|||
for (auto& ride : GetRideManager())
|
||||
{
|
||||
totalRideUptime += 100 - ride.downtime;
|
||||
if (ride_has_ratings(&ride))
|
||||
if (ride_has_ratings(ride))
|
||||
{
|
||||
totalRideExcitement += ride.excitement / 8;
|
||||
totalRideIntensity += ride.intensity / 8;
|
||||
|
@ -485,7 +485,7 @@ money64 Park::CalculateParkValue() const
|
|||
money64 result = 0;
|
||||
for (const auto& ride : GetRideManager())
|
||||
{
|
||||
result += CalculateRideValue(&ride);
|
||||
result += CalculateRideValue(ride);
|
||||
}
|
||||
|
||||
// +7.00 per guest
|
||||
|
@ -494,13 +494,13 @@ money64 Park::CalculateParkValue() const
|
|||
return result;
|
||||
}
|
||||
|
||||
money64 Park::CalculateRideValue(const Ride* ride) const
|
||||
money64 Park::CalculateRideValue(const Ride& ride) const
|
||||
{
|
||||
money64 result = 0;
|
||||
if (ride != nullptr && ride->value != RIDE_VALUE_UNDEFINED)
|
||||
if (ride.value != RIDE_VALUE_UNDEFINED)
|
||||
{
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
result = ToMoney32FromGBP(static_cast<int32_t>(ride->value))
|
||||
const auto& rtd = ride.GetRideTypeDescriptor();
|
||||
result = ToMoney32FromGBP(static_cast<int32_t>(ride.value))
|
||||
* (static_cast<money64>(ride_customers_in_last_5_minutes(ride)) + rtd.BonusValue * 4LL);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace OpenRCT2
|
|||
void UpdateHistories();
|
||||
|
||||
private:
|
||||
money64 CalculateRideValue(const Ride* ride) const;
|
||||
money64 CalculateRideValue(const Ride& ride) const;
|
||||
money16 CalculateTotalRideValueForMoney() const;
|
||||
uint32_t CalculateSuggestedMaxGuests() const;
|
||||
uint32_t CalculateGuestGenerationProbability() const;
|
||||
|
|
Loading…
Reference in New Issue