| 1016 | |
| 1017 | |
| 1018 | int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ) |
| 1019 | { |
| 1020 | for (;;) |
| 1021 | { |
| 1022 | cCSLock Lock(m_CSLayers); |
| 1023 | int ChunkX, ChunkZ, BlockY = 0; |
| 1024 | cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ); |
| 1025 | cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); |
| 1026 | if (Chunk == NULL) |
| 1027 | { |
| 1028 | return 0; |
| 1029 | } |
| 1030 | |
| 1031 | if (Chunk->IsValid()) |
| 1032 | { |
| 1033 | return Chunk->GetHeight(a_BlockX, a_BlockZ); |
| 1034 | } |
| 1035 | |
| 1036 | // The chunk is not valid, wait for it to become valid: |
| 1037 | cCSUnlock Unlock(Lock); |
| 1038 | m_evtChunkValid.Wait(); |
| 1039 | } // while (true) |
| 1040 | } |
| 1041 | |
| 1042 | |
| 1043 |
no test coverage detected