diff options
| author | jacksonmj <jacksonmj@jacksonmj.none> | 2011-02-01 16:03:09 (GMT) |
|---|---|---|
| committer | jacksonmj <jacksonmj@jacksonmj.none> | 2011-02-01 16:06:48 (GMT) |
| commit | 77bcac1a5628aecdf8e4c1968106e3bed86890ab (patch) | |
| tree | 6e55d756941374d89a1c87cf8193dfdf7a312629 /src/powder.c | |
| parent | c78d4203eecb9cd90cf6dafc5aa61e6aa0adf09d (diff) | |
| download | powder-77bcac1a5628aecdf8e4c1968106e3bed86890ab.zip powder-77bcac1a5628aecdf8e4c1968106e3bed86890ab.tar.gz | |
Small fixes
Fix nearest_part distance calculation
Rename air constants to avoid PLOSS clash with math.h
Prevent crashes due to bad lava ctype.
Diffstat (limited to 'src/powder.c')
| -rw-r--r-- | src/powder.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/powder.c b/src/powder.c index 493dec7..f8a5d3d 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1113,7 +1113,7 @@ int nearest_part(int ci, int t) { if (parts[i].type==t&&!parts[i].life&&i!=ci) { - ndistance = abs((cx-parts[i].x)+(cy-parts[i].y));// Faster but less accurate Older: sqrt(pow(cx-parts[i].x, 2)+pow(cy-parts[i].y, 2)); + ndistance = abs(cx-parts[i].x)+abs(cy-parts[i].y);// Faster but less accurate Older: sqrt(pow(cx-parts[i].x, 2)+pow(cy-parts[i].y, 2)); if (ndistance<distance) { distance = ndistance; @@ -1290,9 +1290,9 @@ void update_particles_i(pixel *vid, int start, int inc) } if (ISGOL==1&&++CGOL>=GSPEED)//GSPEED is frames per generation { + int createdsomething = 0; CGOL=0; ISGOL=0; - int createdsomething = 0; for (nx=CELL; nx<XRES-CELL; nx++) for (ny=CELL; ny<YRES-CELL; ny++) { @@ -1553,7 +1553,7 @@ void update_particles_i(pixel *vid, int start, int inc) else t = PT_DSTW; } else if (t==PT_LAVA) { - if (parts[i].ctype&&parts[i].ctype!=PT_LAVA) { + if (parts[i].ctype && parts[i].ctype<PT_NUM && parts[i].ctype!=PT_LAVA) { if (ptransitions[parts[i].ctype].tht==PT_LAVA&&pt>=ptransitions[parts[i].ctype].thv) s = 0; else if (parts[i].ctype==PT_THRM&&pt>=ptransitions[PT_BMTL].thv) s = 0; else if (pt>=973.0f) s = 0; // freezing point for lava with any other (not listed in ptransitions as turning into lava) ctype |
