Log in

View Full Version : manager_effect.lua, processEffect() bug?



celestian
May 19th, 2020, 19:11
Around line 189 I've noticed this.



local nEffInit = DB.getValue(nodeEffect, aEffectVarMap["nInit"].sDBField, aEffectVarMap["nInit"].vDBDefault or 0);


The piece of code that caught my eye was aEffectVarMap["nInit"].vDBDefault, there is no "vDBDefault" defined for nInit, it is for "nDuration".

I ran into an edge case that complained about an error on this line and noticed this (unrelated to my issue I think).

Trenloe
May 19th, 2020, 19:47
Around line 189 I've noticed this.



local nEffInit = DB.getValue(nodeEffect, aEffectVarMap["nInit"].sDBField, aEffectVarMap["nInit"].vDBDefault or 0);


The piece of code that caught my eye was aEffectVarMap["nInit"].vDBDefault, there is no "vDBDefault" defined for nInit, it is for "nDuration".
I noticed that recently. But I imagine that is why there's the "or 0" at the end - if there isn't a default in aEffectVarMap then it will use 0. I think that line is generic code for a DB.getValue for a field defined in the aEffectVarMap table. In this case there isn't a vDBDefault value for "nInit" as standard - which is covered by the "or 0" in this case. But, some other code (an extension or layered ruleset) may set a default and if it does, then the vDBDefault will be used.

celestian
May 19th, 2020, 19:54
I noticed that recently. But I imagine that is why there's the "or 0" at the end - if there isn't a default in aEffectVarMap then it will use 0. I think that line is generic code for a DB.getValue for a field defined in the aEffectVarMap table. In this case there isn't a vDBDefault value for "nInit" as standard - which is covered by the "or 0" in this case. But, some other code (an extension or layered ruleset) may set a default and if it does, then the vDBDefault will be used.

That was my thought and I checked 5E looking to see if they had but nothing was there that I found. Could be for another ruleset I suppose but I suspect it's more of a typo than intended.