Merge branch 'alignyorefs' into 'master'

Reorder RefData members to decrease its size

See merge request OpenMW/openmw!4020
pull/3235/head
Alexei Kotov 9 months ago
commit 55c5f2112b

@ -58,12 +58,12 @@ namespace MWWorld
RefData::RefData()
: mBaseNode(nullptr)
, mCustomData(nullptr)
, mFlags(0)
, mDeletedByContentFile(false)
, mEnabled(true)
, mPhysicsPostponed(false)
, mCustomData(nullptr)
, mChanged(false)
, mFlags(0)
{
for (int i = 0; i < 3; ++i)
{
@ -74,50 +74,50 @@ namespace MWWorld
RefData::RefData(const ESM::CellRef& cellRef)
: mBaseNode(nullptr)
, mPosition(cellRef.mPos)
, mCustomData(nullptr)
, mFlags(0) // Loading from ESM/ESP files -> assume unchanged
, mDeletedByContentFile(false)
, mEnabled(true)
, mPhysicsPostponed(false)
, mPosition(cellRef.mPos)
, mCustomData(nullptr)
, mChanged(false)
, mFlags(0) // Loading from ESM/ESP files -> assume unchanged
{
}
RefData::RefData(const ESM4::Reference& ref)
: mBaseNode(nullptr)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mFlags(0)
, mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted)
, mEnabled(!(ref.mFlags & ESM4::Rec_Disabled))
, mPhysicsPostponed(false)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mChanged(false)
, mFlags(0)
{
}
RefData::RefData(const ESM4::ActorCharacter& ref)
: mBaseNode(nullptr)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mFlags(0)
, mDeletedByContentFile(ref.mFlags & ESM4::Rec_Deleted)
, mEnabled(!(ref.mFlags & ESM4::Rec_Disabled))
, mPhysicsPostponed(false)
, mPosition(ref.mPos)
, mCustomData(nullptr)
, mChanged(false)
, mFlags(0)
{
}
RefData::RefData(const ESM::ObjectState& objectState, bool deletedByContentFile)
: mBaseNode(nullptr)
, mDeletedByContentFile(deletedByContentFile)
, mEnabled(objectState.mEnabled != 0)
, mPhysicsPostponed(false)
, mPosition(objectState.mPosition)
, mAnimationState(objectState.mAnimationState)
, mCustomData(nullptr)
, mChanged(true)
, mFlags(objectState.mFlags) // Loading from a savegame -> assume changed
, mDeletedByContentFile(deletedByContentFile)
, mEnabled(objectState.mEnabled != 0)
, mPhysicsPostponed(false)
, mChanged(true)
{
// "Note that the ActivationFlag_UseEnabled is saved to the reference,
// which will result in permanently suppressed activation if the reference script is removed.

@ -47,6 +47,10 @@ namespace MWWorld
MWScript::Locals mLocals;
std::shared_ptr<MWLua::LocalScripts> mLuaScripts;
ESM::Position mPosition;
ESM::AnimationState mAnimationState;
std::unique_ptr<CustomData> mCustomData;
unsigned int mFlags;
/// separate delete flag used for deletion by a content file
/// @note not stored in the save game file.
@ -58,20 +62,12 @@ namespace MWWorld
bool mPhysicsPostponed : 1;
private:
ESM::Position mPosition;
ESM::AnimationState mAnimationState;
std::unique_ptr<CustomData> mCustomData;
bool mChanged : 1;
void copy(const RefData& refData);
void cleanup();
bool mChanged;
unsigned int mFlags;
public:
RefData();

Loading…
Cancel
Save