mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
* refactor: deleted double check of SPRITE_INDEX_NULL in Staff* ride_get_mechanic(Ride* ride) * refactor: deleted double check of SPRITE_INDEX_NULL in Ride.cpp file * refactor: deleted double check of SPRITE_INDEX_NULL in windows/Ride.cpp in function static rct_string_id window_ride_get_status_vehicle * refactor: deleted double check of SPRITE_INDEX_NULL in ride/Ride.cpp * refactor: deleted double check in FormatStatusTo
This commit is contained in:
parent
f49bfa777a
commit
0f78d452a4
3 changed files with 10 additions and 27 deletions
|
@ -149,6 +149,7 @@ The following people are not part of the development team, but have been contrib
|
|||
* Deanna Baris (dbaris)
|
||||
* Chaitanya Thengdi (chaitanyathengdi)
|
||||
* Sidney Kuyateh (autinerd)
|
||||
* Łukasz Pękalski (Lukasz-Pe)
|
||||
|
||||
## Toolchain
|
||||
* (Balletie) - macOS
|
||||
|
|
|
@ -1626,15 +1626,14 @@ rct_window* window_ride_open_vehicle(Vehicle* vehicle)
|
|||
int32_t numPeepsLeft = vehicle->num_peeps;
|
||||
for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++)
|
||||
{
|
||||
uint16_t peepSpriteIndex = vehicle->peep[i];
|
||||
if (peepSpriteIndex == SPRITE_INDEX_NULL)
|
||||
Peep* peep = GetEntity<Peep>(vehicle->peep[i]);
|
||||
if (peep != nullptr)
|
||||
continue;
|
||||
|
||||
numPeepsLeft--;
|
||||
rct_window* w2 = window_find_by_number(WC_PEEP, peepSpriteIndex);
|
||||
rct_window* w2 = window_find_by_number(WC_PEEP, vehicle->peep[i]);
|
||||
if (w2 == nullptr)
|
||||
{
|
||||
Peep* peep = GetEntity<Peep>(peepSpriteIndex);
|
||||
auto intent = Intent(WC_PEEP);
|
||||
intent.putExtra(INTENT_EXTRA_PEEP, peep);
|
||||
context_open_intent(&intent);
|
||||
|
@ -2457,12 +2456,7 @@ static void window_ride_main_update(rct_window* w)
|
|||
|
||||
if (w->ride.view <= ride->num_vehicles)
|
||||
{
|
||||
int32_t vehicleIndex = w->ride.view - 1;
|
||||
uint16_t vehicleSpriteIndex = ride->vehicles[vehicleIndex];
|
||||
if (vehicleSpriteIndex == SPRITE_INDEX_NULL)
|
||||
return;
|
||||
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(vehicleSpriteIndex);
|
||||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
||||
if (vehicle == nullptr
|
||||
|| (vehicle->status != VEHICLE_STATUS_TRAVELLING && vehicle->status != VEHICLE_STATUS_TRAVELLING_CABLE_LIFT
|
||||
&& vehicle->status != VEHICLE_STATUS_TRAVELLING_DODGEMS
|
||||
|
@ -2675,12 +2669,7 @@ static rct_string_id window_ride_get_status_vehicle(rct_window* w, void* argumen
|
|||
if (ride == nullptr)
|
||||
return STR_EMPTY;
|
||||
|
||||
auto vehicleIndex = w->ride.view - 1;
|
||||
auto vehicleSpriteIndex = ride->vehicles[vehicleIndex];
|
||||
if (vehicleSpriteIndex == SPRITE_INDEX_NULL)
|
||||
return STR_EMPTY;
|
||||
|
||||
auto vehicle = GetEntity<Vehicle>(vehicleSpriteIndex);
|
||||
auto vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
||||
if (vehicle == nullptr)
|
||||
return STR_EMPTY;
|
||||
|
||||
|
|
|
@ -835,9 +835,7 @@ void Ride::FormatStatusTo(Formatter& ft) const
|
|||
{
|
||||
ft.Add<rct_string_id>(STR_TEST_RUN);
|
||||
}
|
||||
else if (
|
||||
mode == RIDE_MODE_RACE && !(lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING)
|
||||
&& race_winner != SPRITE_INDEX_NULL)
|
||||
else if (mode == RIDE_MODE_RACE && !(lifecycle_flags & RIDE_LIFECYCLE_PASS_STATION_NO_STOPPING))
|
||||
{
|
||||
auto peep = GetEntity<Peep>(race_winner);
|
||||
if (peep != nullptr)
|
||||
|
@ -2751,16 +2749,11 @@ Peep* find_closest_mechanic(const CoordsXY& entrancePosition, int32_t forInspect
|
|||
|
||||
Staff* ride_get_mechanic(Ride* ride)
|
||||
{
|
||||
if (ride->mechanic != SPRITE_INDEX_NULL)
|
||||
{
|
||||
auto peep = GetEntity<Peep>(ride->mechanic);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
auto staff = peep->AsStaff();
|
||||
auto staff = GetEntity<Staff>(ride->mechanic);
|
||||
if (staff != nullptr && staff->IsMechanic())
|
||||
{
|
||||
return staff;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue