ACE3/addons/arsenal/functions/fnc_addListBoxItem.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

63 lines
2.4 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Dedmen
* Add a listbox row.
*
* Arguments:
* 0: Config category <STRING> (must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice")
* 1: Classname <STRING>
* 2: Panel control <CONTROL>
* 3: Name of the picture entry in that Cfg class <STRING>
*
* Return Value:
* None
*
* Public: Yes
*/
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
private _cacheNamespace = _ctrlPanel; //For better readability.
private _cachedItemInfo = _cacheNamespace getVariable [_configCategory+_className, []];
//_cachedItemInfo == [_displayName, _itemPicture, _modPicture, _modID]
if (_cachedItemInfo isEqualTo []) then {//Not in cache. So get info and put into cache.
private _configPath = configFile >> _configCategory >> _className;
_cachedItemInfo set [0, getText (_configPath >> "displayName")];
//if _pictureEntryName is empty then this item has no Icons. (Faces)
_cachedItemInfo set [1, if (_pictureEntryName isEqualTo "") then {""} else {getText (_configPath >> _pictureEntryName)}];
//get name of DLC
private _dlcName = "";
private _addons = configsourceaddonlist _configPath;
if !(_addons isEqualTo []) then {
private _mods = configsourcemodlist (configfile >> "CfgPatches" >> _addons select 0);
if !(_mods isEqualTo []) then {
_dlcName = _mods select 0;
};
};
if (_dlcName != "") then {
_cachedItemInfo set [2, (modParams [_dlcName,["logo"]]) param [0,""]];//mod picture
_modID = GVAR(modList) find _dlcName;
if (_modID < 0) then {_modID = GVAR(modList) pushback _dlcName;};//We keep a ordered list of all mods for sorting later.
_cachedItemInfo set [3, _modID];//mod ID
} else {
_cachedItemInfo set [2, ""];//mod picture
_cachedItemInfo set [3, 0];//mod ID
};
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
};
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture", "_modID"];
private _lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _className];
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
_ctrlPanel lbSetValue [_lbAdd,_modID];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];