mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d72555ab0c
* support per tab sorting, and external algorithms * improved sub sorting * improve alphabetical search * update mod sorting * sort by accuracy * sort right panel * more sorts * sort right tab * fix empty * stringtables * Apply suggestions from code review Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> * more suggestions * suggestions * remember last sort * Fix missing throw and put names * bad copy paste in stringtable * Update addons/arsenal/functions/fnc_sortPanel.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
59 lines
2.1 KiB
Plaintext
59 lines
2.1 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]
|
|
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
|
|
} else {
|
|
_cachedItemInfo set [2, ""];//mod picture
|
|
_cachedItemInfo set [3, 0];//mod ID
|
|
};
|
|
_cacheNamespace setVariable [_configCategory+_className, _cachedItemInfo];
|
|
};
|
|
|
|
_cachedItemInfo params ["_displayName", "_itemPicture", "_modPicture"];
|
|
|
|
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
|
|
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
|
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
|
_ctrlPanel lbSetPictureRight [_lbAdd,["",_modPicture] select (GVAR(enableModIcons))];
|
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|