Don't let GLOW ctype go negative

This commit is contained in:
jacob1 2021-07-13 21:50:36 -04:00
parent c93b72c800
commit f2d92bc3d7
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995

View File

@ -66,7 +66,10 @@ static int update(UPDATE_FUNC_ARGS)
return 1;
}
}
parts[i].ctype = int(sim->pv[y/CELL][x/CELL]*16);
int ctype = int(sim->pv[y/CELL][x/CELL]*16);
if (ctype < 0)
ctype = 0;
parts[i].ctype = ctype;
parts[i].tmp = abs((int)((sim->vx[y/CELL][x/CELL]+sim->vy[y/CELL][x/CELL])*16.0f)) + abs((int)((parts[i].vx+parts[i].vy)*64.0f));
return 0;