| 1142 | |
| 1143 | |
| 1144 | BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ) |
| 1145 | { |
| 1146 | // First check if it isn't queued in the m_FastSetBlockQueue: |
| 1147 | { |
| 1148 | int X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; |
| 1149 | int ChunkX, ChunkY, ChunkZ; |
| 1150 | cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ); |
| 1151 | ChunkY = 0; |
| 1152 | cCSLock Lock(m_CSFastSetBlock); |
| 1153 | for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr) |
| 1154 | { |
| 1155 | if ((itr->x == X) && (itr->y == Y) && (itr->z == Z) && (itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) |
| 1156 | { |
| 1157 | return itr->BlockType; |
| 1158 | } |
| 1159 | } // for itr - m_FastSetBlockQueue[] |
| 1160 | } |
| 1161 | int ChunkX, ChunkZ; |
| 1162 | cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); |
| 1163 | |
| 1164 | cCSLock Lock(m_CSLayers); |
| 1165 | cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); |
| 1166 | if ((Chunk != NULL) && Chunk->IsValid()) |
| 1167 | { |
| 1168 | return Chunk->GetBlock(a_BlockX, a_BlockY, a_BlockZ); |
| 1169 | } |
| 1170 | return 0; |
| 1171 | } |
| 1172 | |
| 1173 | |
| 1174 |
no test coverage detected