diff --git a/contributors.md b/contributors.md index f0551dd996..164f02166a 100644 --- a/contributors.md +++ b/contributors.md @@ -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 diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 0f64e31710..2a40eaf5ca 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -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(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(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(vehicleSpriteIndex); + Vehicle* vehicle = GetEntity(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(vehicleSpriteIndex); + auto vehicle = GetEntity(ride->vehicles[w->ride.view - 1]); if (vehicle == nullptr) return STR_EMPTY; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index a54ec6f7fc..c8709f0434 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -835,9 +835,7 @@ void Ride::FormatStatusTo(Formatter& ft) const { ft.Add(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(race_winner); if (peep != nullptr) @@ -2751,15 +2749,10 @@ Peep* find_closest_mechanic(const CoordsXY& entrancePosition, int32_t forInspect Staff* ride_get_mechanic(Ride* ride) { - if (ride->mechanic != SPRITE_INDEX_NULL) + auto staff = GetEntity(ride->mechanic); + if (staff != nullptr && staff->IsMechanic()) { - auto peep = GetEntity(ride->mechanic); - if (peep != nullptr) - { - auto staff = peep->AsStaff(); - if (staff != nullptr && staff->IsMechanic()) - return staff; - } + return staff; } return nullptr; }