1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Part of #9473: Create Vehicle::TryReconnectBoatToTrack() (#11619)

Converted from loc_6DA9F9
This commit is contained in:
hdpoliveira
2020-05-09 08:32:22 -03:00
committed by GitHub
parent 3ceecb33f0
commit 650af7d943
2 changed files with 17 additions and 16 deletions

View File

@@ -4304,27 +4304,27 @@ void Vehicle::UpdateTravellingBoat()
UpdateMotionBoatHire();
}
static void loc_6DA9F9(Vehicle* vehicle, int32_t x, int32_t y, int32_t trackX, int32_t trackY)
void Vehicle::TryReconnectBoatToTrack(const CoordsXY& currentBoatLocation, const CoordsXY& trackCoords)
{
vehicle->remaining_distance = 0;
if (!vehicle_update_motion_collision_detection(vehicle, x, y, vehicle->z, nullptr))
remaining_distance = 0;
if (!vehicle_update_motion_collision_detection(this, currentBoatLocation.x, currentBoatLocation.y, z, nullptr))
{
vehicle->TrackLocation.x = trackX;
vehicle->TrackLocation.y = trackY;
TrackLocation.x = trackCoords.x;
TrackLocation.y = trackCoords.y;
auto trackElement = map_get_track_element_at(vehicle->TrackLocation);
auto trackElement = map_get_track_element_at(TrackLocation);
auto ride = get_ride(vehicle->ride);
if (ride != nullptr)
auto curRide = get_ride(ride);
if (curRide != nullptr)
{
vehicle->track_type = (trackElement->GetTrackType() << 2) | (ride->boat_hire_return_direction & 3);
vehicle->BoatLocation.setNull();
track_type = (trackElement->GetTrackType() << 2) | (curRide->boat_hire_return_direction & 3);
BoatLocation.setNull();
}
vehicle->track_progress = 0;
vehicle->SetState(VEHICLE_STATUS_TRAVELLING, vehicle->sub_state);
unk_F64E20.x = x;
unk_F64E20.y = y;
track_progress = 0;
SetState(VEHICLE_STATUS_TRAVELLING, sub_state);
unk_F64E20.x = currentBoatLocation.x;
unk_F64E20.y = currentBoatLocation.y;
}
}
@@ -4525,7 +4525,7 @@ void Vehicle::UpdateMotionBoatHire()
uint16_t bp = curY & 0x1F;
if (bp == 16)
{
loc_6DA9F9(this, curX, curY, flooredLocation.x, flooredLocation.y);
TryReconnectBoatToTrack({ curX, curY }, flooredLocation);
break;
}
if (bp <= 16)
@@ -4545,7 +4545,7 @@ void Vehicle::UpdateMotionBoatHire()
uint16_t bp = curX & 0x1F;
if (bp == 16)
{
loc_6DA9F9(this, curX, curY, flooredLocation.x, flooredLocation.y);
TryReconnectBoatToTrack({ curX, curY }, flooredLocation);
break;
}
if (bp <= 16)

View File

@@ -350,6 +350,7 @@ private:
void UpdateTravellingCableLift();
void UpdateTravellingBoat();
void UpdateMotionBoatHire();
void TryReconnectBoatToTrack(const CoordsXY& currentBoatLocation, const CoordsXY& trackCoords);
void UpdateDepartingBoatHire();
void UpdateTravellingBoatHireSetup();
void UpdateBoatLocation();