summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-02 18:30:17 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-02 18:30:17 +0200
commitbf13084f1fa8560d8eda8551b74755b543c1fdd4 (patch)
treebed9baa364fdea24501049216c8867c897784242 /source/cChunkMap.cpp
parentPatch from STR_Warrior, OreNest counts adjustment (diff)
downloadcuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar.gz
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar.bz2
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar.lz
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar.xz
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.tar.zst
cuberite-bf13084f1fa8560d8eda8551b74755b543c1fdd4.zip
Diffstat (limited to '')
-rw-r--r--source/cChunkMap.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 47474f9a4..0cf6e6c6d 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -1165,6 +1165,35 @@ bool cChunkMap::IsChunkLighted(int a_ChunkX, int a_ChunkZ)
+bool cChunkMap::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback)
+{
+ bool Result = true;
+ cCSLock Lock(m_CSLayers);
+ for (int z = a_MinChunkZ; z <= a_MaxChunkZ; z++)
+ {
+ for (int x = a_MinChunkX; x <= a_MaxChunkX; x++)
+ {
+ cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z);
+ if ((Chunk == NULL) || (!Chunk->IsValid()))
+ {
+ // Not present / not valid
+ Result = false;
+ continue;
+ }
+ if (!a_Callback.Coords(x, z))
+ {
+ continue;
+ }
+ Chunk->GetAllData(a_Callback);
+ }
+ }
+ return Result;
+}
+
+
+
+
+
void cChunkMap::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty)
{
a_NumChunksValid = 0;