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

@@ -254,8 +254,8 @@ bool CheckSharingChangePossible(VehicleType type, bool new_value)
});
StringID error_message = STR_NULL;
for (Vehicle *v : Vehicle::Iterate()) {
if (type != v->type || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
for (Vehicle *v : Vehicle::IterateType(type)) {
if (HasBit(v->subtype, GVSF_VIRTUAL)) continue;
if (v->Previous() != nullptr) continue;
/* Check vehicle positiion */