diff options
Diffstat (limited to 'src/elements/dtec.c')
| -rw-r--r-- | src/elements/dtec.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/elements/dtec.c b/src/elements/dtec.c deleted file mode 100644 index 28058e7..0000000 --- a/src/elements/dtec.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <element.h> - -int update_DTEC(UPDATE_FUNC_ARGS) { - int r, rx, ry, rt, rd = parts[i].tmp2; - if (rd > 25) parts[i].tmp2 = rd = 25; - if (parts[i].life) - { - parts[i].life = 0; - for (rx=-2; rx<3; rx++) - for (ry=-2; ry<3; ry++) - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) - { - r = pmap[y+ry][x+rx]; - if (!r) - continue; - rt = parts[r>>8].type; - if (parts_avg(i,r>>8,PT_INSL) != PT_INSL) - { - if ((ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && in_radius(rd, rx, ry)) - { - parts[r>>8].life = 4; - parts[r>>8].ctype = rt; - part_change_type(r>>8,x+rx,y+ry,PT_SPRK); - } - } - } - } - for (rx=-rd; rx<rd+1; rx++) - for (ry=-rd; ry<rd+1; ry++) - if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) - { - r = pmap[y+ry][x+rx]; - if (!r) - continue; - if (parts[r>>8].type == parts[i].ctype && (parts[i].ctype != PT_LIFE || parts[i].tmp == parts[r>>8].tmp)) - parts[i].life = 1; - } - return 0; -} - -int in_radius(int rd, int x, int y) -{ - return (pow((double)x,2)*pow((double)rd,2)+pow((double)y,2)*pow((double)rd,2)<=pow((double)rd,2)*pow((double)rd,2)); -}
\ No newline at end of file |
