Page 1 of 1

NaN bug

Posted: 11 Nov 2009, 20:33
by Tobi
Someone in #main made me aware of a bug in either Spring or BA. It appeared to be BA.

The problem is that if you reclaim a feature with 0 metal and 0 energy, the feature will change to give NaN m/e (rez bot) or -2147483648 m/e (commander). During reclaiming the resource bar may also display an energy pull of -nan.

How to reproduce: Load therockjungle and reclaim some shrubs.

I suspect the bug is in here (LuaRules/Gadgets/unit_reclaim_fix.lua):

Code: Select all

local resource = math.max(FeatureDefs[featureDefID].metal,FeatureDefs[featureDefID].energy)
local newpercent = select(5,GetFeatureResources(featureID)) - ((((resource * oldformula) * 6) - (resource * newformula)) / resource)
Since there are no checks there for resource == 0 (or reclaimtime == 0).

Re: NaN bug

Posted: 12 Nov 2009, 07:30
by Wombat
true ! i had same and also on this map, i noticed it appears while making circle on own base :x uber annoying anyway

Re: NaN bug

Posted: 12 Nov 2009, 07:52
by CarRepairer
I'm pretty sure that's a feature. Those are NaN jungle shrubs of the tropical region of Northern England.

Re: NaN bug

Posted: 12 Nov 2009, 12:44
by TheFatController
I wouldn't have expected AllowFeatureBuildStep to be called by the engine in this scenario since there is no build step to allow, however I'll fix this next rev.

Re: NaN bug

Posted: 03 Aug 2010, 20:06
by hoijui
still present in 7.14 (testing with spring RC), used the same map.

Re: NaN bug

Posted: 03 Aug 2010, 20:59
by Jazcash
Yeah, this is why I always hated playing The Rock Jungle...

Re: NaN bug

Posted: 04 Aug 2010, 06:44
by Wombat
remove fucked trees which give -1 e/m ?

ARRRTTTTTTTURIIIIIIII

Re: NaN bug

Posted: 08 Aug 2010, 11:50
by hoijui
fixed version of LuaRules/Gadgets/unit_reclaim_fix.lua

the commander icons also still need fixing.
looks like most icons are now under LuaUI/Icons as PNG, and the commander ones are still under icons as TGA, and LuaUI/Widgets/unit_customicons.lua will need adjusting too.

Re: NaN bug

Posted: 27 Aug 2010, 11:57
by knorke
is this related?
look at ressource bar. i was speccing a game when that happend, it only happend for a few seconds but numerous times. once with ebar too.