mirror of https://github.com/OpenRCT2/OpenRCT2.git
Reduce use of MAX_RIDES and RIDE_TYPE_NULL
This commit is contained in:
parent
414b53b56d
commit
e23638548a
|
@ -607,7 +607,7 @@ static void window_ride_construction_close(rct_window* w)
|
|||
// If we demolish a ride all windows will be closed including the construction window,
|
||||
// the ride at this point is already gone.
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -187,8 +187,8 @@ void setup_in_use_selection_flags()
|
|||
|
||||
for (uint8_t ride_index = 0; ride_index < 0xFF; ride_index++)
|
||||
{
|
||||
Ride* ride = get_ride(ride_index);
|
||||
if (ride->type != RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(ride_index);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
uint8_t type = ride->subtype;
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_RIDE, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
|
@ -105,8 +105,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
|
||||
|
|
|
@ -60,14 +60,8 @@ public:
|
|||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, errorTitle);
|
||||
}
|
||||
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", (int32_t)_rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", (int32_t)_rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
|
@ -147,7 +141,7 @@ public:
|
|||
auto errorTitle = _isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION
|
||||
: STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION;
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", (int32_t)_rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, errorTitle);
|
||||
|
|
|
@ -47,14 +47,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", int32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride id %d for entrance/exit removal", (int32_t)_rideIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
@ -117,7 +111,7 @@ public:
|
|||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride id %d for entrance/exit removal", (int32_t)_rideIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
|
|
@ -68,14 +68,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
|
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
|
@ -70,8 +70,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
|
||||
|
|
|
@ -57,14 +57,8 @@ public:
|
|||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
@ -86,7 +80,7 @@ public:
|
|||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_PARK_RIDE_TICKETS;
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
|
|
|
@ -60,14 +60,8 @@ public:
|
|||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex < 0)
|
||||
{
|
||||
log_warning("Invalid game command for ride %d", int32_t(_rideIndex));
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride: #%d.", (int32_t)_rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
|
@ -172,7 +166,7 @@ public:
|
|||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid ride: #%d.", (int32_t)_rideIndex);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_CHANGE_OPERATING_MODE);
|
||||
|
|
|
@ -59,18 +59,19 @@ public:
|
|||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex < 0)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
if (_status != ride->status)
|
||||
{
|
||||
if (_status == RIDE_STATUS_SIMULATING && (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN))
|
||||
|
@ -107,18 +108,18 @@ public:
|
|||
GameActionResult::Ptr res = std::make_unique<GameActionResult>();
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_RUNNING_COSTS;
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
res->Error = GA_ERROR::INVALID_PARAMETERS;
|
||||
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
|
||||
res->ErrorTitle = STR_RIDE_DESCRIPTION_UNKNOWN;
|
||||
res->ErrorMessage = STR_NONE;
|
||||
return res;
|
||||
}
|
||||
|
||||
res->ErrorTitle = _StatusErrorTitles[_status];
|
||||
ride->FormatNameTo(res->ErrorMessageArgs.data() + 6);
|
||||
if (ride->overall_view.xy != RCT_XY8_UNDEFINED)
|
||||
{
|
||||
res->Position.x = ride->overall_view.x * 32 + 16;
|
||||
|
|
|
@ -74,14 +74,8 @@ public:
|
|||
}
|
||||
auto errTitle = SetVehicleTypeErrorTitle[_type];
|
||||
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
|
@ -138,7 +132,7 @@ public:
|
|||
{
|
||||
auto errTitle = SetVehicleTypeErrorTitle[_type];
|
||||
Ride* ride = get_ride(_rideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, errTitle);
|
||||
|
|
|
@ -93,11 +93,6 @@ public:
|
|||
log_warning("Invalid ride for track placement, rideIndex = %d", (int32_t)_rideIndex);
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
log_warning("Invalid ride type, rideIndex = %d", (int32_t)_rideIndex);
|
||||
return std::make_unique<TrackPlaceActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
|
|
|
@ -136,14 +136,12 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
{
|
||||
if (argv[0] == "list")
|
||||
{
|
||||
Ride* ride;
|
||||
int32_t i;
|
||||
FOR_ALL_RIDES (i, ride)
|
||||
for (const auto& ride : GetRideManager())
|
||||
{
|
||||
auto name = ride->GetName();
|
||||
auto name = ride.GetName();
|
||||
console.WriteFormatLine(
|
||||
"ride: %03d type: %02u subtype %03u operating mode: %02u name: %s", i, ride->type, ride->subtype,
|
||||
ride->mode, name.c_str());
|
||||
"ride: %03d type: %02u subtype %03u operating mode: %02u name: %s", ride.id, ride.type, ride.subtype,
|
||||
ride.mode, name.c_str());
|
||||
}
|
||||
}
|
||||
else if (argv[0] == "set")
|
||||
|
@ -215,7 +213,7 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
{
|
||||
console.WriteFormatLine("Invalid ride mode.");
|
||||
}
|
||||
else if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
else if (ride == nullptr)
|
||||
{
|
||||
console.WriteFormatLine("No ride found with index %d", ride_index);
|
||||
}
|
||||
|
@ -242,12 +240,12 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Ride* ride = get_ride(ride_index);
|
||||
auto ride = get_ride(ride_index);
|
||||
if (mass <= 0)
|
||||
{
|
||||
console.WriteFormatLine("Friction value must be strictly positive");
|
||||
}
|
||||
else if (ride->type == RIDE_TYPE_NULL)
|
||||
else if (ride == nullptr)
|
||||
{
|
||||
console.WriteFormatLine("No ride found with index %d", ride_index);
|
||||
}
|
||||
|
@ -282,12 +280,12 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Ride* ride = get_ride(ride_index);
|
||||
auto ride = get_ride(ride_index);
|
||||
if (excitement <= 0)
|
||||
{
|
||||
console.WriteFormatLine("Excitement value must be strictly positive");
|
||||
}
|
||||
else if (ride->type == RIDE_TYPE_NULL)
|
||||
else if (ride == nullptr)
|
||||
{
|
||||
console.WriteFormatLine("No ride found with index %d", ride_index);
|
||||
}
|
||||
|
@ -313,12 +311,12 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Ride* ride = get_ride(ride_index);
|
||||
auto ride = get_ride(ride_index);
|
||||
if (intensity <= 0)
|
||||
{
|
||||
console.WriteFormatLine("Intensity value must be strictly positive");
|
||||
}
|
||||
else if (ride->type == RIDE_TYPE_NULL)
|
||||
else if (ride == nullptr)
|
||||
{
|
||||
console.WriteFormatLine("No ride found with index %d", ride_index);
|
||||
}
|
||||
|
@ -344,12 +342,12 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Ride* ride = get_ride(ride_index);
|
||||
auto ride = get_ride(ride_index);
|
||||
if (nausea <= 0)
|
||||
{
|
||||
console.WriteFormatLine("Nausea value must be strictly positive");
|
||||
}
|
||||
else if (ride->type == RIDE_TYPE_NULL)
|
||||
else if (ride == nullptr)
|
||||
{
|
||||
console.WriteFormatLine("No ride found with index %d", ride_index);
|
||||
}
|
||||
|
@ -390,13 +388,11 @@ static int32_t cc_rides(InteractiveConsole& console, const arguments_t& argv)
|
|||
|
||||
if (int_valid[0] && int_valid[1])
|
||||
{
|
||||
uint16_t rideId{};
|
||||
Ride* ride;
|
||||
FOR_ALL_RIDES (rideId, ride)
|
||||
for (const auto& ride : GetRideManager())
|
||||
{
|
||||
if (ride->type == rideType)
|
||||
if (ride.type == rideType)
|
||||
{
|
||||
auto rideSetPrice = RideSetPriceAction(rideId, price, true);
|
||||
auto rideSetPrice = RideSetPriceAction(ride.id, price, true);
|
||||
GameActions::Execute(&rideSetPrice);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "RideTypes.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
#include <limits>
|
||||
#include <string_view>
|
||||
|
||||
interface IObjectManager;
|
||||
|
@ -39,10 +40,10 @@ struct Staff;
|
|||
#define MAX_CARS_PER_TRAIN 255
|
||||
#define MAX_STATIONS 4
|
||||
#define MAX_RIDES 255
|
||||
#define RIDE_ID_NULL 255
|
||||
#define RIDE_TYPE_NULL 255
|
||||
#define RIDE_ADJACENCY_CHECK_DISTANCE 5
|
||||
|
||||
constexpr ride_id_t RIDE_ID_NULL = std::numeric_limits<ride_id_t>::max();
|
||||
constexpr uint16_t const MAX_INVERSIONS = RCT12_MAX_INVERSIONS;
|
||||
constexpr uint16_t const MAX_GOLF_HOLES = RCT12_MAX_GOLF_HOLES;
|
||||
constexpr uint16_t const MAX_HELICES = RCT12_MAX_HELICES;
|
||||
|
|
|
@ -194,8 +194,8 @@ static void ride_ratings_update_state_1()
|
|||
static void ride_ratings_update_state_2()
|
||||
{
|
||||
const ride_id_t rideIndex = gRideRatingsCalcData.current_ride;
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED)
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride == nullptr || ride->status == RIDE_STATUS_CLOSED)
|
||||
{
|
||||
gRideRatingsCalcData.state = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
return;
|
||||
|
@ -268,8 +268,8 @@ static void ride_ratings_update_state_2()
|
|||
*/
|
||||
static void ride_ratings_update_state_3()
|
||||
{
|
||||
Ride* ride = get_ride(gRideRatingsCalcData.current_ride);
|
||||
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED)
|
||||
auto ride = get_ride(gRideRatingsCalcData.current_ride);
|
||||
if (ride == nullptr || ride->status == RIDE_STATUS_CLOSED)
|
||||
{
|
||||
gRideRatingsCalcData.state = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
return;
|
||||
|
@ -298,8 +298,8 @@ static void ride_ratings_update_state_4()
|
|||
*/
|
||||
static void ride_ratings_update_state_5()
|
||||
{
|
||||
Ride* ride = get_ride(gRideRatingsCalcData.current_ride);
|
||||
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED)
|
||||
auto ride = get_ride(gRideRatingsCalcData.current_ride);
|
||||
if (ride == nullptr || ride->status == RIDE_STATUS_CLOSED)
|
||||
{
|
||||
gRideRatingsCalcData.state = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
||||
return;
|
||||
|
|
|
@ -1870,7 +1870,7 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
|||
}
|
||||
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_warning("Invalid game command for track placement, ride id = %d", ride->id);
|
||||
return MONEY32_UNDEFINED;
|
||||
|
|
|
@ -2157,8 +2157,8 @@ void track_paint_util_left_corkscrew_up_supports(paint_session* session, uint8_t
|
|||
void track_paint(paint_session* session, uint8_t direction, int32_t height, const TileElement* tileElement)
|
||||
{
|
||||
ride_id_t rideIndex = tileElement->AsTrack()->GetRideIndex();
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
log_error("Attempted to paint invalid ride: %d", rideIndex);
|
||||
return;
|
||||
|
|
|
@ -1176,8 +1176,8 @@ void footpath_update_queue_chains()
|
|||
for (uint8_t* queueChainPtr = _footpathQueueChain; queueChainPtr < _footpathQueueChainNext; queueChainPtr++)
|
||||
{
|
||||
ride_id_t rideIndex = *queueChainPtr;
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride == nullptr)
|
||||
continue;
|
||||
|
||||
for (int32_t i = 0; i < MAX_STATIONS; i++)
|
||||
|
|
|
@ -509,7 +509,7 @@ money32 Park::CalculateParkValue() const
|
|||
money32 Park::CalculateRideValue(const Ride* ride) const
|
||||
{
|
||||
money32 result = 0;
|
||||
if (ride->type != RIDE_TYPE_NULL && ride->value != RIDE_VALUE_UNDEFINED)
|
||||
if (ride != nullptr && ride->value != RIDE_VALUE_UNDEFINED)
|
||||
{
|
||||
result = (ride->value * 10) * (ride_customers_in_last_5_minutes(ride) + rideBonusValue[ride->type] * 4);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue