From 2adae6404140e062b641816bb3ababd60481d04e Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 3 Mar 2018 20:58:39 -0500 Subject: [PATCH] fix ambient heat going to high negative values with high life LIGH, fixes #536 --- src/simulation/elements/LIGH.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/simulation/elements/LIGH.cpp b/src/simulation/elements/LIGH.cpp index b25405325..e7b2df96f 100644 --- a/src/simulation/elements/LIGH.cpp +++ b/src/simulation/elements/LIGH.cpp @@ -73,9 +73,12 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS) //Element_FIRE::update(UPDATE_FUNC_SUBCALL_ARGS); if (sim->aheat_enable) { - sim->hv[y/CELL][x/CELL]+=powderful/50; - if (sim->hv[y/CELL][x/CELL]>MAX_TEMP) - sim->hv[y/CELL][x/CELL]=MAX_TEMP; + sim->hv[y/CELL][x/CELL] += powderful/50; + if (sim->hv[y/CELL][x/CELL] > MAX_TEMP) + sim->hv[y/CELL][x/CELL] = MAX_TEMP; + // If the LIGH was so powerful that it overflowed hv, set to max temp + else if (sim->hv[y/CELL][x/CELL] < 0) + sim->hv[y/CELL][x/CELL] = MAX_TEMP; } for (rx=-2; rx<3; rx++)