// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1365 globals integer array Cell_nextFree integer Cell_firstFree=0 integer Cell_maxIndex=0 integer array Cell_typeId integer array Cell_elem integer blaFromIndex_return_z=0 integer blaFromIndex_return_y=0 endglobals native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing set Cell_firstFree = 0 set Cell_maxIndex = 0 endfunction function blaFromIndex takes integer i returns integer set blaFromIndex_return_z = i set blaFromIndex_return_y = 2 return blaFromIndex_return_z endfunction function blaToIndex takes integer b_z, integer b_y returns integer return b_z endfunction function Cell_get takes integer this returns integer return Cell_elem[this] endfunction function error takes string msg returns nothing call BJDebugMsg(msg + "\n" + "") endfunction function dispatch_Cell_test_Cell_get takes integer this returns integer local integer test_Cell_get_result if Cell_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Cell.get") else call error("Called Cell.get on invalid object.") endif endif set test_Cell_get_result = Cell_get(this) return test_Cell_get_result endfunction function Cell_set takes integer this, integer t returns nothing set Cell_elem[this] = t endfunction function dispatch_Cell_test_Cell_set takes integer this, integer t returns nothing if Cell_typeId[this] == 0 then if this == 0 then call error("Nullpointer exception when calling Cell.set") else call error("Called Cell.set on invalid object.") endif endif call Cell_set(this, t) endfunction function alloc_Cell takes nothing returns integer local integer this if Cell_firstFree == 0 then if Cell_maxIndex < 32768 then set Cell_maxIndex = Cell_maxIndex + 1 set this = Cell_maxIndex set Cell_typeId[this] = 1 else call error("Out of memory: Could not create Cell.") set this = 0 endif else set Cell_firstFree = Cell_firstFree - 1 set this = Cell_nextFree[Cell_firstFree] set Cell_typeId[this] = 1 endif return this endfunction function Cell_init takes integer this returns nothing endfunction function construct_Cell takes integer this returns nothing call Cell_init(this) endfunction function new_Cell takes nothing returns integer local integer this = alloc_Cell() call construct_Cell(this) return this endfunction function init_test takes nothing returns nothing local integer c = new_Cell() call dispatch_Cell_test_Cell_set(c, blaToIndex(5, 3)) if blaFromIndex(dispatch_Cell_test_Cell_get(c)) == 5 and blaFromIndex_return_y == 2 then call testSuccess() endif endfunction function main takes nothing returns nothing call initGlobals() call init_test() endfunction function config takes nothing returns nothing endfunction