mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
Eliminate direct ride type check
This commit is contained in:
committed by
GitHub
parent
4873620043
commit
2656f3acc2
@@ -5048,6 +5048,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
const auto& rtd = ride->getRideTypeDescriptor();
|
||||
// Construct list of available music
|
||||
auto& musicOrder = window_ride_current_music_style_order;
|
||||
musicOrder.clear();
|
||||
@@ -5077,7 +5078,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
if (getGameState().cheats.unlockOperatingLimits || musicObj->SupportsRideType(ride->type))
|
||||
if (getGameState().cheats.unlockOperatingLimits
|
||||
|| musicObj->SupportsRideType(ride->type, rtd.HasFlag(RtdFlag::requireExplicitListingInMusicObjects)))
|
||||
{
|
||||
musicOrder.push_back(i);
|
||||
}
|
||||
|
||||
@@ -191,12 +191,12 @@ std::optional<uint8_t> MusicObject::GetOriginalStyleId() const
|
||||
return _originalStyleId;
|
||||
}
|
||||
|
||||
bool MusicObject::SupportsRideType(ride_type_t rideType)
|
||||
bool MusicObject::SupportsRideType(ride_type_t rideType, bool onlyAllowIfExplicitlyListed)
|
||||
{
|
||||
if (_rideTypes.size() == 0)
|
||||
{
|
||||
// Default behaviour for music is to only exclude from merry-go-round
|
||||
return rideType != RIDE_TYPE_MERRY_GO_ROUND;
|
||||
// Some rides, like the merry-go-round, need music objects to explicitly list them.
|
||||
return !onlyAllowIfExplicitlyListed;
|
||||
}
|
||||
|
||||
auto it = std::find(_rideTypes.begin(), _rideTypes.end(), rideType);
|
||||
|
||||
@@ -65,7 +65,14 @@ public:
|
||||
bool HasPreview() const;
|
||||
|
||||
std::optional<uint8_t> GetOriginalStyleId() const;
|
||||
bool SupportsRideType(ride_type_t rideType);
|
||||
/**
|
||||
*
|
||||
* @param rideType
|
||||
* @param onlyAllowIfExplicitlyListed If a music object does not provide a list of ride types,
|
||||
* it will be enabled for all ride types, unless this parameter is set to true.
|
||||
* @return
|
||||
*/
|
||||
bool SupportsRideType(ride_type_t rideType, bool onlyAllowIfExplicitlyListed);
|
||||
size_t GetTrackCount() const;
|
||||
const MusicObjectTrack* GetTrack(size_t trackIndex) const;
|
||||
OpenRCT2::Audio::IAudioSource* GetTrackSample(size_t trackIndex) const;
|
||||
|
||||
@@ -431,6 +431,8 @@ enum class RtdFlag : uint8_t
|
||||
hasOneStation,
|
||||
hasSeatRotation,
|
||||
allowReversedTrains,
|
||||
|
||||
requireExplicitListingInMusicObjects,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,8 @@ constexpr RideTypeDescriptor MerryGoRoundRTD =
|
||||
RtdFlag::hasLoadOptions, RtdFlag::vehicleIsIntegral, RtdFlag::noWallsAroundTrack,
|
||||
RtdFlag::isFlatRide, RtdFlag::hasVehicleColours, RtdFlag::hasMusicByDefault,
|
||||
RtdFlag::allowMusic, RtdFlag::hasEntranceAndExit, RtdFlag::singleSession,
|
||||
RtdFlag::interestingToLookAt, RtdFlag::listVehiclesSeparately),
|
||||
RtdFlag::interestingToLookAt, RtdFlag::listVehiclesSeparately,
|
||||
RtdFlag::requireExplicitListingInMusicObjects),
|
||||
.RideModes = EnumsToFlags(RideMode::rotation),
|
||||
.DefaultMode = RideMode::rotation,
|
||||
.OperatingSettings = { 4, 25 },
|
||||
|
||||
Reference in New Issue
Block a user