diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-14 21:56:09 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-14 21:56:09 +0100 |
commit | 0b24efeb005e293a026f2ac8666020cea8316578 (patch) | |
tree | 4523c34112fbec3f056337191c00bddb6f7253d0 /source/cWorld.h | |
parent | Fixed the server not waiting for the world to save completely before stopping (diff) | |
download | cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar.gz cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar.bz2 cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar.lz cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar.xz cuberite-0b24efeb005e293a026f2ac8666020cea8316578.tar.zst cuberite-0b24efeb005e293a026f2ac8666020cea8316578.zip |
Diffstat (limited to 'source/cWorld.h')
-rw-r--r-- | source/cWorld.h | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/source/cWorld.h b/source/cWorld.h index bdf2ae2c5..c2f3d3fcf 100644 --- a/source/cWorld.h +++ b/source/cWorld.h @@ -15,6 +15,7 @@ #include "WorldStorage.h"
#include "cChunkGenerator.h"
#include "Vector3i.h"
+#include "Vector3f.h"
#include "ChunkSender.h"
#include "Defines.h"
@@ -67,18 +68,39 @@ public: void BroadcastToChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, const cPacket & a_Packet, cClientHandle * a_Exclude = NULL);
void BroadcastToChunkOfBlock(int a_X, int a_Y, int a_Z, cPacket * a_Packet, cClientHandle * a_Exclude = NULL);
- 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 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 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);
+ bool GetChunkBlockTypes(int a_ChunkX, int a_ChunkY, int a_ChunkZ, BLOCKTYPE * a_BlockTypes);
- /// Gets the chunk's blockdata, the entire array
- bool GetChunkBlockData (int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_BlockData);
+ /// Gets the chunk's blockdata, 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) const;
bool HasChunkAnyClients(int a_ChunkX, int a_ChunkY, int a_ChunkZ) const;
@@ -193,15 +215,15 @@ public: {
// TODO: Use floor() instead of weird if statements
// Also fix Y
- a_ChunkX = a_X/cChunk::c_ChunkWidth;
- if(a_X < 0 && a_X % cChunk::c_ChunkWidth != 0) a_ChunkX--;
+ a_ChunkX = a_X/cChunkDef::Width;
+ if(a_X < 0 && a_X % cChunkDef::Width != 0) a_ChunkX--;
a_ChunkY = 0;
- a_ChunkZ = a_Z/cChunk::c_ChunkWidth;
- if(a_Z < 0 && a_Z % cChunk::c_ChunkWidth != 0) a_ChunkZ--;
+ a_ChunkZ = a_Z/cChunkDef::Width;
+ if(a_Z < 0 && a_Z % cChunkDef::Width != 0) a_ChunkZ--;
- a_X = a_X - a_ChunkX*cChunk::c_ChunkWidth;
- a_Y = a_Y - a_ChunkY*cChunk::c_ChunkHeight;
- a_Z = a_Z - a_ChunkZ*cChunk::c_ChunkWidth;
+ a_X = a_X - a_ChunkX*cChunkDef::Width;
+ a_Y = a_Y - a_ChunkY*cChunkDef::Height;
+ a_Z = a_Z - a_ChunkZ*cChunkDef::Width;
}
inline static void BlockToChunk( int a_X, int a_Y, int a_Z, int & a_ChunkX, int & a_ChunkY, int & a_ChunkZ )
@@ -209,11 +231,11 @@ public: // TODO: Use floor() instead of weird if statements
// Also fix Y
(void)a_Y; // not unused anymore
- a_ChunkX = a_X/cChunk::c_ChunkWidth;
- if(a_X < 0 && a_X % cChunk::c_ChunkWidth != 0) a_ChunkX--;
+ a_ChunkX = a_X/cChunkDef::Width;
+ if(a_X < 0 && a_X % cChunkDef::Width != 0) a_ChunkX--;
a_ChunkY = 0;
- a_ChunkZ = a_Z/cChunk::c_ChunkWidth;
- if(a_Z < 0 && a_Z % cChunk::c_ChunkWidth != 0) a_ChunkZ--;
+ a_ChunkZ = a_Z/cChunkDef::Width;
+ if(a_Z < 0 && a_Z % cChunkDef::Width != 0) a_ChunkZ--;
}
void SaveAllChunks(); //tolua_export
|