Use common icon function for vehicle actions (#5923)

* Use common icon function for vehicle actions

* Always create vehicle icon namespace
This commit is contained in:
SilentSpike 2017-12-20 20:30:50 +00:00 committed by PabstMirror
parent 26fddc34a2
commit 2bf67ea057
3 changed files with 4 additions and 5 deletions

View File

@ -9,6 +9,7 @@ PREP_RECOMPILE_END;
GVAR(syncedEvents) = [] call CBA_fnc_hashCreate; GVAR(syncedEvents) = [] call CBA_fnc_hashCreate;
GVAR(showHudHash) = [] call CBA_fnc_hashCreate; GVAR(showHudHash) = [] call CBA_fnc_hashCreate;
GVAR(vehicleIconCache) = call CBA_fnc_createNamespace; // for getVehicleIcon
GVAR(settingsInitFinished) = false; GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = []; GVAR(runAtSettingsInitialized) = [];

View File

@ -21,8 +21,6 @@ params [["_object", objNull, [objNull, ""]]];
if ((_object isEqualType objNull && {isNull _object}) || {_object isEqualType "" && {_object == ""}}) exitWith { DEFAULT_TEXTURE }; 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 { private _objectType = if (_object isEqualType objNull) then {
typeOf _object typeOf _object
} else { } else {

View File

@ -21,13 +21,13 @@
params ["_vehicles", "_statement", "_target"]; params ["_vehicles", "_statement", "_target"];
_vehicles apply { _vehicles apply {
private _config = configFile >> "CfgVehicles" >> typeOf _x; private _type = typeOf _x;
private _name = getText (_config >> "displayName"); private _name = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
private _ownerName = [_x, true] call EFUNC(common,getName); private _ownerName = [_x, true] call EFUNC(common,getName);
if ("" != _ownerName) then { if ("" != _ownerName) then {
_name = format ["%1 (%2)", _name, _ownerName]; _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); private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
[_action, [], _target] [_action, [], _target]
} }