1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-13 07:14:31 +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)
void LiveCellRefBase::loadImp(const ESM::ObjectState& state)
{
mRef = MWWorld::CellRef(state.mRef);
mRef = CellRef(state.mRef);
mData = RefData(state, mData.isDeletedByContentFile());
Ptr ptr(this);
@ -83,7 +85,7 @@ 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);
@ -96,23 +98,21 @@ void MWWorld::LiveCellRefBase::saveImp(ESM::ObjectState& state) const
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;