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:
@@ -961,8 +961,8 @@ static CompanyID GetPreviewCompany(Engine *e)
|
||||
c->old_economy[0].performance_history > best_hist) {
|
||||
|
||||
/* Check whether the company uses similar vehicles */
|
||||
for (const Vehicle *v : Vehicle::Iterate()) {
|
||||
if (v->owner != c->index || v->type != e->type || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
|
||||
for (const Vehicle *v : Vehicle::IterateType(e->type)) {
|
||||
if (v->owner != c->index || HasBit(v->subtype, GVSF_VIRTUAL)) continue;
|
||||
if (!v->GetEngine()->CanCarryCargo() || !HasBit(cargomask, v->cargo_type)) continue;
|
||||
|
||||
best_hist = c->old_economy[0].performance_history;
|
||||
|
Reference in New Issue
Block a user