From 063155a0eb652a352605c23c3849676d934a9ec4 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 14 May 2020 23:56:03 -0500 Subject: [PATCH] XEH - Fix CBA functions not available in editor when using RECOMPILE (DEV Only) Ref #1336 --- addons/jr/CfgFunctions.hpp | 1 + addons/xeh/CfgFunctions.hpp | 2 ++ addons/xeh/fnc_preInit.sqf | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/addons/jr/CfgFunctions.hpp b/addons/jr/CfgFunctions.hpp index a7a2f5d0b..8a203c3f8 100644 --- a/addons/jr/CfgFunctions.hpp +++ b/addons/jr/CfgFunctions.hpp @@ -12,6 +12,7 @@ class CfgFunctions { class compatibleItems { description = "Get list of compatible attachments for a weapon"; file = QPATHTOF(fnc_compatibleItems.sqf); + RECOMPILE; }; }; }; diff --git a/addons/xeh/CfgFunctions.hpp b/addons/xeh/CfgFunctions.hpp index 041f27a54..b9ea0e312 100644 --- a/addons/xeh/CfgFunctions.hpp +++ b/addons/xeh/CfgFunctions.hpp @@ -18,10 +18,12 @@ class CfgFunctions { class preInit { preInit = 1; file = PATHTOF(fnc_preInit.sqf); + // This file cannot be recompiled or it will be undefined at preInit }; class postInit { postInit = 1; file = PATHTOF(fnc_postInit.sqf); + RECOMPILE; }; }; }; diff --git a/addons/xeh/fnc_preInit.sqf b/addons/xeh/fnc_preInit.sqf index 7616aa7b8..d2072a45d 100644 --- a/addons/xeh/fnc_preInit.sqf +++ b/addons/xeh/fnc_preInit.sqf @@ -25,6 +25,18 @@ SLX_XEH_DisableLogging = uiNamespace getVariable ["SLX_XEH_DisableLogging", fals XEH_LOG("PreInit started. v" + getText (configFile >> "CfgPatches" >> "cba_common" >> "versionStr")); +#ifdef RECOMPILE +if (isNil "CBA_fnc_compileFunction") then { + INFO("Recompiling all CBA Functions [for use in threeden]"); + { + { + private _fncName = format ["CBA_fnc_%1", configName _x]; + _fncName call BIS_fnc_recompile; + } forEach (configProperties [_x]); + } forEach (configProperties [configFile >> "CfgFunctions" >> "CBA"]); +}; +#endif + SLX_XEH_STR = ""; // does nothing, never changes, backwards compatibility SLX_XEH_COMPILE = compileFinal "compile preprocessFileLineNumbers _this"; //backwards comps SLX_XEH_COMPILE_NEW = CBA_fnc_compileFunction; //backwards comp