From 7486ae3036d954cd64a2e85200941d65af9d2ab1 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 28 Mar 2015 06:55:46 +0100 Subject: [PATCH 1/2] ace_common_fnc_currentChannel is no longer relyable --- addons/common/functions/fnc_currentChannel.sqf | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index a7ca8c1dd5..127f3b7a54 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -7,11 +7,20 @@ * NONE. * * Return value: - * The current channel. Can be "group", "side", "global", "command", "vehicle" or "direct" (String) + * The current channel. Can be "group", "side", "global", "command", "vehicle", "direct" or "custom_X" (String) */ #include "script_component.hpp" -#define CHANNELS ["group", "side", "global", "command", "vehicle", "direct"] -#define CHANNELS_LOCALIZED [localize "str_channel_group", localize "str_channel_side", localize "str_channel_global", localize "str_channel_command", localize "str_channel_vehicle", localize "str_channel_direct"] +#define CHANNELS ["global", "side", "command", "group", "vehicle", "direct"] +#define CHANNELS_LOCALIZED [localize "str_channel_global", localize "str_channel_side", localize "str_channel_command", localize "str_channel_group", localize "str_channel_vehicle", localize "str_channel_direct"] -CHANNELS select (CHANNELS_LOCALIZED find (uiNamespace getVariable [QGVAR(currentChannel), ""])) max 0 +private "_currentChannel"; +_currentChannel = currentChannel; + +if (_currentChannel < count CHANNELS) then { + _currentChannel = CHANNELS select _currentChannel; +} else { + _currentChannel = format ["custom_%1", _currentChannel - count CHANNELS - 1]; +}; + +_currentChannel From d7aaead03209f784956cb6dafedb939c79d4d36a Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 28 Mar 2015 07:04:50 +0100 Subject: [PATCH 2/2] remove obsolete function for channel --- addons/common/RscInfoType.hpp | 4 --- addons/common/XEH_preInit.sqf | 1 - .../functions/fnc_onLoadRscDisplayChannel.sqf | 29 ------------------- 3 files changed, 34 deletions(-) delete mode 100644 addons/common/functions/fnc_onLoadRscDisplayChannel.sqf diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index fe21b05265..3962297e7a 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -24,7 +24,3 @@ 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);); }; - -class RscDisplayChannel { - onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); -}; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 2a20c69bcb..8227883346 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -132,7 +132,6 @@ PREP(muteUnit); PREP(numberToDigits); PREP(numberToDigitsString); PREP(onAnswerRequest); -PREP(onLoadRscDisplayChannel); PREP(owned); PREP(player); PREP(playerSide); diff --git a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf b/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf deleted file mode 100644 index ae8113c1b8..0000000000 --- a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: Pabst Mirror, commy2 - * When the RscDisplayChannel is loaded, this will constantly uiNamespace variable ace_common_currentChannel - * with the raw localized text of CA_Channel (IDC=101). Only runs while the display is open. - * - * Arguments: - * 0: The RscDisplayChannel Display - * - * Return Value: - * Nothing - * - * Example: - * onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); - * - * Public: No - */ -#include "script_component.hpp" - -uiNamespace setVariable [QGVAR(currentChannelControl), ((_this select 0) displayCtrl 101)]; - -["ACE_currentChannel", "onEachFrame", { - if (isNull (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull])) then { - ["ACE_currentChannel", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; - } else { - private "_localizedChannelText"; - _localizedChannelText = ctrlText (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull]); - uiNamespace setVariable [QGVAR(currentChannel), _localizedChannelText]; - }; -}] call BIS_fnc_addStackedEventhandler;