mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-21 03:12:41 +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
@@ -173,11 +173,11 @@ static uint32_t GetObjectIDAtOffset(TileIndex tile, uint32_t cur_grfid)
|
||||
const ObjectSpec *spec = ObjectSpec::Get(o->type);
|
||||
|
||||
/* Default objects have no associated NewGRF file */
|
||||
if (spec->grf_prop.grffile == nullptr) {
|
||||
if (!spec->grf_prop.HasGrfFile()) {
|
||||
return 0xFFFE; // Defined in another grf file
|
||||
}
|
||||
|
||||
if (spec->grf_prop.grffile->grfid == cur_grfid) { // same object, same grf ?
|
||||
if (spec->grf_prop.grfid == cur_grfid) { // same object, same grf ?
|
||||
return spec->grf_prop.local_id | o->view << 16;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user