From 2bf67ea057b1a48723f64dac52ece3a7d2ba7d96 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Wed, 20 Dec 2017 20:30:50 +0000 Subject: [PATCH] Use common icon function for vehicle actions (#5923) * Use common icon function for vehicle actions * Always create vehicle icon namespace --- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_getVehicleIcon.sqf | 2 -- .../interact_menu/functions/fnc_createVehiclesActions.sqf | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 2f1cfba0dd..d8fccd3884 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -9,6 +9,7 @@ PREP_RECOMPILE_END; GVAR(syncedEvents) = [] call CBA_fnc_hashCreate; GVAR(showHudHash) = [] call CBA_fnc_hashCreate; +GVAR(vehicleIconCache) = call CBA_fnc_createNamespace; // for getVehicleIcon GVAR(settingsInitFinished) = false; GVAR(runAtSettingsInitialized) = []; diff --git a/addons/common/functions/fnc_getVehicleIcon.sqf b/addons/common/functions/fnc_getVehicleIcon.sqf index 1974c57b71..fd556ed580 100644 --- a/addons/common/functions/fnc_getVehicleIcon.sqf +++ b/addons/common/functions/fnc_getVehicleIcon.sqf @@ -21,8 +21,6 @@ params [["_object", objNull, [objNull, ""]]]; if ((_object isEqualType objNull && {isNull _object}) || {_object isEqualType "" && {_object == ""}}) exitWith { DEFAULT_TEXTURE }; -ISNILS(GVAR(vehicleIconCache),call CBA_fnc_createNamespace); - private _objectType = if (_object isEqualType objNull) then { typeOf _object } else { diff --git a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf index 6bdc941118..4f29b9e65b 100644 --- a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf +++ b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf @@ -21,13 +21,13 @@ params ["_vehicles", "_statement", "_target"]; _vehicles apply { - private _config = configFile >> "CfgVehicles" >> typeOf _x; - private _name = getText (_config >> "displayName"); + private _type = typeOf _x; + private _name = getText (configFile >> "CfgVehicles" >> _type >> "displayName"); private _ownerName = [_x, true] call EFUNC(common,getName); if ("" != _ownerName) then { _name = format ["%1 (%2)", _name, _ownerName]; }; - private _icon = (getText (_config >> "icon")) call BIS_fnc_textureVehicleIcon; + private _icon = [_type] call EFUNC(common,getVehicleIcon); private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); [_action, [], _target] }