1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 15:36:40 +00:00

Define LiveCellRefBase functions inside MWWorld namespace block

This commit is contained in:
elsid 2024-06-15 00:31:43 +02:00
parent ca8869042b
commit 4565152b3d
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
2 changed files with 83 additions and 83 deletions

View file

@ -15,35 +15,37 @@
#include "ptr.hpp"
#include "worldmodel.hpp"
MWWorld::LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM::CellRef& cref)
namespace MWWorld
{
LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM::CellRef& cref)
: mClass(&Class::get(type))
, mRef(cref)
, mData(cref)
{
}
{
}
MWWorld::LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM4::Reference& cref)
LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM4::Reference& cref)
: mClass(&Class::get(type))
, mRef(cref)
, mData(cref)
{
}
{
}
MWWorld::LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM4::ActorCharacter& cref)
LiveCellRefBase::LiveCellRefBase(unsigned int type, const ESM4::ActorCharacter& cref)
: mClass(&Class::get(type))
, mRef(cref)
, mData(cref)
{
}
{
}
MWWorld::LiveCellRefBase::~LiveCellRefBase()
{
LiveCellRefBase::~LiveCellRefBase()
{
MWBase::Environment::get().getWorldModel()->deregisterLiveCellRef(*this);
}
}
void MWWorld::LiveCellRefBase::loadImp(const ESM::ObjectState& state)
{
mRef = MWWorld::CellRef(state.mRef);
void LiveCellRefBase::loadImp(const ESM::ObjectState& state)
{
mRef = CellRef(state.mRef);
mData = RefData(state, mData.isDeletedByContentFile());
Ptr ptr(this);
@ -81,10 +83,10 @@ void MWWorld::LiveCellRefBase::loadImp(const ESM::ObjectState& state)
}
MWBase::Environment::get().getLuaManager()->loadLocalScripts(ptr, state.mLuaScripts);
}
}
void MWWorld::LiveCellRefBase::saveImp(ESM::ObjectState& state) const
{
void LiveCellRefBase::saveImp(ESM::ObjectState& state) const
{
mRef.writeState(state);
ConstPtr ptr(this);
@ -94,25 +96,23 @@ void MWWorld::LiveCellRefBase::saveImp(ESM::ObjectState& state) const
Ptr(const_cast<LiveCellRefBase*>(this)), state.mLuaScripts);
mClass->writeAdditionalState(ptr, state);
}
}
bool MWWorld::LiveCellRefBase::checkStateImp(const ESM::ObjectState& state)
{
bool LiveCellRefBase::checkStateImp(const ESM::ObjectState& state)
{
return true;
}
}
unsigned int MWWorld::LiveCellRefBase::getType() const
{
unsigned int LiveCellRefBase::getType() const
{
return mClass->getType();
}
}
bool MWWorld::LiveCellRefBase::isDeleted() const
{
bool LiveCellRefBase::isDeleted() const
{
return mData.isDeletedByContentFile() || mRef.getCount(false) == 0;
}
}
namespace MWWorld
{
std::string makeDynamicCastErrorMessage(const LiveCellRefBase* value, std::string_view recordType)
{
std::stringstream message;

View file

@ -29,7 +29,7 @@ namespace MWWorld
/** Information about this instance, such as 3D location and rotation
* and individual type-dependent data.
*/
MWWorld::CellRef mRef;
CellRef mRef;
/** runtime-data */
RefData mData;