// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1367
globals
integer array Blub_nextFree
integer Blub_firstFree=0
integer Blub_maxIndex=0
integer array Blub_typeId
endglobals
function error takes string msg returns nothing
	call BJDebugMsg(msg + "\n" + "")
endfunction

function initGlobals takes nothing returns nothing
endfunction

function new_Blub takes nothing returns integer
	local integer this
	if Blub_firstFree == 0 then
		if Blub_maxIndex < 32768 then
			set Blub_maxIndex = Blub_maxIndex + 1
			set this = Blub_maxIndex
			set Blub_typeId[this] = 1
		else
			call error("Out of memory: Could not create Blub.")
			set this = 0
		endif
	else
		set Blub_firstFree = Blub_firstFree - 1
		set this = Blub_nextFree[Blub_firstFree]
		set Blub_typeId[this] = 1
	endif
	return this
endfunction

function main takes nothing returns nothing
	local integer blub
	call initGlobals()
	set blub = new_Blub()
	if Blub_typeId[blub] == 0 then
		if blub == 0 then
			call error("Nullpointer exception when calling Blub.foo")
		else
			call error("Called Blub.foo on invalid object.")
		endif
	endif
endfunction

function config takes nothing returns nothing
endfunction