You've already forked OpenRCT2-Unity
mirror of
https://github.com/izzy2lost/OpenRCT2-Unity.git
synced 2026-03-10 12:38:22 -07:00
Use RideId::GetNull and RideId::IsNull over constant
This commit is contained in:
@@ -27,7 +27,7 @@ static constexpr const rct_string_id WINDOW_TITLE = STR_NONE;
|
||||
static constexpr const int32_t WH = 109;
|
||||
static constexpr const int32_t WW = 350;
|
||||
|
||||
constexpr auto SELECTED_RIDE_UNDEFINED = RIDE_ID_NULL;
|
||||
constexpr auto SELECTED_RIDE_UNDEFINED = RideId::GetNull();
|
||||
constexpr uint16_t SELECTED_ITEM_UNDEFINED = 0xFFFF;
|
||||
|
||||
// clang-format off
|
||||
|
||||
@@ -1353,7 +1353,7 @@ rct_window* WindowRideOpenTrack(TileElement* tileElement)
|
||||
{
|
||||
assert(tileElement != nullptr);
|
||||
auto rideIndex = tileElement->GetRideIndex();
|
||||
if (rideIndex != RIDE_ID_NULL)
|
||||
if (!rideIndex.IsNull())
|
||||
{
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride != nullptr)
|
||||
|
||||
@@ -363,7 +363,7 @@ void game_fix_save_vars()
|
||||
{
|
||||
const auto srcStation = peep->CurrentRideStation;
|
||||
const auto rideIdx = peep->CurrentRide;
|
||||
if (rideIdx == RIDE_ID_NULL)
|
||||
if (rideIdx.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ void game_fix_save_vars()
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Couldn't find ride %u, resetting ride on peep %u", rideIdx, peep->sprite_index);
|
||||
peep->CurrentRide = RIDE_ID_NULL;
|
||||
peep->CurrentRide = RideId::GetNull();
|
||||
continue;
|
||||
}
|
||||
auto curName = peep->GetName();
|
||||
|
||||
@@ -424,7 +424,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
|
||||
pathElement->SetSloped(_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED);
|
||||
pathElement->SetIsQueue(isQueue);
|
||||
pathElement->SetAddition(0);
|
||||
pathElement->SetRideIndex(RIDE_ID_NULL);
|
||||
pathElement->SetRideIndex(RideId::GetNull());
|
||||
pathElement->SetAdditionStatus(255);
|
||||
pathElement->SetIsBroken(false);
|
||||
pathElement->SetGhost(GetFlags() & GAME_COMMAND_FLAG_GHOST);
|
||||
|
||||
@@ -268,7 +268,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertExecute(GameActio
|
||||
pathElement->SetSloped(_slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED);
|
||||
pathElement->SetIsQueue(isQueue);
|
||||
pathElement->SetAddition(0);
|
||||
pathElement->SetRideIndex(RIDE_ID_NULL);
|
||||
pathElement->SetRideIndex(RideId::GetNull());
|
||||
pathElement->SetAdditionStatus(255);
|
||||
pathElement->SetIsBroken(false);
|
||||
pathElement->SetEdges(_edges);
|
||||
|
||||
@@ -231,7 +231,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
|
||||
banner->position = TileCoordsXY(_loc);
|
||||
|
||||
RideId rideIndex = banner_get_closest_ride_index({ _loc, maxHeight });
|
||||
if (rideIndex != RIDE_ID_NULL)
|
||||
if (!rideIndex.IsNull())
|
||||
{
|
||||
banner->ride_index = rideIndex;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
|
||||
@@ -14,7 +14,7 @@ class MazePlaceTrackAction final : public GameActionBase<GameCommand::PlaceMazeD
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
uint16_t _mazeEntry{};
|
||||
|
||||
public:
|
||||
|
||||
@@ -42,7 +42,7 @@ class MazeSetTrackAction final : public GameActionBase<GameCommand::SetMazeTrack
|
||||
private:
|
||||
CoordsXYZD _loc;
|
||||
bool _initialPlacement{};
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
uint8_t _mode{};
|
||||
|
||||
public:
|
||||
|
||||
@@ -71,7 +71,7 @@ void RideCreateAction::Serialise(DataSerialiser& stream)
|
||||
GameActions::Result RideCreateAction::Query() const
|
||||
{
|
||||
auto rideIndex = GetNextFreeRideId();
|
||||
if (rideIndex == RIDE_ID_NULL)
|
||||
if (rideIndex.IsNull())
|
||||
{
|
||||
// No more free slots available.
|
||||
return GameActions::Result(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class RideDemolishAction final : public GameActionBase<GameCommand::DemolishRide>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
uint8_t _modifyType{ RIDE_MODIFY_DEMOLISH };
|
||||
|
||||
public:
|
||||
|
||||
@@ -17,7 +17,7 @@ class RideEntranceExitPlaceAction final : public GameActionBase<GameCommand::Pla
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
Direction _direction{ INVALID_DIRECTION };
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
StationIndex _stationNum{ STATION_INDEX_NULL };
|
||||
bool _isExit{};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class RideEntranceExitRemoveAction final : public GameActionBase<GameCommand::Re
|
||||
{
|
||||
private:
|
||||
CoordsXY _loc;
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
StationIndex _stationNum{ STATION_INDEX_NULL };
|
||||
bool _isExit{};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ enum class RideSetAppearanceType : uint8_t
|
||||
class RideSetAppearanceAction final : public GameActionBase<GameCommand::SetRideAppearance>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
RideSetAppearanceType _type{};
|
||||
uint16_t _value{};
|
||||
uint32_t _index{};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class RideSetNameAction final : public GameActionBase<GameCommand::SetRideName>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class RideSetPriceAction final : public GameActionBase<GameCommand::SetRidePrice>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
money16 _price{ MONEY16_UNDEFINED };
|
||||
bool _primaryPrice{ true };
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ enum class RideSetSetting : uint8_t
|
||||
class RideSetSettingAction final : public GameActionBase<GameCommand::SetRideSetting>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
RideSetSetting _setting{};
|
||||
uint8_t _value{};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class RideSetStatusAction final : public GameActionBase<GameCommand::SetRideStatus>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
RideStatus _status{ RideStatus::Closed };
|
||||
|
||||
public:
|
||||
|
||||
@@ -22,7 +22,7 @@ enum class RideSetVehicleType : uint8_t
|
||||
class RideSetVehicleAction final : public GameActionBase<GameCommand::SetRideVehicles>
|
||||
{
|
||||
private:
|
||||
NetworkRideId_t _rideIndex{ RIDE_ID_NULL };
|
||||
NetworkRideId_t _rideIndex{ RideId::GetNull() };
|
||||
RideSetVehicleType _type{};
|
||||
uint8_t _value{};
|
||||
uint8_t _colour{};
|
||||
|
||||
@@ -66,17 +66,17 @@ GameActions::Result SignSetNameAction::Execute() const
|
||||
if (!_name.empty())
|
||||
{
|
||||
banner->flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
|
||||
banner->ride_index = RIDE_ID_NULL;
|
||||
banner->ride_index = RideId::GetNull();
|
||||
banner->text = _name;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If empty name take closest ride name.
|
||||
RideId rideIndex = banner_get_closest_ride_index({ banner->position.ToCoordsXY(), 16 });
|
||||
if (rideIndex == RIDE_ID_NULL)
|
||||
if (rideIndex.IsNull())
|
||||
{
|
||||
banner->flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
|
||||
banner->ride_index = RIDE_ID_NULL;
|
||||
banner->ride_index = RideId::GetNull();
|
||||
banner->text = {};
|
||||
}
|
||||
else
|
||||
|
||||
@@ -122,7 +122,7 @@ GameActions::Result TrackDesignAction::Query() const
|
||||
}
|
||||
|
||||
res.Cost = queryRes.Cost;
|
||||
res.SetData(RideId{ RIDE_ID_NULL });
|
||||
res.SetData(RideId{ RideId::GetNull() });
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user