1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Refactor ride_construct() to RideConstructionStart()

This commit is contained in:
Gymnasiast
2022-12-17 17:16:34 +01:00
parent d0ae004b8f
commit a4f7ca4682
6 changed files with 10 additions and 8 deletions

View File

@@ -559,7 +559,7 @@ bool ViewportInteractionRightClick(const ScreenCoordsXY& screenCoords)
auto ride = get_ride(vehicle->ride);
if (ride != nullptr)
{
ride_construct(ride);
RideConstructionStart(*ride);
}
}
}

View File

@@ -11,6 +11,7 @@
#include <openrct2/actions/RideCreateAction.h>
#include <openrct2/ride/Ride.h>
#include <openrct2/ride/RideConstruction.h>
#include <openrct2/ride/RideTypes.h>
/**
@@ -30,7 +31,7 @@ void ride_construct_new(RideSelection listItem)
return;
const auto rideIndex = result->GetData<RideId>();
auto ride = get_ride(rideIndex);
ride_construct(ride);
RideConstructionStart(*ride);
});
GameActions::Execute(&gameAction);

View File

@@ -1639,7 +1639,7 @@ static void WindowRideMainMouseup(rct_window* w, WidgetIndex widgetIndex)
auto ride = get_ride(w->rideId);
if (ride != nullptr)
{
ride_construct(ride);
RideConstructionStart(*ride);
if (window_find_by_number(WindowClass::RideConstruction, ride->id.ToUnderlying()) != nullptr)
{
window_close(*w);

View File

@@ -1011,7 +1011,6 @@ void ride_update_favourited_stat();
void ride_check_all_reachable();
bool ride_try_get_origin_element(const Ride* ride, CoordsXYE* output);
void ride_construct(Ride* ride);
void ride_clear_blocked_tiles(Ride* ride);
Staff* ride_get_mechanic(Ride* ride);
Staff* ride_get_assigned_mechanic(Ride* ride);

View File

@@ -130,12 +130,12 @@ static rct_window* ride_create_or_find_construction_window(RideId rideIndex)
*
* rct2: 0x006B4857
*/
void ride_construct(Ride* ride)
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);
ride.FindTrackGap(trackElement, &trackElement);
rct_window* w = window_get_main();
if (w != nullptr && ride_modify(trackElement))
@@ -143,7 +143,7 @@ void ride_construct(Ride* ride)
}
else
{
ride_initialise_construction_window(ride);
ride_initialise_construction_window(&ride);
}
}

View File

@@ -92,3 +92,5 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
bool ride_select_backwards_from_front();
bool ride_select_forwards_from_back();
void RideConstructionStart(Ride& ride);