heat range: the stage ranges are inclusive. showing incorrect out of range when is in range.

additional note on previous commit f58e5ad (don't want to force push an ammend)
the race condition caused an invalid state which showing incorrect prediction when race condition occurs - when the menu click and the heat/cool ticks occurs simultaniously.
This commit is contained in:
Louis Hong
2024-11-09 11:27:27 -08:00
parent f58e5ad868
commit 723ca31093

View File

@@ -153,19 +153,19 @@ public class EasyGiantsFoundryState
int heat = getHeatAmount(); int heat = getHeatAmount();
int[] low = getLowHeatRange(); int[] low = getLowHeatRange();
if (heat > low[0] && heat < low[1]) if (heat >= low[0] && heat <= low[1])
{ {
return Heat.LOW; return Heat.LOW;
} }
int[] med = getMedHeatRange(); int[] med = getMedHeatRange();
if (heat > med[0] && heat < med[1]) if (heat >= med[0] && heat <= med[1])
{ {
return Heat.MED; return Heat.MED;
} }
int[] high = getHighHeatRange(); int[] high = getHighHeatRange();
if (heat > high[0] && heat < high[1]) if (heat >= high[0] && heat <= high[1])
{ {
return Heat.HIGH; return Heat.HIGH;
} }
@@ -326,7 +326,7 @@ public class EasyGiantsFoundryState
int[] range = getCurrentHeatRange(); int[] range = getCurrentHeatRange();
int actions = 0; int actions = 0;
int heat = getHeatAmount(); int heat = getHeatAmount();
while (heat > range[0] && heat < range[1]) while (heat >= range[0] && heat <= range[1])
{ {
actions++; actions++;
heat += stage.getHeatChange(); heat += stage.getHeatChange();