From 67cdc0044bef4ca86c35c9264b0ef9cd1da228d4 Mon Sep 17 00:00:00 2001 From: SzwedzikPL Date: Tue, 26 May 2020 10:19:21 +0200 Subject: [PATCH] Add change of picture in renameInventoryItem --- addons/ui/fnc_initDisplayInventory.sqf | 13 ++++++++++--- addons/ui/fnc_renameInventoryItem.sqf | 11 +++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/addons/ui/fnc_initDisplayInventory.sqf b/addons/ui/fnc_initDisplayInventory.sqf index 973e0e2d9..6abac58d2 100644 --- a/addons/ui/fnc_initDisplayInventory.sqf +++ b/addons/ui/fnc_initDisplayInventory.sqf @@ -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]; + }; }; }; }; diff --git a/addons/ui/fnc_renameInventoryItem.sqf b/addons/ui/fnc_renameInventoryItem.sqf index 2c6a8afbd..114df48e9 100644 --- a/addons/ui/fnc_renameInventoryItem.sqf +++ b/addons/ui/fnc_renameInventoryItem.sqf @@ -8,10 +8,12 @@ Description: Parameters: _class - Item classname. _name - New item name. + _picture - New item picture. 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: @@ -22,8 +24,9 @@ Authors: ---------------------------------------------------------------------------- */ params [ - ["_class", "", [""]], - ["_name", "", [""]] + ["_class", "", [""]], + ["_name", "", [""]], + ["_picture", "", [""]] ]; // Exit if no interface or empty class @@ -31,7 +34,7 @@ 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]];