summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cChunkMap.h94
1 files changed, 48 insertions, 46 deletions
diff --git a/source/cChunkMap.h b/source/cChunkMap.h
index 297056d81..10fe1e70a 100644
--- a/source/cChunkMap.h
+++ b/source/cChunkMap.h
@@ -5,17 +5,23 @@
#pragma once
-#include "cChunk.h"
+#include "ChunkDef.h"
class cWorld;
-class cEntity;
class cItem;
class MTRand;
class cChunkStay;
+class cChunk;
+class cPacket;
+class cPlayer;
+
+typedef std::list<cClientHandle *> cClientHandleList;
+typedef cChunk * cChunkPtr;
+
@@ -42,28 +48,49 @@ public:
void MarkChunkDirty (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
void MarkChunkSaving (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
void MarkChunkSaved (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
- void ChunkDataLoaded (int a_ChunkX, int a_ChunkY, int a_ChunkZ, const char * a_BlockData, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities);
- void ChunkDataGenerated (int a_ChunkX, int a_ChunkY, int a_ChunkZ, const char * a_BlockData, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities);
+
+ void ChunkDataLoaded(
+ int a_ChunkX, int a_ChunkY, int a_ChunkZ,
+ const BLOCKTYPE * a_BlockTypes,
+ const BLOCKTYPE * a_BlockMeta,
+ const BLOCKTYPE * a_BlockLight,
+ const BLOCKTYPE * a_BlockSkyLight,
+ const cChunkDef::HeightMap * a_HeightMap,
+ cEntityList & a_Entities,
+ cBlockEntityList & a_BlockEntities
+ );
+
+ void ChunkDataGenerated (
+ int a_ChunkX, int a_ChunkY, int a_ChunkZ,
+ const BLOCKTYPE * a_BlockTypes,
+ const BLOCKTYPE * a_BlockMeta,
+ const BLOCKTYPE * a_BlockLight,
+ const BLOCKTYPE * a_BlockSkyLight,
+ const cChunkDef::HeightMap * a_HeightMap,
+ cEntityList & a_Entities,
+ cBlockEntityList & a_BlockEntities
+ );
+
bool GetChunkData (int a_ChunkX, int a_ChunkY, int a_ChunkZ, cChunkDataCallback & a_Callback);
/// Gets the chunk's blocks, only the block types
- bool GetChunkBlocks (int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_Blocks);
-
- /// Gets the chunk's blockdata, the entire array
- bool GetChunkBlockData (int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_BlockData);
-
- bool IsChunkValid (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
- bool HasChunkAnyClients (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
- void SpreadChunkLighting(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
- int GetHeight (int a_BlockX, int a_BlockZ);
- void FastSetBlocks (sSetBlockList & a_BlockList);
- void CollectPickupsByPlayer(cPlayer * a_Player);
- char GetBlock (int a_X, int a_Y, int a_Z);
- char GetBlockMeta (int a_X, int a_Y, int a_Z);
- void SetBlockMeta (int a_X, int a_Y, int a_Z, char a_BlockMeta);
- void SetBlock (int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta);
- bool DigBlock (int a_X, int a_Y, int a_Z, cItem & a_PickupItem);
- void SendBlockTo (int a_X, int a_Y, int a_Z, cPlayer * a_Player);
+ bool GetChunkBlockTypes (int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_Blocks);
+
+ /// Gets the chunk's block data, the entire 4 arrays (Types, Meta, Light, SkyLight)
+ bool GetChunkBlockData (int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_BlockData);
+
+ bool IsChunkValid (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
+ bool HasChunkAnyClients (int a_ChunkX, int a_ChunkY, int a_ChunkZ);
+ void SpreadChunkLighting(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
+ int GetHeight (int a_BlockX, int a_BlockZ);
+ void FastSetBlocks (sSetBlockList & a_BlockList);
+ void CollectPickupsByPlayer(cPlayer * a_Player);
+ BLOCKTYPE GetBlock (int a_X, int a_Y, int a_Z);
+ BLOCKTYPE GetBlockMeta (int a_X, int a_Y, int a_Z);
+ void SetBlockMeta (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockMeta);
+ void SetBlock (int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta);
+ bool DigBlock (int a_X, int a_Y, int a_Z, cItem & a_PickupItem);
+ void SendBlockTo (int a_X, int a_Y, int a_Z, cPlayer * a_Player);
/// Compares clients of two chunks, calls the callback accordingly
void CompareChunkClients(int a_ChunkX1, int a_ChunkY1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkY2, int a_ChunkZ2, cClientDiffCallback & a_Callback);
@@ -109,31 +136,6 @@ public:
int GetNumChunks(void);
- /// Converts absolute block coords into relative (chunk + block) coords:
- inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ )
- {
- BlockToChunk(a_X, a_Y, a_Z, a_ChunkX, a_ChunkZ);
-
- a_X = a_X - a_ChunkX * cChunk::c_ChunkWidth;
- a_Z = a_Z - a_ChunkZ * cChunk::c_ChunkWidth;
- }
-
- /// Converts absolute block coords to chunk coords:
- inline static void BlockToChunk( int a_X, int a_Y, int a_Z, int & a_ChunkX, int & a_ChunkZ )
- {
- (void)a_Y;
- a_ChunkX = a_X / cChunk::c_ChunkWidth;
- if ((a_X < 0) && (a_X % cChunk::c_ChunkWidth != 0))
- {
- a_ChunkX--;
- }
- a_ChunkZ = a_Z / cChunk::c_ChunkWidth;
- if ((a_Z < 0) && (a_Z % cChunk::c_ChunkWidth != 0))
- {
- a_ChunkZ--;
- }
- }
-
void ChunkValidated(void); // Called by chunks that have become valid
private: