summaryrefslogtreecommitdiffstats
path: root/src/Chunk.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Chunk.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Chunk.h b/src/Chunk.h
index 87f2cd568..7e399052d 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -61,6 +61,7 @@ class cChunk :
public cChunkDef // The inheritance is "misused" here only to inherit the functions and constants defined in cChunkDef
{
public:
+
/** Represents the presence state of the chunk */
enum ePresence
{
@@ -75,7 +76,7 @@ public:
cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP, // Neighbor chunks
cAllocationPool<cChunkData::sChunkSection> & a_Pool
);
- cChunk(cChunk & other);
+ cChunk(cChunk & other) = delete;
~cChunk();
/** Returns true iff the chunk block data is valid (loaded / generated) */
@@ -248,8 +249,12 @@ public:
/** Returns true if theres any client in the chunk; false otherwise */
bool HasAnyClients(void) const;
- void AddEntity(cEntity * a_Entity);
- void RemoveEntity(cEntity * a_Entity);
+ void AddEntity(OwnedEntity a_Entity);
+
+ /** Releases ownership of the given entity if it was found in this chunk.
+ Returns an owning reference to the found entity. */
+ OwnedEntity RemoveEntity(cEntity & a_Entity);
+
bool HasEntity(UInt32 a_EntityID);
/** Calls the callback for each entity; returns true if all entities processed, false if the callback aborted by returning true */
@@ -525,7 +530,7 @@ private:
// A critical section is not needed, because all chunk access is protected by its parent ChunkMap's csLayers
std::vector<cClientHandle *> m_LoadedByClient;
- cEntityList m_Entities;
+ std::vector<OwnedEntity> m_Entities;
cBlockEntities m_BlockEntities;
/** Number of times the chunk has been requested to stay (by various cChunkStay objects); if zero, the chunk can be unloaded */
@@ -602,7 +607,7 @@ private:
bool GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType);
/** Called by Tick() when an entity moves out of this chunk into a neighbor; moves the entity and sends spawn / despawn packet to clients */
- void MoveEntityToNewChunk(cEntity * a_Entity);
+ void MoveEntityToNewChunk(OwnedEntity a_Entity);
};
typedef cChunk * cChunkPtr;