Skip to content

Commit

Permalink
Add change of picture in renameInventoryItem
Browse files Browse the repository at this point in the history
  • Loading branch information
SzwedzikPL authored and Brett committed May 26, 2020
1 parent 1777319 commit 67cdc00
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
13 changes: 10 additions & 3 deletions addons/ui/fnc_initDisplayInventory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,17 @@ if !(isNil QGVAR(renamedItems)) then {
if (ctrlShown _control) then {
for [{_i = 0}, {_i < (lbSize _control)}, {_i = _i + 1}] do {
private _classname = ([_control, _i] call FUNC(getInventoryItemData)) select 0;
private _name = GVAR(renamedItems) getVariable _classname;
private _renameParams = GVAR(renamedItems) getVariable [_classname, []];

if !(_name isEqualTo "") then {
_control lbSetText [_i, _name];
if !(_renameParams isEqualTo []) then {
_renameParams params ["_name", "_picture"];

if !(_name isEqualTo "") then {
_control lbSetText [_i, _name];
};
if !(_picture isEqualTo "") then {
_control lbSetPicture [_i, _picture];
};
};
};
};
Expand Down
11 changes: 7 additions & 4 deletions addons/ui/fnc_renameInventoryItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ Description:
Parameters:
_class - Item classname. <STRING>
_name - New item name. <STRING>
_picture - New item picture. <STRING>
Examples:
(begin example)
["DocumentsSecret", "SynixeBrett's secret documents"] call CBA_fnc_renameInventoryItem;
["DocumentsSecret", "SynixeBrett's secret documents", "\a3\Missions_F_Oldman\Props\data\FilesSecret_ca.paa"] call CBA_fnc_renameInventoryItem;
(end)
Returns:
Expand All @@ -22,16 +24,17 @@ Authors:
---------------------------------------------------------------------------- */

params [
["_class", "", [""]],
["_name", "", [""]]
["_class", "", [""]],
["_name", "", [""]],
["_picture", "", [""]]
];

// Exit if no interface or empty class
if (!hasInterface || {_class isEqualTo ""}) exitWith {};

// Create local namespace on first use
if (isNil QGVAR(renamedItems)) then {
GVAR(renamedItems) = false call CBA_fnc_createNamespace;
GVAR(renamedItems) = false call CBA_fnc_createNamespace;
};

GVAR(renamedItems) setVariable [_class, _name];
GVAR(renamedItems) setVariable [_class, [_name, _picture]];

0 comments on commit 67cdc00

Please sign in to comment.