Skip to content

Commit

Permalink
remove all checks for versions below v1.58
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 committed Jul 13, 2016
1 parent f70aada commit 27adc01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 64 deletions.
26 changes: 1 addition & 25 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,7 @@
#include "script_component.hpp"

//Install PFEH:
if (isNil {canSuspend}) then {
// pre 1.58
["CBA_PFH", "onEachFrame", {
call FUNC(onFrame);
GVAR(lastFrameRender) = diag_frameNo;
}] call BIS_fnc_addStackedEventHandler;

FUNC(monitorFrameRender) = {
if (abs (diag_frameno - GVAR(lastFrameRender)) > DELAY_MONITOR_THRESHOLD) then {
// Restores the onEachFrame handler
["CBA_PFH", "onEachFrame", {
call FUNC(onFrame);
GVAR(lastFrameRender) = diag_frameNo;
}] call BIS_fnc_addStackedEventHandler;
TRACE_1("PFH restored",nil);
};
};

// Use a trigger, runs every 0.5s, unscheduled execution
GVAR(perFrameTrigger) = createTrigger ["EmptyDetector", [0,0,0], false];
GVAR(perFrameTrigger) setTriggerStatements ['FUNC(monitorFrameRender) call CBA_fnc_directCall', "", ""];
} else {
// 1.58 and later
addMissionEventHandler ["EachFrame", FUNC(onFrame)];
};
addMissionEventHandler ["EachFrame", FUNC(onFrame)];

LOG(MSG_INIT);

Expand Down
14 changes: 3 additions & 11 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,9 @@ if (isMultiplayer) then {
GVAR(lastTickTime) = _tickTime;
};

if (isNil {canSuspend}) then {
// pre v1.58
["CBA_SynchMissionTime", "onPlayerConnected", {
_owner publicVariableClient "CBA_missionTime";
}] call BIS_fnc_addStackedEventHandler;
} else {
// v1.58 and later
addMissionEventHandler ["PlayerConnected", {
(_this select 4) publicVariableClient "CBA_missionTime";
}];
};
addMissionEventHandler ["PlayerConnected", {
(_this select 4) publicVariableClient "CBA_missionTime";
}];
} else {
CBA_missionTime = -1;

Expand Down
39 changes: 11 additions & 28 deletions addons/network/XEH_postServerInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,20 @@ LOG(MSG_INIT);
// Why would we send __SERVER__ to an on PLAYER connected event,
// [["__SERVER__","0",objNull,true]] call CBA_fnc_globalEvent;

if (isNil {canSuspend}) then {
// pre v1.58
// OPC gets _id, _uid, _name
[QUOTE(GVAR(opc)), "onPlayerConnected", {
if (_name=="__SERVER__") exitWith {};
_obj=objNull;
{
if (_name == name _x) then
{
_obj=_x;
};
} forEach playableUnits;
if (!isNull _obj) then {[_name, _uid, _obj] call FUNC(opc);};
}] call BIS_fnc_addStackedEventhandler;
} else {
// v1.58 and later
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner"];
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner"];

if (_name == "__SERVER__") exitWith {};
if (_name == "__SERVER__") exitWith {};

private _object = objNull;
{
if (name _x == _name) exitWith { _object = _x; };
} forEach playableUnits;
private _object = objNull;
{
if (name _x == _name) exitWith { _object = _x; };
} forEach playableUnits;

if (!isNull _object) then {
[_name, _uid, _object] call FUNC(opc);
};
}];
};
if (!isNull _object) then {
[_name, _uid, _object] call FUNC(opc);
};
}];

// Announce the completion of the initialization of the script
ADDON = true;

0 comments on commit 27adc01

Please sign in to comment.