ACE3/addons/common/functions/fnc_getVehicleIcon.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05: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 isEqualType objNull && {isNull _object}) || {_object isEqualType "" && {_object == ""}}) exitWith { DEFAULT_TEXTURE };
private _objectType = if (_object isEqualType objNull) then {
typeOf _object
} else {
_object
};
private _cachedValue = GVAR(vehicleIconCache) getVariable _objectType;
if (isNil "_cachedValue") then {
private _vehicleValue = getText (configfile >> "CfgVehicles" >> _objectType >> "icon");
private _vehicleIconValue = getText (configfile >> "CfgVehicleIcons" >> _vehicleValue);
if (_vehicleIconValue == "") then {
if (_vehicleValue != "" && {((toLower _vehicleValue) find ".paa") > -1}) then {
_cachedValue = _vehicleValue;
} else {
_cachedValue = DEFAULT_TEXTURE;
};
} else {
_cachedValue = _vehicleIconValue;
};
GVAR(vehicleIconCache) setVariable [_objectType, _cachedValue];
};
_cachedValue