From 1415b8398da653bebb59d961e4735ebd8b5df93b Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 23 Sep 2016 23:11:07 +0200 Subject: [PATCH 1/2] remove obsolete team synch code --- addons/common/CfgEventHandlers.hpp | 6 ------ addons/common/XEH_postInit.sqf | 23 -------------------- addons/common/XEH_preStart.sqf | 4 ---- addons/common/fnc_onTeamColorChanged.sqf | 27 ------------------------ addons/common/fnc_synchTeamColors.sqf | 26 ----------------------- 5 files changed, 86 deletions(-) delete mode 100644 addons/common/XEH_preStart.sqf delete mode 100644 addons/common/fnc_onTeamColorChanged.sqf delete mode 100644 addons/common/fnc_synchTeamColors.sqf diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index e53a38deb..aab746c5e 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -1,10 +1,4 @@ -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index e1975a131..c5171406e 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -35,29 +35,6 @@ for "_i" from 0 to ((count (CFG)) - 1) do { }; }; -// system to synch team colors -// Note: 1.62 added Multiplayer synchronization for assigned team -// Run the PFEH only if on previous versions, keep the event for backwards compatability - -PREP(onTeamColorChanged); -PREP(synchTeamColors); - -["CBA_teamColorChanged", FUNC(onTeamColorChanged)] call CBA_fnc_addEventHandler; - -if (hasInterface && {(productVersion select 2) < 162}) then { - [FUNC(synchTeamColors), 1, []] call CBA_fnc_addPerFrameHandler; - - if (didJIP) then { - { - private _team = _x getVariable [QGVAR(synchedTeam), ""]; - if (_team != "") then { - _x assignTeam _team; - }; - true - } count allUnits; - }; -}; - //Event for switching vehicle var names from CBA_fnc_switchPlayer ["CBA_setVehicleVarName", { params ["_oldVeh", "_newVeh", "_vehName"]; diff --git a/addons/common/XEH_preStart.sqf b/addons/common/XEH_preStart.sqf deleted file mode 100644 index 87c0b5c2d..000000000 --- a/addons/common/XEH_preStart.sqf +++ /dev/null @@ -1,4 +0,0 @@ -#include "script_component.hpp" - -PREP(onTeamColorChanged); -PREP(synchTeamColors); diff --git a/addons/common/fnc_onTeamColorChanged.sqf b/addons/common/fnc_onTeamColorChanged.sqf deleted file mode 100644 index 2a13d0782..000000000 --- a/addons/common/fnc_onTeamColorChanged.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* ---------------------------------------------------------------------------- -Internal Function: CBA_common_fnc_onTeamColorChanged - -Description: - Assigns the units team color if it changed on the squad leaders machine. - -Parameters: - _unit - unit [OBJECT] - _team - team the unit got assigned to [STRING] - -Returns: - Nothing - -Author: - BaerMitUmlaut ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -params ["_unit", "_team"]; - -_unit assignTeam _team; - -if ((productVersion select 2) >= 162) exitWith {}; - -if (local (leader _unit)) then { - _unit setVariable [QGVAR(synchedTeam), _team, true]; -}; diff --git a/addons/common/fnc_synchTeamColors.sqf b/addons/common/fnc_synchTeamColors.sqf deleted file mode 100644 index dc51271fb..000000000 --- a/addons/common/fnc_synchTeamColors.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/* ---------------------------------------------------------------------------- -Internal Function: CBA_common_fnc_synchTeamColors - -Description: - Synchs the team colors. Does not need to be called manually. - -Parameters: - None - -Returns: - Nothing - -Author: - BaerMitUmlaut ----------------------------------------------------------------------------- */ -#include "script_component.hpp" - -if (leader player == player) then { - { - if ((assignedTeam _x) != (_x getVariable [QGVAR(synchedTeam), "MAIN"])) then { - //Local team != currently synched team, so we need to synchronize them again - ["CBA_teamColorChanged", [_x, assignedTeam _x]] call CBA_fnc_globalEvent; - }; - true - } count units player; -}; From 0f10e6626b4f9502e3cbca30420b0758c7a5fca3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 23 Sep 2016 23:31:27 +0200 Subject: [PATCH 2/2] readd event for backwards compatibility --- addons/common/XEH_postInit.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index c5171406e..2a2a3be60 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -35,6 +35,12 @@ for "_i" from 0 to ((count (CFG)) - 1) do { }; }; +// event for switching team colors, DEPRECATED +["CBA_teamColorChanged", { + params ["_unit", "_team"]; + _unit assignTeam _team; +}] call CBA_fnc_addEventHandler; + //Event for switching vehicle var names from CBA_fnc_switchPlayer ["CBA_setVehicleVarName", { params ["_oldVeh", "_newVeh", "_vehName"];