finish manager split
This commit is contained in:
@ -1,10 +1,25 @@
|
||||
#include "CKSceneObject.hpp"
|
||||
#include "../CKStateChunk.hpp"
|
||||
#include "../CKContext.hpp"
|
||||
#include "../MgrImpls/CKObjectManager.hpp"
|
||||
#include "CKBeObject.hpp"
|
||||
#include "CKGroup.hpp"
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
CKBeObject::CKBeObject(CKContext* ctx, CK_ID ckid, CKSTRING name) :
|
||||
CKSceneObject(ctx, ckid, name) {}
|
||||
|
||||
CKBeObject::~CKBeObject() {
|
||||
// remove self from all group
|
||||
for (size_t i = 0; i < m_Groups.size(); ++i) {
|
||||
if (m_Groups[i]) {
|
||||
CKGroup* group = static_cast<CKGroup*>(m_Context->GetObjectManager()->GetGroupByGlobalIndex(static_cast<CKDWORD>(i)));
|
||||
group->RemoveObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CKBeObject::Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) {
|
||||
bool suc = CKSceneObject::Save(chunk, file, flags);
|
||||
if (!suc) return false;
|
||||
|
@ -7,10 +7,8 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
|
||||
class CKBeObject : public CKSceneObject {
|
||||
public:
|
||||
CKBeObject(CKContext* ctx, CK_ID ckid, CKSTRING name) :
|
||||
CKSceneObject(ctx, ckid, name)
|
||||
{}
|
||||
virtual ~CKBeObject() {}
|
||||
CKBeObject(CKContext* ctx, CK_ID ckid, CKSTRING name);
|
||||
virtual ~CKBeObject();
|
||||
LIBCMO_DISABLE_COPY_MOVE(CKBeObject);
|
||||
|
||||
virtual CK_CLASSID GetClassID(void) override {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "CKGroup.hpp"
|
||||
#include "../CKStateChunk.hpp"
|
||||
#include "../CKContext.hpp"
|
||||
#include "../MgrImpls/CKObjectManager.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace LibCmo::CK2::ObjImpls {
|
||||
@ -8,10 +9,10 @@ namespace LibCmo::CK2::ObjImpls {
|
||||
CKGroup::CKGroup(CKContext* ctx, CK_ID ckid, CKSTRING name) :
|
||||
CKBeObject(ctx, ckid, name),
|
||||
m_ObjectArray(),
|
||||
m_GroupIndex(m_Context->AllocateGroupGlobalIndex()) {}
|
||||
m_GroupIndex(m_Context->GetObjectManager()->AllocateGroupGlobalIndex(this)) {}
|
||||
|
||||
CKGroup::~CKGroup() {
|
||||
m_Context->FreeGroupGlobalIndex(m_GroupIndex);
|
||||
m_Context->GetObjectManager()->FreeGroupGlobalIndex(m_GroupIndex);
|
||||
}
|
||||
|
||||
bool CKGroup::Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) {
|
||||
|
Reference in New Issue
Block a user