| 135 | |
| 136 | |
| 137 | cChunkPtr cChunkMap::GetChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) |
| 138 | { |
| 139 | // No need to lock m_CSLayers, since it's already locked by the operation that called us |
| 140 | ASSERT(m_CSLayers.IsLockedByCurrentThread()); |
| 141 | |
| 142 | cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); |
| 143 | if (Layer == NULL) |
| 144 | { |
| 145 | // An error must have occurred, since layers are automatically created if they don't exist |
| 146 | return NULL; |
| 147 | } |
| 148 | |
| 149 | cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); |
| 150 | if (Chunk == NULL) |
| 151 | { |
| 152 | return NULL; |
| 153 | } |
| 154 | if (!(Chunk->IsValid())) |
| 155 | { |
| 156 | m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, true); |
| 157 | } |
| 158 | return Chunk; |
| 159 | } |
| 160 | |
| 161 | |
| 162 |
no test coverage detected