fix crash with high speed photons in loop edge mode

This commit is contained in:
jacob1 2015-05-10 21:48:09 -04:00
parent dd102c1f11
commit b1fc134204

View File

@ -3220,7 +3220,7 @@ void Simulation::delete_part(int x, int y)//calls kill_part with the particle lo
void Simulation::UpdateParticles(int start, int end) void Simulation::UpdateParticles(int start, int end)
{ {
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt; int i, j, x, y, t, nx, ny, r, surround_space, s, rt, nt;
float mv, dx, dy, nrx, nry, dp, ctemph, ctempl, gravtot; float mv, dx, dy, nrx, nry, dp, ctemph, ctempl, gravtot;
int fin_x, fin_y, clear_x, clear_y, stagnant; int fin_x, fin_y, clear_x, clear_y, stagnant;
float fin_xf, fin_yf, clear_xf, clear_yf; float fin_xf, fin_yf, clear_xf, clear_yf;
@ -4012,18 +4012,20 @@ killed:
} }
else if (elements[t].Properties & TYPE_ENERGY) else if (elements[t].Properties & TYPE_ENERGY)
{ {
if (t == PT_PHOT) { if (t == PT_PHOT)
{
if (parts[i].flags&FLAG_SKIPMOVE) if (parts[i].flags&FLAG_SKIPMOVE)
{ {
parts[i].flags &= ~FLAG_SKIPMOVE; parts[i].flags &= ~FLAG_SKIPMOVE;
continue; continue;
} }
rt = pmap[fin_y][fin_x] & 0xFF; if (eval_move(PT_PHOT, fin_x, fin_y, NULL))
lt = pmap[y][x] & 0xFF; {
int rt = pmap[fin_y][fin_x] & 0xFF;
r = eval_move(PT_PHOT, fin_x, fin_y, NULL); int lt = pmap[y][x] & 0xFF;
if (((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS)) && r) { if ((rt==PT_GLAS && lt!=PT_GLAS) || (rt!=PT_GLAS && lt==PT_GLAS))
{
if (!get_normal_interp(REFRACT|t, parts[i].x, parts[i].y, parts[i].vx, parts[i].vy, &nrx, &nry)) { if (!get_normal_interp(REFRACT|t, parts[i].x, parts[i].y, parts[i].vx, parts[i].vy, &nrx, &nry)) {
kill_part(i); kill_part(i);
continue; continue;
@ -4060,6 +4062,7 @@ killed:
} }
} }
} }
}
if (stagnant)//FLAG_STAGNANT set, was reflected on previous frame if (stagnant)//FLAG_STAGNANT set, was reflected on previous frame
{ {
// cast coords as int then back to float for compatibility with existing saves // cast coords as int then back to float for compatibility with existing saves