mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Add UpdateLeaveEntrance field to the RTD (#16986)
Co-authored-by: frutiemax <frutiemax@users.noreply.github.com>
This commit is contained in:
@@ -3503,7 +3503,7 @@ static constexpr const CoordsXY _MazeEntranceStart[] = {
|
||||
{ 24, 8 },
|
||||
};
|
||||
|
||||
static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
void PeepUpdateRideLeaveEntranceMaze(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
{
|
||||
peep->MazeLastEdge = entrance_loc.direction + 1;
|
||||
|
||||
@@ -3532,7 +3532,7 @@ static void peep_update_ride_leave_entrance_maze(Guest* peep, Ride* ride, Coords
|
||||
peep->RideSubState = PeepRideSubState::MazePathfinding;
|
||||
}
|
||||
|
||||
static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
void PeepUpdateRideLeaveEntranceSpiralSlide(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
{
|
||||
entrance_loc = { ride->GetStation(peep->CurrentRideStation).GetStart(), entrance_loc.direction };
|
||||
|
||||
@@ -3552,6 +3552,24 @@ static void peep_update_ride_leave_entrance_spiral_slide(Guest* peep, Ride* ride
|
||||
peep->RideSubState = PeepRideSubState::ApproachSpiralSlide;
|
||||
}
|
||||
|
||||
void PeepUpdateRideLeaveEntranceDefault(Guest* peep, Ride* ride, CoordsXYZD& entrance_loc)
|
||||
{
|
||||
// If the ride type was changed guests will become stuck.
|
||||
// Inform the player about this if its a new issue or hasn't been addressed within 120 seconds.
|
||||
if ((ride->current_issues & RIDE_ISSUE_GUESTS_STUCK) == 0 || gCurrentTicks - ride->last_issue_time > 3000)
|
||||
{
|
||||
ride->current_issues |= RIDE_ISSUE_GUESTS_STUCK;
|
||||
ride->last_issue_time = gCurrentTicks;
|
||||
|
||||
auto ft = Formatter();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, peep->CurrentRide.ToUnderlying(), ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t Guest::GetWaypointedSeatLocation(const Ride& ride, CarEntry* vehicle_type, uint8_t track_direction) const
|
||||
{
|
||||
// The seatlocation can be split into segments around the ride base
|
||||
@@ -3671,32 +3689,8 @@ void Guest::UpdateRideAdvanceThroughEntrance()
|
||||
auto entranceLocation = station.Entrance.ToCoordsXYZD();
|
||||
Guard::Assert(!entranceLocation.IsNull());
|
||||
|
||||
if (ride->type == RIDE_TYPE_MAZE)
|
||||
{
|
||||
peep_update_ride_leave_entrance_maze(this, ride, entranceLocation);
|
||||
return;
|
||||
}
|
||||
if (ride->type == RIDE_TYPE_SPIRAL_SLIDE)
|
||||
{
|
||||
peep_update_ride_leave_entrance_spiral_slide(this, ride, entranceLocation);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the ride type was changed guests will become stuck.
|
||||
// Inform the player about this if its a new issue or hasn't been addressed within 120 seconds.
|
||||
if ((ride->current_issues & RIDE_ISSUE_GUESTS_STUCK) == 0 || gCurrentTicks - ride->last_issue_time > 3000)
|
||||
{
|
||||
ride->current_issues |= RIDE_ISSUE_GUESTS_STUCK;
|
||||
ride->last_issue_time = gCurrentTicks;
|
||||
|
||||
auto ft = Formatter();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, CurrentRide.ToUnderlying(), ft);
|
||||
}
|
||||
}
|
||||
|
||||
const auto& rtd = GetRideTypeDescriptor(ride->type);
|
||||
rtd.UpdateLeaveEntrance(this, ride, entranceLocation);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -475,3 +475,7 @@ void increment_guests_in_park();
|
||||
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);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "../audio/audio.h"
|
||||
#include "../common.h"
|
||||
#include "../core/BitSet.hpp"
|
||||
#include "../entity/Guest.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../sprites.h"
|
||||
#include "../util/Util.h"
|
||||
@@ -151,6 +152,7 @@ struct UpkeepCostsDescriptor
|
||||
|
||||
using RideTrackGroup = OpenRCT2::BitSet<TRACK_GROUP_COUNT>;
|
||||
using RideMusicUpdateFunction = void (*)(Ride*);
|
||||
using PeepUpdateRideLeaveEntranceFunc = void (*)(Guest*, Ride*, CoordsXYZD&);
|
||||
struct RideTypeDescriptor
|
||||
{
|
||||
uint8_t AlternateType;
|
||||
@@ -204,6 +206,8 @@ struct RideTypeDescriptor
|
||||
RideMusicUpdateFunction MusicUpdateFunction = DefaultMusicUpdate;
|
||||
RideClassification Classification = RideClassification::Ride;
|
||||
|
||||
PeepUpdateRideLeaveEntranceFunc UpdateLeaveEntrance = PeepUpdateRideLeaveEntranceDefault;
|
||||
|
||||
bool HasFlag(uint64_t flag) const;
|
||||
void GetAvailableTrackPieces(RideTrackGroup& res) const;
|
||||
bool SupportsTrackPiece(const uint64_t trackPiece) const;
|
||||
@@ -395,6 +399,10 @@ constexpr const RideTypeDescriptor DummyRTD =
|
||||
SET_FIELD(ColourPreview, { static_cast<uint32_t>(SPR_NONE), static_cast<uint32_t>(SPR_NONE) }),
|
||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||
SET_FIELD(Name, "invalid"),
|
||||
SET_FIELD(DesignCreateMode, TrackDesignCreateMode::Default),
|
||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||
SET_FIELD(Classification, RideClassification::Ride),
|
||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceDefault),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -52,5 +52,8 @@ constexpr const RideTypeDescriptor MazeRTD =
|
||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||
SET_FIELD(Name, "maze"),
|
||||
SET_FIELD(DesignCreateMode, TrackDesignCreateMode::Maze),
|
||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||
SET_FIELD(Classification, RideClassification::Ride),
|
||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceMaze),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -53,5 +53,9 @@ constexpr const RideTypeDescriptor SpiralSlideRTD =
|
||||
SET_FIELD(ColourPreview, { SPR_RIDE_DESIGN_PREVIEW_SPIRAL_SLIDE_TRACK, 0 }),
|
||||
SET_FIELD(ColourKey, RideColourKey::Ride),
|
||||
SET_FIELD(Name, "spiral_slide"),
|
||||
SET_FIELD(DesignCreateMode, TrackDesignCreateMode::Default),
|
||||
SET_FIELD(MusicUpdateFunction, DefaultMusicUpdate),
|
||||
SET_FIELD(Classification, RideClassification::Ride),
|
||||
SET_FIELD(UpdateLeaveEntrance, PeepUpdateRideLeaveEntranceSpiralSlide),
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
Reference in New Issue
Block a user