Codechange: Remove object enabled
flag and shuffle members. (#10358)
`enabled` flag is replaced with IsEnabled() which checks if views is non-zero. ObjectSpec is shuffled to reduce its memory footprint.
This commit is contained in:
@@ -4113,7 +4113,6 @@ static ChangeInfoResult ObjectChangeInfo(uint id, int numinfo, int prop, ByteRea
|
||||
/* Swap classid because we read it in BE. */
|
||||
uint32 classid = buf->ReadDWord();
|
||||
(*ospec)->cls_id = ObjectClass::Allocate(BSWAP32(classid));
|
||||
(*ospec)->enabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9283,7 +9282,7 @@ static void FinaliseObjectsArray()
|
||||
ObjectSpec **&objectspec = file->objectspec;
|
||||
if (objectspec != nullptr) {
|
||||
for (int i = 0; i < NUM_OBJECTS_PER_GRF; i++) {
|
||||
if (objectspec[i] != nullptr && objectspec[i]->grf_prop.grffile != nullptr && objectspec[i]->enabled) {
|
||||
if (objectspec[i] != nullptr && objectspec[i]->grf_prop.grffile != nullptr && objectspec[i]->IsEnabled()) {
|
||||
_object_mngr.SetEntitySpec(objectspec[i]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user