Reset Entity to 0 on removal (#13835)

This is to force any use after remove bugs to the surface
This commit is contained in:
Duncan 2021-01-16 15:48:39 +00:00 committed by GitHub
parent fb4d14e843
commit 4ff5b9a89f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -1023,8 +1023,8 @@ static void ride_remove_cable_lift(Ride* ride)
return;
}
vehicle->Invalidate();
sprite_remove(vehicle);
spriteIndex = vehicle->next_vehicle_on_train;
sprite_remove(vehicle);
} while (spriteIndex != SPRITE_INDEX_NULL);
}
}
@ -1051,8 +1051,8 @@ static void ride_remove_vehicles(Ride* ride)
break;
}
vehicle->Invalidate();
sprite_remove(vehicle);
spriteIndex = vehicle->next_vehicle_on_train;
sprite_remove(vehicle);
}
ride->vehicles[i] = SPRITE_INDEX_NULL;

View File

@ -797,10 +797,8 @@ void sprite_remove(SpriteBase* sprite)
EntityTweener::Get().RemoveEntity(sprite);
move_sprite_to_list(sprite, EntityListId::Free);
sprite->sprite_identifier = SpriteIdentifier::Null;
_spriteFlashingList[sprite->sprite_index] = false;
SpriteSpatialRemove(sprite);
sprite_reset(sprite);
}
static bool litter_can_be_at(const CoordsXYZ& mapPos)