#include "..\script_component.hpp" private _display = findDisplay IDD_GARAGEDIALOG; private _garageList = _display displayCtrl IDC_GARAGEVEHICLELIST; private _vehicleList = _display displayCtrl IDC_VEHICLELIST; private _selectedVehicle = lbCurSel _garageList; private _selectedVehicleData = _garageList lbData _selectedVehicle; private _data = call compile _selectedVehicleData; ctrlEnable [IDC_SPAWNBUTTON, false]; if ((isNil { _data })) exitWith { ctrlEnable [IDC_SPAWNBUTTON, true]; }; private _isGarageVehicle = _data select 0; private _className = _data select 1; private _vehData = _data select 2; private _locations = (missionConfigFile >> "CfgGarages" >> "locations") call BFUNC(getCfgData); { if (_isGarageVehicle) exitWith { private _vehicle = createVehicle [_className, (_x select 1)]; private _hitPointsData = _vehData select 0; if (count _hitPointsData > 0) then { private _hitPoints = _hitPointsData select 0; private _damages = _hitPointsData select 2; { _vehicle setHitPointDamage [_x, _damages select _forEachIndex]; } forEach _hitPoints; }; { _vehicle setHitPointDamage [_x, _damages select _forEachIndex]; } forEach _hitPoints; _vehicle setFuel _fuel; _vehicle setDamage _damage; // _vehicle setVariable ["FORGE_GarageVehicle", _isGarageVehicle, true]; SETPVAR(_vehicle,FORGE_GarageVehicle,_isGarageVehicle); _vehicle setDir (_x select 2); }; } forEach _locations; lbClear _garageList; lbClear _vehicleList; _garageList lbSetCurSel -1; _vehicleList lbSetCurSel -1; // private _garage = player getVariable ["FORGE_Garage", []]; private _garage = GETVAR(player,FORGE_Garage,[]); private _index = _garage findIf { (_x select 0) == _isGarageVehicle && (_x select 1) == _className }; if (_index != -1) then { _garage deleteAt _index; // player setVariable ["FORGE_Garage", _garage, true]; SETPVAR(player,FORGE_Garage,_garage); }; [] call FUNC(fetchGarage); [] call FUNC(fetchNearby); ctrlEnable [IDC_SPAWNBUTTON, true]; playSound "FD_Finish_F";