From 96221ff23e3398fd783557301a5b3b0ede127b42 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 5 Sep 2013 17:58:46 +0100 Subject: [PATCH] Make effect of PROT on wifi and portals independent of channel temperature ranges Cold PROT decreases channel by 1, v cold by 10. Hot PROT increases channel by 1, v hot by 10. Since the effect is specified in terms of effect on channel number not on temperature, this will cause less problems if the temperature gap is ever decreased to add more channels. --- src/simulation/elements/PROT.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index 133be657a..43022440c 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -76,7 +76,20 @@ int Element_PROT::update(UPDATE_FUNC_ARGS) //make temp of other things closer to it's own temperature. This will change temp of things that don't conduct, and won't change the PROT's temperature if (under) { - parts[under>>8].temp -= restrict_flt((parts[under>>8].temp-parts[i].temp)/4.0f, MIN_TEMP, MAX_TEMP); + if ((under&0xFF) == PT_WIFI || (under&0xFF) == PT_PRTI || (under&0xFF) == PT_PRTO) + { + float change; + if (parts[i].temp<173.15f) change = -1000.0f; + else if (parts[i].temp<273.15f) change = -100.0f; + else if (parts[i].temp>473.15f) change = 1000.0f; + else if (parts[i].temp>373.15f) change = 100.0f; + else change = 0.0f; + parts[under>>8].temp = restrict_flt(parts[under>>8].temp+change, MIN_TEMP, MAX_TEMP); + } + else + { + parts[under>>8].temp = restrict_flt(parts[under>>8].temp-(parts[under>>8].temp-parts[i].temp)/4.0f, MIN_TEMP, MAX_TEMP); + } } //else, slowly kill it if it's not inside an element else