From 855242b6c08181cb4c98d39e9c2555b9c8720708 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Sat, 14 Oct 2023 11:40:06 -0700 Subject: [PATCH] Fix logic so energy thresholding gracefully falls back to always-on for other classes --- sim/core/energy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/core/energy.go b/sim/core/energy.go index e5bb1cef71..81b3718ec9 100644 --- a/sim/core/energy.go +++ b/sim/core/energy.go @@ -164,7 +164,7 @@ func (eb *energyBar) addEnergyInternal(sim *Simulation, amount float64, metrics eb.unit.Log(sim, "Gained %0.3f energy from %s (%0.3f --> %0.3f).", amount, metrics.ActionID, eb.currentEnergy, newEnergy) } - crossedThreshold := eb.cumulativeEnergyDecisionThresholds != nil && eb.cumulativeEnergyDecisionThresholds[int(eb.currentEnergy)] != eb.cumulativeEnergyDecisionThresholds[int(newEnergy)] + crossedThreshold := eb.cumulativeEnergyDecisionThresholds == nil || eb.cumulativeEnergyDecisionThresholds[int(eb.currentEnergy)] != eb.cumulativeEnergyDecisionThresholds[int(newEnergy)] eb.currentEnergy = newEnergy return crossedThreshold