// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1367 globals integer array MyClass_nextFree integer MyClass_firstFree=0 integer MyClass_maxIndex=0 integer array MyClass_typeId integer array Iterator_nextFree integer Iterator_firstFree=0 integer Iterator_maxIndex=0 endglobals native testSuccess takes nothing returns nothing function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function new_Iterator takes nothing returns integer local integer this local integer this_1 if Iterator_firstFree == 0 then if Iterator_maxIndex < 32768 then set Iterator_maxIndex = Iterator_maxIndex + 1 set this_1 = Iterator_maxIndex else call error("Out of memory: Could not create Iterator.") set this_1 = 0 endif else set Iterator_firstFree = Iterator_firstFree - 1 set this_1 = Iterator_nextFree[Iterator_firstFree] endif set this = this_1 return this endfunction function MyClass_all takes nothing returns nothing local integer elem local integer this call new_Iterator() loop exitwhen not false set elem = 0 set this = elem if MyClass_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling MyClass.do") else call error("Called MyClass.do on invalid object.") endif endif endloop endfunction function initGlobals takes nothing returns nothing endfunction function new_MyClass takes nothing returns integer local integer this local integer this_1 local integer this_2 if MyClass_firstFree == 0 then if MyClass_maxIndex < 32768 then set MyClass_maxIndex = MyClass_maxIndex + 1 set this_1 = MyClass_maxIndex set MyClass_typeId[this_1] = 2 else call error("Out of memory: Could not create MyClass.") set this_1 = 0 endif else set MyClass_firstFree = MyClass_firstFree - 1 set this_1 = MyClass_nextFree[MyClass_firstFree] set MyClass_typeId[this_1] = 2 endif set this = this_1 set this_2 = this return this endfunction function main takes nothing returns nothing call initGlobals() call new_MyClass() call new_MyClass() call MyClass_all() call testSuccess() endfunction function config takes nothing returns nothing endfunction