1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwworld/livecellref.cpp

47 lines
1.1 KiB
C++
Raw Normal View History

#include "livecellref.hpp"
#include <components/esm/objectstate.hpp>
2014-03-22 15:39:24 +00:00
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "ptr.hpp"
#include "class.hpp"
2014-03-22 15:39:24 +00:00
#include "esmstore.hpp"
void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state)
{
mRef = state.mRef;
mData = RefData (state);
Ptr ptr (this);
if (state.mHasLocals)
2014-03-22 15:39:24 +00:00
{
std::string scriptId = mClass->getScript (ptr);
mData.setLocals (*MWBase::Environment::get().getWorld()->getStore().
get<ESM::Script>().search (scriptId));
mData.getLocals().read (state.mLocals, scriptId);
}
mClass->readAdditionalState (ptr, state);
}
void MWWorld::LiveCellRefBase::saveImp (ESM::ObjectState& state) const
{
state.mRef = mRef;
/// \todo get rid of this cast once const-correct Ptr are available
Ptr ptr (const_cast<LiveCellRefBase *> (this));
mData.write (state, mClass->getScript (ptr));
mClass->writeAdditionalState (ptr, state);
}
bool MWWorld::LiveCellRefBase::checkStateImp (const ESM::ObjectState& state)
{
return true;
}