forked from teamnwah/openmw-tes3coop
Utilize the mHasCustomData flag in writeAdditionalState
This commit is contained in:
parent
19d87c78f2
commit
eb51e2838f
5 changed files with 23 additions and 7 deletions
|
@ -299,6 +299,8 @@ namespace MWClass
|
|||
|
||||
void Container::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const
|
||||
{
|
||||
if (!state.mHasCustomState)
|
||||
return;
|
||||
const ESM::ContainerState& state2 = dynamic_cast<const ESM::ContainerState&> (state);
|
||||
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
|
@ -316,7 +318,11 @@ namespace MWClass
|
|||
{
|
||||
ESM::ContainerState& state2 = dynamic_cast<ESM::ContainerState&> (state);
|
||||
|
||||
ensureCustomData (ptr);
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
{
|
||||
state.mHasCustomState = false;
|
||||
return;
|
||||
}
|
||||
|
||||
dynamic_cast<ContainerCustomData&> (*ptr.getRefData().getCustomData()).mContainerStore.
|
||||
writeState (state2.mInventory);
|
||||
|
|
|
@ -735,8 +735,6 @@ namespace MWClass
|
|||
return;
|
||||
}
|
||||
|
||||
ensureCustomData (ptr);
|
||||
|
||||
CreatureCustomData& customData = ptr.getRefData().getCustomData()->asCreatureCustomData();
|
||||
|
||||
customData.mContainerStore->writeState (state2.mInventory);
|
||||
|
|
|
@ -104,6 +104,9 @@ namespace MWClass
|
|||
void CreatureLevList::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state)
|
||||
const
|
||||
{
|
||||
if (!state.mHasCustomState)
|
||||
return;
|
||||
|
||||
const ESM::CreatureLevListState& state2 = dynamic_cast<const ESM::CreatureLevListState&> (state);
|
||||
|
||||
ensureCustomData(ptr);
|
||||
|
@ -117,7 +120,12 @@ namespace MWClass
|
|||
{
|
||||
ESM::CreatureLevListState& state2 = dynamic_cast<ESM::CreatureLevListState&> (state);
|
||||
|
||||
ensureCustomData(ptr);
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
{
|
||||
state.mHasCustomState = false;
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureLevListCustomData& customData = ptr.getRefData().getCustomData()->asCreatureLevListCustomData();
|
||||
state2.mSpawnActorId = customData.mSpawnActorId;
|
||||
state2.mSpawn = customData.mSpawn;
|
||||
|
|
|
@ -343,6 +343,8 @@ namespace MWClass
|
|||
|
||||
void Door::readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state) const
|
||||
{
|
||||
if (!state.mHasCustomState)
|
||||
return;
|
||||
ensureCustomData(ptr);
|
||||
DoorCustomData& customData = ptr.getRefData().getCustomData()->asDoorCustomData();
|
||||
|
||||
|
@ -352,7 +354,11 @@ namespace MWClass
|
|||
|
||||
void Door::writeAdditionalState (const MWWorld::Ptr& ptr, ESM::ObjectState& state) const
|
||||
{
|
||||
ensureCustomData(ptr);
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
{
|
||||
state.mHasCustomState = false;
|
||||
return;
|
||||
}
|
||||
const DoorCustomData& customData = ptr.getRefData().getCustomData()->asDoorCustomData();
|
||||
|
||||
ESM::DoorState& state2 = dynamic_cast<ESM::DoorState&>(state);
|
||||
|
|
|
@ -1187,8 +1187,6 @@ namespace MWClass
|
|||
return;
|
||||
}
|
||||
|
||||
ensureCustomData (ptr);
|
||||
|
||||
NpcCustomData& customData = ptr.getRefData().getCustomData()->asNpcCustomData();
|
||||
|
||||
customData.mInventoryStore.writeState (state2.mInventory);
|
||||
|
|
Loading…
Reference in a new issue