ID:2404218
 
Resolved
Static vars in procs were being inherited by subtypes, which wasn't the case before.
BYOND Version:512.1452
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 69.0.3497.100
Applies to:Dream Maker
Status: Resolved (512.1453)

This issue has been resolved.
Descriptive Problem Summary:
Static vars in procs are now shared with children, where before they were not.
This has always been the case with static vars in datums, but not static vars local to procs.

Code Snippet (if applicable) to Reproduce Problem:
/datum/proc/test()
var/static/v
if(!v)
v = "parent"
world.log << v

/datum/sub/test()
var/static/v
if(!v)
v = "child"
world.log << v

/world/New()
var/datum/D = new()
var/datum/sub/S = new()
D.test()
S.test()


Expected Results:
parent
child


Actual Results:
parent
parent


Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
This did not occur in 512.1448, but I haven't tested 1449-1451.

Workarounds:
Use different names for static vars in child procs.
Huh. This appears to be a side effect of the new compilation stuff, but I'm baffled as to why. I'll take a harder look at the changes and figure it out.

If I'm right though, it means you definitely won't find this issue in any build prior to 1452.
Aha, I see the problem. Will fix in 1453.
Lummox JR resolved issue with message:
Static vars in procs were being inherited by subtypes, which wasn't the case before.