From 9b9a37e5070a4553b0945ea4b770cf75c375bec5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 19 Apr 2013 08:21:39 +0000 Subject: Fixed Linux compilation, slight code cleanup git-svn-id: http://mc-server.googlecode.com/svn/trunk@1396 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/World.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'source/World.cpp') diff --git a/source/World.cpp b/source/World.cpp index 6b1e5f8c8..312249709 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -705,31 +705,31 @@ bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback void cWorld::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY, int a_BlockZ) { - //TODO implement explosion using cBlockArea, add damage to pawns, add support for pickups, and implement block hardiness + // TODO: implement explosion using cBlockArea / in cChunkMap, add damage to entities, add support for pickups, and implement block hardiness Vector3d explosion_pos = Vector3d(a_BlockX,a_BlockY,a_BlockZ); - cVector3iList BlocksAffected; - for (int i=0;iGetPosition() - explosion_pos; if (distance_explosion.SqrLength() < 4096.0) { - double real_distance = sqrt( distance_explosion.SqrLength()); - if (real_distance <= 0.0004) - real_distance = 0.0004; + double real_distance = std::max(0.004, sqrt(distance_explosion.SqrLength())); double power = a_ExplosionSize / real_distance; if (power <= 1) + { power = 0; + } distance_explosion.Normalize(); distance_explosion *= power; - ch->SendExplosion(a_BlockX,a_BlockY,a_BlockZ,a_ExplosionSize,BlocksAffected,(float)distance_explosion.x,(float)distance_explosion.y,(float)distance_explosion.z); + ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, a_ExplosionSize, BlocksAffected, distance_explosion); } } } -- cgit v1.2.3