MCPcopy Create free account
hub / github.com/cuberite/cuberite / ForEachChunkInRect

Method ForEachChunkInRect

src/ChunkMap.cpp:2374–2397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2372
2373
2374bool cChunkMap::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback)
2375{
2376 bool Result = true;
2377 cCSLock Lock(m_CSLayers);
2378 for (int z = a_MinChunkZ; z <= a_MaxChunkZ; z++)
2379 {
2380 for (int x = a_MinChunkX; x <= a_MaxChunkX; x++)
2381 {
2382 cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z);
2383 if ((Chunk == NULL) || (!Chunk->IsValid()))
2384 {
2385 // Not present / not valid
2386 Result = false;
2387 continue;
2388 }
2389 if (!a_Callback.Coords(x, z))
2390 {
2391 continue;
2392 }
2393 Chunk->GetAllData(a_Callback);
2394 }
2395 }
2396 return Result;
2397}
2398
2399
2400

Callers

nothing calls this directly

Calls 3

CoordsMethod · 0.80
GetAllDataMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected