Slight performance improvements in cWorld::DoExplosiontAt()

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1397 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
madmaxoft@gmail.com 2013-04-19 08:32:55 +00:00
parent 9b9a37e507
commit fd534d18f1
1 changed files with 5 additions and 3 deletions

View File

@ -708,11 +708,13 @@ void cWorld::DoExplosiontAt(float a_ExplosionSize, int a_BlockX, int a_BlockY, i
// 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);
cVector3iArray BlocksAffected;
for (int x = 0; x < a_ExplosionSize; x++)
int ExplosionSizeInt = (int)a_ExplosionSize;
BlocksAffected.reserve(8 * ExplosionSizeInt * ExplosionSizeInt * ExplosionSizeInt);
for (int x = 0; x < ExplosionSizeInt; x++)
{
for (int y = 0; y < a_ExplosionSize; y++)
for (int y = 0; y < ExplosionSizeInt; y++)
{
for (int z = 0; z < a_ExplosionSize; z++)
for (int z = 0; z < ExplosionSizeInt; z++)
{
DigBlock(a_BlockX + x, a_BlockY + y, a_BlockZ + z);
DigBlock(a_BlockX + x, a_BlockY - y, a_BlockZ + z);