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

Method LoadChunk

src/WorldStorage/WorldStorage.cpp:312–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310
311
312bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
313{
314 if (m_World->IsChunkValid(a_ChunkX, a_ChunkZ))
315 {
316 // Already loaded (can happen, since the queue is async)
317 return true;
318 }
319
320 cChunkCoords Coords(a_ChunkX, a_ChunkY, a_ChunkZ);
321
322 // First try the schema that is used for saving
323 if (m_SaveSchema->LoadChunk(Coords))
324 {
325 return true;
326 }
327
328 // If it didn't have the chunk, try all the other schemas:
329 for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
330 {
331 if (((*itr) != m_SaveSchema) && (*itr)->LoadChunk(Coords))
332 {
333 return true;
334 }
335 }
336
337 // Notify the chunk owner that the chunk failed to load (sets cChunk::m_HasLoadFailed to true):
338 m_World->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ);
339
340 return false;
341}
342
343
344

Callers

nothing calls this directly

Calls 4

beginMethod · 0.80
endMethod · 0.80
IsChunkValidMethod · 0.45
ChunkLoadFailedMethod · 0.45

Tested by

no test coverage detected