Add wrapper to iterate vehicle pool with vehicle type filter

Without needing to dereference vehicle pointers if using tagged pointers
This commit is contained in:
Jonathan G Rennison
2024-02-25 13:38:49 +00:00
parent be4aea0dad
commit 05e237f8d1
10 changed files with 47 additions and 26 deletions

View File

@@ -1224,8 +1224,8 @@ static bool CanUpdateServiceInterval(VehicleType type, int32_t &new_value)
static void UpdateServiceInterval(VehicleType type, int32_t new_value)
{
if (_game_mode != GM_MENU && Company::IsValidID(_current_company)) {
for (Vehicle *v : Vehicle::Iterate()) {
if (v->owner == _current_company && v->type == type && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
for (Vehicle *v : Vehicle::IterateType(type)) {
if (v->owner == _current_company && v->IsPrimaryVehicle() && !v->ServiceIntervalIsCustom()) {
v->SetServiceInterval(new_value);
}
}