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

Method DelChunkStay

src/ChunkMap.cpp:2994–3028  ·  view source on GitHub ↗

Removes the specified cChunkStay descendant from the internal list of ChunkStays. */

Source from the content-addressed store, hash-verified

2992
2993/** Removes the specified cChunkStay descendant from the internal list of ChunkStays. */
2994void cChunkMap::DelChunkStay(cChunkStay & a_ChunkStay)
2995{
2996 cCSLock Lock(m_CSLayers);
2997
2998 // Remove from the list of active chunkstays:
2999 bool HasFound = false;
3000 for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr)
3001 {
3002 if (*itr == &a_ChunkStay)
3003 {
3004 m_ChunkStays.erase(itr);
3005 HasFound = true;
3006 break;
3007 }
3008 } // for itr - m_ChunkStays[]
3009
3010 if (!HasFound)
3011 {
3012 ASSERT(!"Removing a cChunkStay that hasn't been added!");
3013 return;
3014 }
3015
3016 // Unmark all contained chunks:
3017 const cChunkCoordsVector & Chunks = a_ChunkStay.GetChunks();
3018 for (cChunkCoordsVector::const_iterator itr = Chunks.begin(), end = Chunks.end(); itr != end; ++itr)
3019 {
3020 cChunkPtr Chunk = GetChunkNoLoad(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ);
3021 if (Chunk == NULL)
3022 {
3023 continue;
3024 }
3025 Chunk->Stay(false);
3026 } // for itr - Chunks[]
3027 a_ChunkStay.OnDisabled();
3028}
3029
3030
3031

Callers 1

DisableMethod · 0.80

Calls 4

beginMethod · 0.80
endMethod · 0.80
StayMethod · 0.80
OnDisabledMethod · 0.45

Tested by

no test coverage detected