Skip to content
4 changes: 0 additions & 4 deletions addons/xeh/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class CfgFunctions {
description = "Occurs once per mission after objects and functions are initialized.";
file = PATHTOF(fnc_postInit.sqf);
};
class postInit_unscheduled {
description = "Occurs once per mission after objects and functions are initialized.";
file = PATHTOF(fnc_postInit_unscheduled.sqf);
};
class startFallbackLoop {
description = "Starts a loop to iterate through all objects to initialize event handlers on XEH incompatible objects.";
file = PATHTOF(fnc_startFallbackLoop.sqf);
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_initDisplay.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ if !(_event isEqualTo "") then {
private ["_event", "_className"]; // prevent these variables from being overwritten
_args call compile getText _x;
} forEach configProperties [_x >> XEH_FORMAT_CONFIG_NAME(_event) >> _className, "isText _x"];
} forEach XEH_MAIN_CONFIGS;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macro seemed pointless. Bugged me for a while and now is an opportunity to muck it out.

} forEach [configFile, campaignConfigFile, missionConfigFile];
};
49 changes: 48 additions & 1 deletion addons/xeh/fnc_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,51 @@ Author:
commy2
---------------------------------------------------------------------------- */

CBA_fnc_postInit_unscheduled call CBA_fnc_directCall;
isNil {
XEH_LOG("XEH: PostInit started. " + PFORMAT_9("MISSIONINIT",missionName,missionVersion,worldName,isMultiplayer,isServer,isDedicated,CBA_isHeadlessClient,hasInterface,didJIP));

// fix CBA_missionTime being -1 on (non-JIP) clients at mission start.
if (CBA_missionTime == -1) then {
CBA_missionTime = 0;
};

// call PostInit events
{
if (_x select 1 == "postInit") then {
(_x select 2) call {
private "_x";

[] call (_this select 0);

if (!isDedicated) then {
[] call (_this select 1);
};

if (isServer) then {
[] call (_this select 2);
};
};
};
} forEach GVAR(allEventHandlers);

// do InitPost
{
_x params ["_this"];

{
[_this] call _x;
} forEach (_this getVariable QGVAR(initPost));
} forEach GVAR(initPostStack);

GVAR(initPostStack) = nil;

#ifdef DEBUG_MODE_FULL
diag_log text format ["isScheduled = %1", call CBA_fnc_isScheduled];
#endif

SLX_XEH_MACHINE set [8, true]; // PostInit passed

XEH_LOG("XEH: PostInit finished.");
};

nil
59 changes: 0 additions & 59 deletions addons/xeh/fnc_postInit_unscheduled.sqf

This file was deleted.

37 changes: 22 additions & 15 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ GVAR(EventsLowercase) = [];

// generate list of incompatible classes
GVAR(incompatible) = [] call CBA_fnc_createNamespace;
private _cfgVehicles = configFile >> "CfgVehicles";

{
private _class = _cfgVehicles >> _x;
private _class = configFile >> "CfgVehicles" >> _x;

while {isClass _class && {!ISINCOMP(configName _class)}} do {
SETINCOMP(configName _class);
Expand All @@ -94,7 +94,7 @@ GVAR(allEventHandlers) = call (uiNamespace getVariable [QGVAR(configFileEventHan

{
GVAR(allEventHandlers) append (_x call CBA_fnc_compileEventHandlers);
} forEach (XEH_MAIN_CONFIGS - [configFile]);
} forEach [campaignConfigFile, missionConfigFile];

#ifdef DEBUG_MODE_FULL
XEH_LOG("XEH: Compiling XEH END");
Expand All @@ -107,15 +107,18 @@ GVAR(fallbackRunning) = false;
{
if (_x select 0 == "") then {
if (_x select 1 == "preInit") then {
(_x select 2) params ["_funcAll", "_funcClient", "_funcServer"];
if (!(_funcAll isEqualTo {})) then {
[] call _funcAll;
};
if ((!isDedicated) && {!(_funcClient isEqualTo {})}) then {
[] call _funcClient;
};
if ((isServer) && {!(_funcServer isEqualTo {})}) then {
[] call _funcServer;
(_x select 2) call {
private "_x";

[] call (_this select 0);

if (!isDedicated) then {
[] call (_this select 1);
};

if (isServer) then {
[] call (_this select 2);
};
};
};
} else {
Expand All @@ -125,16 +128,20 @@ GVAR(fallbackRunning) = false;
if (_eventName == "firedBis") then {
_eventName = "fired";
};

_eventFunc params ["_funcAll", "_funcClient", "_funcServer"];
if (!(_funcAll isEqualTo {})) then {

if !(_funcAll isEqualTo {}) then {
private _success = [_className, _eventName, _funcAll, _allowInheritance, _excludedClasses] call CBA_fnc_addClassEventHandler;
TRACE_3("addClassEventHandler",_className,_eventName,_success);
};
if ((!isDedicated) && {!(_funcClient isEqualTo {})}) then {

if (!isDedicated && {!(_funcClient isEqualTo {})}) then {
private _success = [_className, _eventName, _funcClient, _allowInheritance, _excludedClasses] call CBA_fnc_addClassEventHandler;
TRACE_3("addClassEventHandler",_className,_eventName,_success);
};
if ((isServer) && {!(_funcServer isEqualTo {})}) then {

if (isServer && {!(_funcServer isEqualTo {})}) then {
private _success = [_className, _eventName, _funcServer, _allowInheritance, _excludedClasses] call CBA_fnc_addClassEventHandler;
TRACE_3("addClassEventHandler",_className,_eventName,_success);
};
Expand Down
2 changes: 0 additions & 2 deletions addons/xeh/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

#include "script_xeh.hpp"

#define XEH_MAIN_CONFIGS [configFile, campaignConfigFile, missionConfigFile]

#undef XEH_ENABLED
#define XEH_ENABLED class EventHandlers {class XEH_CLASS: XEH_CLASS_BASE {};}; SLX_XEH_DISABLED = 0

Expand Down