#include "..\script_component.hpp"

/*
 * Author: IDSolutions
 * Fetches the vehicles in the garage
 *
 * Arguments:
 * None
 *
 * Return Value:
 * None
 *
 * Example:
 * None
 *
 * Public: No
 */

private _display = findDisplay IDD_GARAGEDIALOG;
private _garageList = _display displayCtrl IDC_GARAGEVEHICLELIST;
private _storedVehicles = GETVAR(player,FORGE_Garage,[]);

lbClear _garageList;

{
    // _x params ["_vehType", "_className", "_vehData"];
    _x params ["_vehType", "_className"];

    private _index = -1;
    private _displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
    private _picture = getText (configFile >> "CfgVehicles" >> _className >> "picture");

    _index = _garageList lbAdd _displayName;
    // _garageList lbSetData [_index, str [_vehType, _className, _vehData]];
    _garageList lbSetData [_index, str [_vehType, _className]];
    _garageList lbSetPicture [_index, _picture];
} forEach _storedVehicles;