diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index 4d94f8ae2c..5b8eed46c6 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -113,10 +113,6 @@ class RscInGameUI { }; }; -class RscDisplayInventory { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDisplayInventory"",'IGUI')] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf""; [ARR_2('inventoryDisplayLoaded', _this)] call FUNC(localEvent);); -}; - // map class RscDisplayMainMap { onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscDiary"",'GUI')] call (uinamespace getVariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgMap', _this select 0)]; [ARR_2('mapDisplayLoaded', [ARR_2(_this select 0, 'Ingame')])] call FUNC(localEvent);); diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index c236fb6f57..50bfab4e84 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -10,6 +11,12 @@ class Extended_PostInit_EventHandlers { }; }; +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE([ARR_2(ACE_player, _this select 0)] call FUNC(updateInventoryDisplay)); + }; +}; + // handle preloaded missile class Extended_InitPost_EventHandlers { class CAManBase { diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index 5c4ddafe95..94ad62b1cc 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -3,10 +3,6 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", { - [ACE_player, _this select 0] call FUNC(updateInventoryDisplay) -}] call EFUNC(common,addEventHandler); - ["playerInventoryChanged", { params ["_unit"]; [_unit] call FUNC(takeLoadedATWeapon); diff --git a/addons/inventory/CfgEventHandlers.hpp b/addons/inventory/CfgEventHandlers.hpp index 0cd959a047..cf4e7e1abe 100644 --- a/addons/inventory/CfgEventHandlers.hpp +++ b/addons/inventory/CfgEventHandlers.hpp @@ -10,3 +10,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE(_this call FUNC(inventoryDisplayLoad)); + }; +}; diff --git a/addons/inventory/XEH_postInit.sqf b/addons/inventory/XEH_postInit.sqf index 586f10fc28..bf7adec77a 100644 --- a/addons/inventory/XEH_postInit.sqf +++ b/addons/inventory/XEH_postInit.sqf @@ -5,8 +5,6 @@ if (!hasInterface) exitWith {}; GVAR(customFilters) = []; GVAR(selectedFilterIndex) = -1; -["inventoryDisplayLoaded", {_this call FUNC(inventoryDisplayLoaded)}] call EFUNC(common,addEventHandler); - // add custom filters // generate list of grenades diff --git a/addons/inventory/XEH_preInit.sqf b/addons/inventory/XEH_preInit.sqf index d574cacf3b..3b08d245d5 100644 --- a/addons/inventory/XEH_preInit.sqf +++ b/addons/inventory/XEH_preInit.sqf @@ -5,7 +5,7 @@ ADDON = false; PREP(addCustomFilter); PREP(currentItemListBox); PREP(forceItemListUpdate); -PREP(inventoryDisplayLoaded); +PREP(inventoryDisplayLoad); PREP(onLBSelChanged); // cache config diff --git a/addons/inventory/functions/fnc_inventoryDisplayLoaded.sqf b/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf similarity index 100% rename from addons/inventory/functions/fnc_inventoryDisplayLoaded.sqf rename to addons/inventory/functions/fnc_inventoryDisplayLoad.sqf diff --git a/addons/movement/CfgEventHandlers.hpp b/addons/movement/CfgEventHandlers.hpp index e75956f440..091f1526e2 100644 --- a/addons/movement/CfgEventHandlers.hpp +++ b/addons/movement/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -9,3 +10,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayInventory { + ADDON = QUOTE(_this call COMPILE_FILE(XEH_inventoryDisplayLoad)); + }; +}; diff --git a/addons/movement/XEH_inventoryDisplayLoad.sqf b/addons/movement/XEH_inventoryDisplayLoad.sqf new file mode 100644 index 0000000000..ae717e7b39 --- /dev/null +++ b/addons/movement/XEH_inventoryDisplayLoad.sqf @@ -0,0 +1,14 @@ +#include "script_component.hpp" + +disableSerialization; + +[{ + disableSerialization; + params ["_dialog"]; + + if (isNull _dialog) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + (_dialog displayCtrl 111) ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; +}, 0, _this select 0] call CBA_fnc_addPerFrameHandler; diff --git a/addons/movement/XEH_postInit.sqf b/addons/movement/XEH_postInit.sqf index 7825134af3..806823f4c4 100644 --- a/addons/movement/XEH_postInit.sqf +++ b/addons/movement/XEH_postInit.sqf @@ -3,22 +3,6 @@ if (!hasInterface) exitWith {}; -["inventoryDisplayLoaded", { - - [{ - disableSerialization; - params ["_dialog"]; - - if (isNull _dialog) exitWith { - [_this select 1] call CBA_fnc_removePerFrameHandler; - }; - - _dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; - - }, 0, _this select 0] call CBA_fnc_addPerFrameHandler; - -}] call EFUNC(common,addEventHandler); - ["ACE3 Movement", QGVAR(climb), localize LSTRING(Climb), { // Conditions: canInteract