1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 11:22:45 +01:00

Codechange: Simplify usage of GRFFileProps by adding some common helper methods.

This commit is contained in:
frosch
2025-04-26 21:18:07 +02:00
committed by frosch
parent 46494c6d44
commit b7e7f08f78
12 changed files with 67 additions and 17 deletions

View File

@@ -1086,8 +1086,7 @@ VehicleResolverObject::VehicleResolverObject(EngineID engine_type, const Vehicle
if (this->root_spritegroup == nullptr) {
const Engine *e = Engine::Get(engine_type);
CargoType cargo = v != nullptr ? v->cargo_type : CargoGRFFileProps::SG_PURCHASE;
this->root_spritegroup = e->grf_prop.GetSpriteGroup(cargo);
if (this->root_spritegroup == nullptr) this->root_spritegroup = e->grf_prop.GetSpriteGroup(CargoGRFFileProps::SG_DEFAULT);
this->root_spritegroup = e->grf_prop.GetFirstSpriteGroupOf({cargo, CargoGRFFileProps::SG_DEFAULT});
}
}
}