1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-01 08:39:44 +00:00

uses a bitfield in refdata.hpp (#3143)

* uses a bitfield in refdata.hpp

With this simple change we pack boolean values to reduce the memory requirements of game objects.

* refdata.hpp [ci skip]

* refdata.cpp
This commit is contained in:
Bo Svensson 2021-10-04 10:12:00 +00:00 committed by GitHub
parent 61168c3583
commit e4a9eefc2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -65,21 +65,21 @@ namespace MWWorld
}
RefData::RefData (const ESM::CellRef& cellRef)
: mBaseNode(nullptr), mDeletedByContentFile(false), mEnabled (true),
: mBaseNode(nullptr), mDeletedByContentFile(false), mEnabled (true), mPhysicsPostponed(false),
mCount (1), mPosition (cellRef.mPos),
mCustomData (nullptr),
mChanged(false), mFlags(0), mPhysicsPostponed(false) // Loading from ESM/ESP files -> assume unchanged
mChanged(false), mFlags(0) // Loading from ESM/ESP files -> assume unchanged
{
}
RefData::RefData (const ESM::ObjectState& objectState, bool deletedByContentFile)
: mBaseNode(nullptr), mDeletedByContentFile(deletedByContentFile),
mEnabled (objectState.mEnabled != 0),
mEnabled (objectState.mEnabled != 0), mPhysicsPostponed(false),
mCount (objectState.mCount),
mPosition (objectState.mPosition),
mAnimationState(objectState.mAnimationState),
mCustomData (nullptr),
mChanged(true), mFlags(objectState.mFlags), mPhysicsPostponed(false) // Loading from a savegame -> assume changed
mChanged(true), mFlags(objectState.mFlags) // Loading from a savegame -> assume changed
{
// "Note that the ActivationFlag_UseEnabled is saved to the reference,
// which will result in permanently suppressed activation if the reference script is removed.

View file

@ -41,9 +41,12 @@ namespace MWWorld
/// separate delete flag used for deletion by a content file
/// @note not stored in the save game file.
bool mDeletedByContentFile;
bool mDeletedByContentFile:1;
bool mEnabled;
bool mEnabled:1;
public:
bool mPhysicsPostponed:1;
private:
/// 0: deleted
int mCount;
@ -63,9 +66,6 @@ namespace MWWorld
unsigned int mFlags;
public:
bool mPhysicsPostponed;
RefData();
/// @param cellRef Used to copy constant data such as position into this class where it can