1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

Use RideId::GetNull and RideId::IsNull over constant

This commit is contained in:
ζeh Matt
2022-01-19 18:24:23 +02:00
parent 4554d6d883
commit 06e430157f
41 changed files with 102 additions and 104 deletions

View File

@@ -138,7 +138,7 @@ namespace OpenRCT2::Scripting
int32_t ScVehicle::ride_get() const
{
auto vehicle = GetVehicle();
return (vehicle != nullptr ? vehicle->ride : RIDE_ID_NULL).ToUnderlying();
return (vehicle != nullptr ? vehicle->ride : RideId::GetNull()).ToUnderlying();
}
void ScVehicle::ride_set(int32_t value)
{

View File

@@ -60,7 +60,7 @@ namespace OpenRCT2::Scripting
class ScRide
{
private:
RideId _rideId = RIDE_ID_NULL;
RideId _rideId = RideId::GetNull();
public:
ScRide(RideId rideId);

View File

@@ -21,7 +21,7 @@ namespace OpenRCT2::Scripting
class ScRideStation
{
private:
RideId _rideId = RIDE_ID_NULL;
RideId _rideId = RideId::GetNull();
StationIndex _stationIndex{};
public:

View File

@@ -451,7 +451,7 @@ namespace OpenRCT2::Scripting
case TileElementType::Path:
{
auto el = _element->AsPath();
if (el->IsQueue() && el->GetRideIndex() != RIDE_ID_NULL)
if (el->IsQueue() && !el->GetRideIndex().IsNull())
duk_push_int(ctx, el->GetRideIndex().ToUnderlying());
else
duk_push_null(ctx);
@@ -490,7 +490,7 @@ namespace OpenRCT2::Scripting
if (value.type() == DukValue::Type::NUMBER)
el->SetRideIndex(RideId::FromUnderlying(value.as_uint()));
else
el->SetRideIndex(RIDE_ID_NULL);
el->SetRideIndex(RideId::GetNull());
Invalidate();
}
break;
@@ -528,7 +528,7 @@ namespace OpenRCT2::Scripting
case TileElementType::Path:
{
auto el = _element->AsPath();
if (el->IsQueue() && el->GetRideIndex() != RIDE_ID_NULL && el->GetStationIndex() != STATION_INDEX_NULL)
if (el->IsQueue() && !el->GetRideIndex().IsNull() && el->GetStationIndex() != STATION_INDEX_NULL)
duk_push_int(ctx, el->GetStationIndex());
else
duk_push_null(ctx);