2015-02-27 21:23:46 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-08-09 03:18:26 +00:00
|
|
|
*
|
2015-03-17 19:43:50 +00:00
|
|
|
* Shows a list of inventory items in a listBox control.
|
2015-02-27 21:23:46 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: RscListBox <CONTROL>
|
2015-03-21 01:17:49 +00:00
|
|
|
* 1: ItemArray [["itemClassnames"],[counts]] <ARRAY>
|
2015-02-27 21:23:46 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-02-27 21:23:46 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [theListBox, [["ace_bandage"],[2]]] call ace_disarming_fnc_showItemsInListbox
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
disableSerialization;
|
2015-03-21 01:17:49 +00:00
|
|
|
|
2015-08-09 03:18:26 +00:00
|
|
|
params ["_listBoxCtrl", "_itemsCountArray"];
|
|
|
|
|
2015-02-27 21:23:46 +00:00
|
|
|
{
|
2016-09-04 14:44:22 +00:00
|
|
|
private _classname = _x;
|
|
|
|
private _count = (_itemsCountArray select 1) select _forEachIndex;
|
2015-02-27 21:23:46 +00:00
|
|
|
|
2015-05-09 19:41:46 +00:00
|
|
|
if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon
|
2016-09-04 14:44:22 +00:00
|
|
|
private "_configPath";
|
|
|
|
private _displayName = "";
|
|
|
|
private _picture = "";
|
2015-03-21 01:17:49 +00:00
|
|
|
switch (true) do {
|
2015-08-09 03:18:26 +00:00
|
|
|
case (isClass (configFile >> "CfgWeapons" >> _classname)): {
|
|
|
|
_configPath = (configFile >> "CfgWeapons");
|
|
|
|
_displayName = getText (_configPath >> _classname >> "displayName");
|
|
|
|
_picture = getText (_configPath >> _classname >> "picture");
|
2015-03-21 01:17:49 +00:00
|
|
|
};
|
2015-08-09 03:18:26 +00:00
|
|
|
case (isClass (configFile >> "CfgMagazines" >> _classname)): {
|
|
|
|
_configPath = (configFile >> "CfgMagazines");
|
|
|
|
_displayName = getText (_configPath >> _classname >> "displayName");
|
|
|
|
_picture = getText (_configPath >> _classname >> "picture");
|
2015-03-21 01:17:49 +00:00
|
|
|
};
|
2015-08-09 03:18:26 +00:00
|
|
|
case (isClass (configFile >> "CfgVehicles" >> _classname)): {
|
|
|
|
_configPath = (configFile >> "CfgVehicles");
|
|
|
|
_displayName = getText (_configPath >> _classname >> "displayName");
|
|
|
|
_picture = getText (_configPath >> _classname >> "picture");
|
2015-03-21 01:17:49 +00:00
|
|
|
};
|
2015-08-09 03:18:26 +00:00
|
|
|
case (isClass (configFile >> "CfgGlasses" >> _classname)): {
|
|
|
|
_configPath = (configFile >> "CfgGlasses");
|
|
|
|
_displayName = getText (_configPath >> _classname >> "displayName");
|
|
|
|
_picture = getText (_configPath >> _classname >> "picture");
|
2015-03-21 01:17:49 +00:00
|
|
|
};
|
2015-04-04 05:52:21 +00:00
|
|
|
default {
|
|
|
|
ERROR(format ["[%1] - bad classname", _classname]);
|
|
|
|
};
|
2015-02-27 21:23:46 +00:00
|
|
|
};
|
|
|
|
|
2015-03-21 01:17:49 +00:00
|
|
|
_listBoxCtrl lbAdd format ["%1", _displayName];
|
2015-05-09 19:41:46 +00:00
|
|
|
_listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname];
|
|
|
|
_listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture];
|
|
|
|
_listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count];
|
2015-03-21 01:17:49 +00:00
|
|
|
};
|
2015-02-27 21:23:46 +00:00
|
|
|
} forEach (_itemsCountArray select 0);
|