mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-16 08:52:40 +01:00
Codechange: Store grfid with entity grfprops.
This allows using the grfid without having to dereference the grffile pointer. Uses no extra storage as it fits within otherwise wasted padding space.
This commit is contained in:
committed by
Peter Nelson
parent
e750d10cee
commit
e73d6fcaac
@@ -112,7 +112,7 @@ void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, u
|
||||
if (HasBit(spec->callback_mask, CBM_OBJ_COLOUR)) {
|
||||
uint16_t res = GetObjectCallback(CBID_OBJECT_COLOUR, o->colour, 0, spec, o, tile);
|
||||
if (res != CALLBACK_FAILED) {
|
||||
if (res >= 0x100) ErrorUnknownCallbackResult(spec->grf_prop.grffile->grfid, CBID_OBJECT_COLOUR, res);
|
||||
if (res >= 0x100) ErrorUnknownCallbackResult(spec->grf_prop.grfid, CBID_OBJECT_COLOUR, res);
|
||||
o->colour = GB(res, 0, 8);
|
||||
}
|
||||
}
|
||||
@@ -665,8 +665,8 @@ static void GetTileDesc_Object(TileIndex tile, TileDesc *td)
|
||||
td->owner[0] = GetTileOwner(tile);
|
||||
td->build_date = Object::GetByTile(tile)->build_date;
|
||||
|
||||
if (spec->grf_prop.grffile != nullptr) {
|
||||
td->grf = GetGRFConfig(spec->grf_prop.grffile->grfid)->GetName();
|
||||
if (spec->grf_prop.HasGrfFile()) {
|
||||
td->grf = GetGRFConfig(spec->grf_prop.grfid)->GetName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user