From 03770dff7869eaad9a99e23395e02eef284ca5fc Mon Sep 17 00:00:00 2001 From: jacob1 Date: Tue, 4 Feb 2025 10:10:23 -0500 Subject: [PATCH] cap VIBR .tmp and explosion .temp --- src/simulation/elements/VIBR.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/simulation/elements/VIBR.cpp b/src/simulation/elements/VIBR.cpp index cbbf683e7..2c059928d 100644 --- a/src/simulation/elements/VIBR.cpp +++ b/src/simulation/elements/VIBR.cpp @@ -107,7 +107,7 @@ int Element_VIBR_update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (TYP(r) && TYP(r)!=PT_VIBR && TYP(r)!=PT_BVBR && elements[TYP(r)].HeatConduct && (TYP(r)!=PT_HSWC||parts[ID(r)].life==10)) { - parts[ID(r)].temp += parts[i].tmp*3; + parts[ID(r)].temp = std::clamp(parts[ID(r)].temp + parts[i].tmp * 3, MIN_TEMP, MAX_TEMP); parts[i].tmp = 0; } } @@ -210,8 +210,7 @@ int Element_VIBR_update(UPDATE_FUNC_ARGS) } } } - if (parts[i].tmp < 0) - parts[i].tmp = 0; // only preventing because negative tmp doesn't save + parts[i].tmp = std::clamp(parts[i].tmp, 0, 1 << 15); return 0; }