| 1260 | |
| 1261 | |
| 1262 | void cChunkMap::SetBlock(cWorldInterface & a_WorldInterface, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta) |
| 1263 | { |
| 1264 | cChunkInterface ChunkInterface(this); |
| 1265 | if (a_BlockType == E_BLOCK_AIR) |
| 1266 | { |
| 1267 | BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ); |
| 1268 | } |
| 1269 | |
| 1270 | int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; |
| 1271 | cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); |
| 1272 | |
| 1273 | cCSLock Lock(m_CSLayers); |
| 1274 | cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); |
| 1275 | if ((Chunk != NULL) && Chunk->IsValid()) |
| 1276 | { |
| 1277 | Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta ); |
| 1278 | m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk); |
| 1279 | } |
| 1280 | BlockHandler(a_BlockType)->OnPlaced(ChunkInterface, a_WorldInterface, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); |
| 1281 | } |
| 1282 | |
| 1283 | |
| 1284 |
no test coverage detected