mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
Replace loose flag checking with helper function
This commit is contained in:
parent
d63e3b1d9f
commit
b1ab20ec27
8 changed files with 15 additions and 15 deletions
|
@ -2535,7 +2535,7 @@ static rct_string_id window_ride_get_status_vehicle(rct_window* w, Formatter& ft
|
|||
return STR_EMPTY;
|
||||
|
||||
auto stringId = VehicleStatusNames[static_cast<size_t>(vehicle->status)];
|
||||
if ((ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_SINGLE_SESSION)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SINGLE_SESSION)
|
||||
&& vehicle->status <= Vehicle::Status::UnloadingPassengers)
|
||||
{
|
||||
stringId = SingleSessionVehicleStatusNames[static_cast<size_t>(vehicle->status)];
|
||||
|
@ -4655,7 +4655,7 @@ static void window_ride_colour_invalidate(rct_window* w)
|
|||
window_ride_colour_widgets[WIDX_TRACK_PREVIEW].type = WindowWidgetType::Empty;
|
||||
|
||||
// Entrance style
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT))
|
||||
{
|
||||
window_ride_colour_widgets[WIDX_ENTRANCE_PREVIEW].type = WindowWidgetType::Spinner;
|
||||
window_ride_colour_widgets[WIDX_ENTRANCE_STYLE].type = WindowWidgetType::DropdownMenu;
|
||||
|
|
|
@ -555,7 +555,7 @@ rct_window* window_ride_construction_open()
|
|||
_currentTrackLiftHill = 0;
|
||||
_currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES;
|
||||
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED))
|
||||
_currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_TYPE;
|
||||
|
||||
_previousTrackBankEnd = 0;
|
||||
|
|
|
@ -167,7 +167,7 @@ GameActions::Result::Ptr RideCreateAction::Execute() const
|
|||
ride->min_waiting_time = 10;
|
||||
ride->max_waiting_time = 60;
|
||||
ride->depart_flags = RIDE_DEPART_WAIT_FOR_MINIMUM_LENGTH | 3;
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT))
|
||||
{
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_MUSIC;
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_ALLOW_DOORS_ON_TRACK))
|
||||
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_ALLOW_DOORS_ON_TRACK))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1710,7 +1710,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
|
|||
{
|
||||
// Peeps that are leaving the park will refuse to go on any rides, with the exception of free transport rides.
|
||||
assert(ride->type < std::size(RideTypeDescriptors));
|
||||
if (!(ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride->value == RIDE_VALUE_UNDEFINED
|
||||
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride->value == RIDE_VALUE_UNDEFINED
|
||||
|| ride_get_price(ride) != 0)
|
||||
{
|
||||
if (PeepFlags & PEEP_FLAGS_LEAVING_PARK)
|
||||
|
@ -1776,7 +1776,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
|
|||
// Assuming the queue conditions are met, peeps will always go on free transport rides.
|
||||
// Ride ratings, recent crashes and weather will all be ignored.
|
||||
money16 ridePrice = ride_get_price(ride);
|
||||
if (!(ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride->value == RIDE_VALUE_UNDEFINED
|
||||
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_TRANSPORT_RIDE) || ride->value == RIDE_VALUE_UNDEFINED
|
||||
|| ridePrice != 0)
|
||||
{
|
||||
if (PreviousRide == ride->id)
|
||||
|
@ -1908,7 +1908,7 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
|
|||
|
||||
// If the ride has not yet been rated and is capable of having g-forces,
|
||||
// there's a 90% chance that the peep will ignore it.
|
||||
if (!ride_has_ratings(ride) && (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES))
|
||||
if (!ride_has_ratings(ride) && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_PEEP_CHECK_GFORCES))
|
||||
{
|
||||
if ((scenario_rand() & 0xFFFF) > 0x1999U)
|
||||
{
|
||||
|
@ -5948,14 +5948,14 @@ static bool peep_should_watch_ride(TileElement* tileElement)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_INTERESTING_TO_LOOK_AT)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_INTERESTING_TO_LOOK_AT))
|
||||
{
|
||||
if ((scenario_rand() & 0xFFFF) > 0x3333)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_SLIGHTLY_INTERESTING_TO_LOOK_AT)
|
||||
else if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_SLIGHTLY_INTERESTING_TO_LOOK_AT))
|
||||
{
|
||||
if ((scenario_rand() & 0xFFFF) > 0x1000)
|
||||
{
|
||||
|
|
|
@ -1945,7 +1945,7 @@ int32_t ride_initialise_construction_window(Ride* ride)
|
|||
_currentTrackLiftHill = 0;
|
||||
_currentTrackAlternative = RIDE_TYPE_NO_ALTERNATIVES;
|
||||
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_START_CONSTRUCTION_INVERTED))
|
||||
_currentTrackAlternative |= RIDE_TYPE_ALTERNATIVE_TRACK_TYPE;
|
||||
|
||||
_previousTrackBankEnd = 0;
|
||||
|
@ -2808,8 +2808,8 @@ Staff* ride_get_assigned_mechanic(Ride* ride)
|
|||
*/
|
||||
static void ride_music_update(Ride* ride)
|
||||
{
|
||||
if (!(ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT)
|
||||
&& !(ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_ALLOW_MUSIC))
|
||||
const auto& rtd = ride->GetRideTypeDescriptor();
|
||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_MUSIC_ON_DEFAULT) && !rtd.HasFlag(RIDE_TYPE_FLAG_ALLOW_MUSIC))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -988,7 +988,7 @@ static void ride_ratings_apply_adjustments(Ride* ride, RatingTuple* ratings)
|
|||
}
|
||||
}
|
||||
#else
|
||||
if (ride->GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_HAS_AIR_TIME)
|
||||
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_AIR_TIME))
|
||||
{
|
||||
int32_t excitementModifier;
|
||||
if (rideEntry->flags & RIDE_ENTRY_FLAG_LIMIT_AIRTIME_BONUS)
|
||||
|
|
|
@ -226,7 +226,7 @@ rct_string_id TrackDesign::CreateTrackDesignTrack(const Ride& ride)
|
|||
if (trackElement.element->AsTrack()->HasChain())
|
||||
trackFlags |= RCT12_TRACK_ELEMENT_TYPE_FLAG_CHAIN_LIFT;
|
||||
trackFlags |= trackElement.element->AsTrack()->GetColourScheme() << 4;
|
||||
if (ride.GetRideTypeDescriptor().Flags & RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE
|
||||
if (ride.GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_ALTERNATIVE_TRACK_TYPE)
|
||||
&& trackElement.element->AsTrack()->IsInverted())
|
||||
{
|
||||
trackFlags |= TD6_TRACK_ELEMENT_FLAG_INVERTED;
|
||||
|
|
Loading…
Reference in a new issue