summaryrefslogtreecommitdiffstats
path: root/source/cChunk.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-20 17:39:00 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-20 17:39:00 +0100
commitd592882fe0d1e7762470e6b5eff2b14ed26f1e69 (patch)
tree2a9a9fc2a7f6efe75c19511425ad611ad1996fed /source/cChunk.h
parentUsing own ASSERT() that logs to file (diff)
downloadcuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar.gz
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar.bz2
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar.lz
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar.xz
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.tar.zst
cuberite-d592882fe0d1e7762470e6b5eff2b14ed26f1e69.zip
Diffstat (limited to 'source/cChunk.h')
-rw-r--r--source/cChunk.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/cChunk.h b/source/cChunk.h
index 4453ed16a..289461f0d 100644
--- a/source/cChunk.h
+++ b/source/cChunk.h
@@ -70,6 +70,23 @@ public:
+/** Interface class used for comparing clients of two chunks.
+Used primarily for entity moving while both chunks are locked.
+*/
+class cClientDiffCallback
+{
+public:
+ /// Called for clients that are in Chunk1 and not in Chunk2,
+ virtual void Removed(cClientHandle * a_Client) = 0;
+
+ /// Called for clients that are in Chunk2 and not in Chunk1.
+ virtual void Added(cClientHandle * a_Client) = 0;
+} ;
+
+
+
+
+
struct sSetBlock
{
int x, y, z;
@@ -121,7 +138,7 @@ public:
/// Returns true if there is a block entity at the coords specified
bool HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ);
-
+
void Tick(float a_Dt, MTRand & a_TickRandom);
int GetPosX() { return m_PosX; }
@@ -149,7 +166,7 @@ public:
bool HasClient (cClientHandle* a_Client );
bool HasAnyClients(void); // Returns true if theres any client in the chunk; false otherwise
- void AddEntity( cEntity * a_Entity );
+ void AddEntity( cEntity * a_Entity);
void RemoveEntity( cEntity * a_Entity);
void UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z); // [x, y, z] in world block coords
@@ -206,6 +223,8 @@ public:
private:
+ friend class cChunkMap;
+
bool m_IsValid; // True if the chunk is loaded / generated
bool m_IsDirty; // True if the chunk has changed since it was last saved
bool m_IsSaving; // True if the chunk is being saved
@@ -251,6 +270,9 @@ private:
void SpreadLightOfBlockZ(char* a_LightBuffer, int a_X, int a_Y, int a_Z);
void CreateBlockEntities(void);
+
+ // Makes a copy of the list
+ cClientHandleList GetAllClients(void) const {return m_LoadedByClient; }
};
typedef std::tr1::shared_ptr<cChunk> cChunkPtr;