From f2d92bc3d725e71d512c93d31de2eda97bf3da4b Mon Sep 17 00:00:00 2001 From: jacob1 Date: Tue, 13 Jul 2021 21:50:36 -0400 Subject: [PATCH] Don't let GLOW ctype go negative --- src/simulation/elements/GLOW.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/simulation/elements/GLOW.cpp b/src/simulation/elements/GLOW.cpp index 281542993..686bbbdbe 100644 --- a/src/simulation/elements/GLOW.cpp +++ b/src/simulation/elements/GLOW.cpp @@ -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;