#include "..\script_component.hpp"

params ["_className", "_price", "_vehicleType"];

private _displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
// private _garage = player getVariable ["FORGE_Garage",  []];
private _garage = GETVAR(player,FORGE_Garage,[]);
// private _vehicleData = [1, 0, []];

if !([_price] call FUNC(handlePurchase)) exitWith {};

// _garage pushBack [_vehicleType, _className, _vehicleData];
_garage pushBack [_vehicleType, _className];

// player setVariable ["FORGE_Garage", _garage, true];
SETPVAR(player,FORGE_Garage,_garage);

[_className, _vehicleType] call EFUNC(arsenal,addGarageVehicle);

[format ["You have purchased %1 for $%2.", _displayName, _price], "info", 3, "right"] call EFUNC(misc,notify);