Skip to content

Commit

Permalink
Resolve XEH redirect handlers (CBATeam#1056)
Browse files Browse the repository at this point in the history
* Resolve XEH redirect handlers

* Teletabby

* bleep bloop

* Tibbi Tabbi Schwibbi Schwabbi
  • Loading branch information
dedmen authored and commy2 committed Feb 8, 2019
1 parent f9e5099 commit d1f5de1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions addons/xeh/fnc_compileEventHandlers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ private _resultNames = [];
};

if !(_eventFunc isEqualTo "") then {

//Optimize "QUOTE(call COMPILE_FILE(XEH_preInit));" down to just the content of the EH script
if (!(["compile"] call CBA_fnc_isRecompileEnabled) && { //Users might expect their preInit script to be reloaded everytime when debugging
(toLower (_eventFunc select [0,40])) isEqualTo "call compile preprocessfilelinenumbers '" && {
(_eventFunc select [count _eventFunc -2]) isEqualTo "';"
}}) then {
private _funcPath = _eventFunc select [40, count _eventFunc - 42];
//If there is a quote mark in the path, then something went wrong and we got multiple paths, just skip optimization
//Example cause: "call COMPILE_FILE(XEH_preInit);call COMPILE_FILE(XEH_preClientInit)"
if (_funcPath find "'" == -1) then {
_eventFunc = preprocessFileLineNumbers _funcPath;

TRACE_2("eventfunction redirected",_customName,_funcPath);
};
};

_eventFunc = compile _eventFunc;
TRACE_2("does something",_customName,_eventName);
} else {
Expand Down

0 comments on commit d1f5de1

Please sign in to comment.