37 lines
547 B
C++
37 lines
547 B
C++
#pragma once
|
|
|
|
class Creature;
|
|
|
|
class CreatureWeakPtrChunk
|
|
{
|
|
public:
|
|
|
|
CreatureWeakPtrChunk();
|
|
~CreatureWeakPtrChunk();
|
|
void Clear();
|
|
void Set(Creature* c);
|
|
|
|
private:
|
|
Creature* ptr_ = nullptr;
|
|
list_head ptrs_;
|
|
friend class CreatureWeakPtr;
|
|
};
|
|
|
|
class CreatureWeakPtr
|
|
{
|
|
public:
|
|
|
|
CreatureWeakPtr();
|
|
~CreatureWeakPtr();
|
|
void Reset();
|
|
Creature* Get();
|
|
void Attach(Creature* c);
|
|
void Detach();
|
|
|
|
private:
|
|
Creature* ptr_ = nullptr;
|
|
list_head entry_;
|
|
|
|
friend class CreatureWeakPtrChunk;
|
|
};
|