//	@file Version: 1.0
//	@file Name: ADP_F_fillItems.sqf
//	@file Author: THumbert
//	@file Created: 12/14/2013
//	@file Description: Fills listbox with Air Vehicles

#define ARRAYCHECK(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };} forEach _types;_res}

disableSerialization;
_disp = _this select 0;
_control = _this select 1;
_display = findDisplay _disp;
_ctrl = _display displayctrl _control;

_Listbox = _control;

_kindOf = ["plane","Helicopter"];
_filter = [];
lbClear _Listbox;
_Value = 4; //Used for Spawn
hint "Adding Air";
_cfgvehicles = configFile >> "cfgVehicles";
for "_i" from 0 to (count _cfgvehicles)-1 do {
	_vehicle = _cfgvehicles select _i;
	if (isClass _vehicle) then {
		_veh_type = configName(_vehicle);
		if ((getNumber(_vehicle >> "scope")==2)and(getText(_vehicle >> "picture")!="")and(ARRAYCHECK(_veh_type,_kindOf))) then {
			_Text = (getText(_vehicle >> "displayName"));
			_index = lbAdd [_ListBox, _Text];
			lbSetData [_listbox,_index,_veh_type];
			lbSetPicture [_listbox,_index,getText(_vehicle >> "picture")];
			lbSetValue [_listbox, _index,_Value];
		};
	};
};
lbsort _ctrl;
