summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-16 22:00:28 +0100
committermadmaxoft <github@xoft.cz>2014-03-16 22:00:28 +0100
commit89027cb67510f49114b9cd99c585009465a3ef66 (patch)
tree84c0b58b200e76785005b9e892ee4b2b9f63097a /src/ChunkMap.cpp
parentAdded override specifier where appropriate in cWorld. (diff)
downloadcuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar.gz
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar.bz2
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar.lz
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar.xz
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.tar.zst
cuberite-89027cb67510f49114b9cd99c585009465a3ef66.zip
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r--src/ChunkMap.cpp91
1 files changed, 46 insertions, 45 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 62c1ec544..60fbf39d4 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1791,57 +1791,58 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
BLOCKTYPE Block = area.GetBlockType(bx + x, by + y, bz + z);
switch (Block)
{
- case E_BLOCK_TNT:
- {
- // Activate the TNT, with a random fuse between 10 to 30 game ticks
- double FuseTime = (double)(10 + m_World->GetTickRandomNumber(20)) / 20;
- m_World->SpawnPrimedTNT(a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5, FuseTime);
- area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
- a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));
- break;
- }
- case E_BLOCK_OBSIDIAN:
- case E_BLOCK_BEDROCK:
- case E_BLOCK_WATER:
- case E_BLOCK_LAVA:
- {
- // These blocks are not affected by explosions
- break;
- }
-
- case E_BLOCK_STATIONARY_WATER:
- {
- // Turn into simulated water:
- area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_WATER);
- break;
- }
+ case E_BLOCK_TNT:
+ {
+ // Activate the TNT, with a random fuse between 10 to 30 game ticks
+ int FuseTime = 10 + m_World->GetTickRandomNumber(20);
+ m_World->SpawnPrimedTNT(a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5, FuseTime);
+ area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
+ a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));
+ break;
+ }
+
+ case E_BLOCK_OBSIDIAN:
+ case E_BLOCK_BEDROCK:
+ case E_BLOCK_WATER:
+ case E_BLOCK_LAVA:
+ {
+ // These blocks are not affected by explosions
+ break;
+ }
- case E_BLOCK_STATIONARY_LAVA:
- {
- // Turn into simulated lava:
- area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_LAVA);
- break;
- }
+ case E_BLOCK_STATIONARY_WATER:
+ {
+ // Turn into simulated water:
+ area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_WATER);
+ break;
+ }
- case E_BLOCK_AIR:
- {
- // No pickups for air
- break;
- }
+ case E_BLOCK_STATIONARY_LAVA:
+ {
+ // Turn into simulated lava:
+ area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_LAVA);
+ break;
+ }
- default:
- {
- if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
+ case E_BLOCK_AIR:
{
- cItems Drops;
- cBlockHandler * Handler = BlockHandler(Block);
+ // No pickups for air
+ break;
+ }
- Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
- m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
+ default:
+ {
+ if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
+ {
+ cItems Drops;
+ cBlockHandler * Handler = BlockHandler(Block);
+
+ Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
+ m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
+ }
+ area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
+ a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));
}
- area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
- a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));
- }
} // switch (BlockType)
} // for z
} // for y