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:
PeterN
2023-01-15 10:58:03 +00:00
committed by GitHub
parent 8f9a60893d
commit 2355882ec1
5 changed files with 14 additions and 10 deletions

View File

@@ -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]);
}
}