
; Add new building options to menu


	~0.5
	_item = _this
	? _item == "Windtrap" && !("Barracks" in BUILDINGS) : _toAdd="Barracks"; goto "AddBuilding"
	? _item == "Barracks" && !("Light Infantry" in UNITS) : _toAddArray=["Light Infantry","Heavy Infantry"]; goto "AddUnits"
	exit
	
	
	#AddBuilding
	playSound "newconstruction"
	
		_i=0
		#FindFreeSlot
		? (BUILDINGS select _i) != "none" : _i=_i+1; goto "FindFreeSlot"
		BUILDINGS set [_i, _toAdd]
		
		
		_idc = 104 + 14 * _i
		_filename = _toAdd
		? _toAdd == "Light Infantry" : _filename="light_infantry"
		? _toAdd == "Heavy Infantry" : _filename="heavy_infantry"
		ctrlSetText [_idc, "img/"+_filename+".paa"]
		
		
		buttonSetAction [_idc+2, format ["[%1,{Building}] exec {Build.sqs}", _i+1]]
		ctrlShow [_idc+2, true]
	
	exit
	
	
	
	
	
	#AddUnits
	playSound "newconstruction"
	_j=0 
	#LoopAddUnits
	
		_toAdd = _toAddArray select _j
	
		_i=0
		#FindFreeSlot1
		? (UNITS select _i) != "none" : _i=_i+1; goto "FindFreeSlot1"
		UNITS set [_i, _toAdd]
		
		
		_idc = 111 + 14 * _i
		_filename = _toAdd
		? _toAdd == "Light Infantry" : _filename="light_infantry"
		? _toAdd == "Heavy Infantry" : _filename="heavy_infantry"
		ctrlSetText [_idc, "img/"+_filename+".paa"]
		
		
		buttonSetAction [_idc+2, format ["[%1,{Units}] exec {Build.sqs}", _i+1]]
		ctrlShow [_idc+2, true]

	~0.3
	? _j < count _toAddArray - 1 : _j=_j+1; goto "LoopAddUnits"
	exit		
	