ACE3/addons/common/functions/fnc_getVehicleIcon.sqf
Grim e06c6f7835
General - Replace toLower with toLowerANSI where applicable (#9790)
* General - Replace toLower with toLowerANSI where applicable

* whoops

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/repair/functions/fnc_setHitPointDamage.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/repair/dev/draw_showRepairInfo.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* comparment -> compartment

* Update fnc_showHud.sqf

* Update fnc_registerObjects.sqf

* Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-03-07 22:08:13 +01:00

48 lines
1.3 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: AACO
* Function used to get the vehicle icon for provided object (cached for repeat use)
*
* Arguments:
* 0: Object to get icon of <OBJECT, STRING>
*
* Return Value:
* Icon of vehicle <STRING>
*
* Examples:
* ["B_Soldier_F"] call ace_common_fnc_getVehicleIcon;
*
* Public: Yes
*/
#define DEFAULT_TEXTURE "\A3\ui_f\data\Map\VehicleIcons\iconVehicle_ca.paa"
params [["_object", objNull, [objNull, ""]]];
if (_object isEqualTo objNull || {_object isEqualTo ""}) exitWith { DEFAULT_TEXTURE };
private _objectType = if (_object isEqualType objNull) then {
typeOf _object
} else {
_object
};
private _cachedValue = GVAR(vehicleIconCache) get _objectType;
if (isNil "_cachedValue") then {
private _vehicleValue = getText (configfile >> "CfgVehicles" >> _objectType >> "icon");
private _vehicleIconValue = getText (configfile >> "CfgVehicleIcons" >> _vehicleValue);
if (_vehicleIconValue == "") then {
if (_vehicleValue != "" && {((toLowerANSI _vehicleValue) find ".paa") > -1}) then {
_cachedValue = _vehicleValue;
} else {
_cachedValue = DEFAULT_TEXTURE;
};
} else {
_cachedValue = _vehicleIconValue;
};
GVAR(vehicleIconCache) set [_objectType, _cachedValue];
};
_cachedValue