// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array Base_nextFree integer Base_firstFree=0 integer Base_maxIndex=0 integer array Base_typeId integer array Base_next endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing set Base_firstFree = 0 set Base_maxIndex = 0 endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function cyc_SubClassB_clear takes integer funcChoice, integer this returns nothing if funcChoice == 0 then call cyc_SubClassB_clear(2, this) call testSuccess() elseif funcChoice == 1 then if Base_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Base.clear") else call error("Called Base.clear on invalid object.") endif endif if Base_typeId[this] <= 2 then if Base_typeId[this] <= 1 then call cyc_SubClassB_clear(2, this) else call cyc_SubClassB_clear(3, this) endif else call cyc_SubClassB_clear(0, this) endif elseif funcChoice == 2 then if Base_next[this] != 0 then call cyc_SubClassB_clear(1, Base_next[this]) endif elseif funcChoice == 3 then call cyc_SubClassB_clear(2, this) endif endfunction function dispatch_SubClassA_test_SubClassA_clear takes integer this returns nothing if Base_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling SubClassA.clear") else call error("Called SubClassA.clear on invalid object.") endif endif call cyc_SubClassB_clear(3, this) endfunction function alloc_SubClassA takes nothing returns integer local integer this if Base_firstFree == 0 then if Base_maxIndex < 32768 then set Base_maxIndex = Base_maxIndex + 1 set this = Base_maxIndex set Base_typeId[this] = 2 else call error("Out of memory: Could not create SubClassA.") set this = 0 endif else set Base_firstFree = Base_firstFree - 1 set this = Base_nextFree[Base_firstFree] set Base_typeId[this] = 2 endif return this endfunction function SubClassA_init takes integer this returns nothing endfunction function Base_init takes integer this returns nothing endfunction function construct_Base takes integer this returns nothing call Base_init(this) endfunction function construct_SubClassA takes integer this returns nothing call construct_Base(this) call SubClassA_init(this) endfunction function new_SubClassA takes nothing returns integer local integer this = alloc_SubClassA() call construct_SubClassA(this) return this endfunction function alloc_SubClassB takes nothing returns integer local integer this if Base_firstFree == 0 then if Base_maxIndex < 32768 then set Base_maxIndex = Base_maxIndex + 1 set this = Base_maxIndex set Base_typeId[this] = 3 else call error("Out of memory: Could not create SubClassB.") set this = 0 endif else set Base_firstFree = Base_firstFree - 1 set this = Base_nextFree[Base_firstFree] set Base_typeId[this] = 3 endif return this endfunction function SubClassB_init takes integer this returns nothing endfunction function construct_SubClassB takes integer this returns nothing call construct_Base(this) call SubClassB_init(this) endfunction function new_SubClassB takes nothing returns integer local integer this = alloc_SubClassB() call construct_SubClassB(this) return this endfunction function init_test takes nothing returns nothing local integer suba = new_SubClassA() local integer subb = new_SubClassB() set Base_next[suba] = subb call dispatch_SubClassA_test_SubClassA_clear(suba) endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction