From 48459fc40d628d5701270f630afb1f8228cdfcae Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 12 Jun 2012 18:45:03 +0100 Subject: [PATCH] TPT: Change order of bomb loops - delete particles before creating sparks 089ea8b7a0 --- src/simulation/elements/BOMB.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/simulation/elements/BOMB.cpp b/src/simulation/elements/BOMB.cpp index b21be199a..ccf56bd09 100644 --- a/src/simulation/elements/BOMB.cpp +++ b/src/simulation/elements/BOMB.cpp @@ -77,18 +77,6 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS) int nxi; int nxj; pmap[y][x] = 0; - for (nxj=-(rad+1); nxj<=(rad+1); nxj++) - for (nxi=-(rad+1); nxi<=(rad+1); nxi++) - if ((pow((float)nxi,2))/(pow((float)(rad+1),2))+(pow((float)nxj,2))/(pow((float)(rad+1),2))<=1) { - nb = sim->create_part(-1, x+nxi, y+nxj, PT_BOMB); - if (nb!=-1) { - parts[nb].tmp = 1; - parts[nb].life = 50; - parts[nb].temp = MAX_TEMP; - parts[nb].vx = rand()%20-10; - parts[nb].vy = rand()%20-10; - } - } for (nxj=-rad; nxj<=rad; nxj++) for (nxi=-rad; nxi<=rad; nxi++) if ((pow((float)nxi,2))/(pow((float)rad,2))+(pow((float)nxj,2))/(pow((float)rad,2))<=1) @@ -102,6 +90,18 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS) parts[nb].temp = MAX_TEMP; } } + for (nxj=-(rad+1); nxj<=(rad+1); nxj++) + for (nxi=-(rad+1); nxi<=(rad+1); nxi++) + if ((pow((float)nxi,2))/(pow((float)(rad+1),2))+(pow((float)nxj,2))/(pow((float)(rad+1),2))<=1) { + nb = sim->create_part(-1, x+nxi, y+nxj, PT_BOMB); + if (nb!=-1) { + parts[nb].tmp = 1; + parts[nb].life = 50; + parts[nb].temp = MAX_TEMP; + parts[nb].vx = rand()%20-10; + parts[nb].vy = rand()%20-10; + } + } //CreateParts(x, y, 9, 9, PT_BOMB); //CreateParts(x, y, 8, 8, PT_NONE); sim->kill_part(i); @@ -137,4 +137,4 @@ int Element_BOMB::graphics(GRAPHICS_FUNC_ARGS) } -Element_BOMB::~Element_BOMB() {} \ No newline at end of file +Element_BOMB::~Element_BOMB() {}