Skip to content

Commit

Permalink
Merge pull request #283 from CBATeam/fix3denpreview
Browse files Browse the repository at this point in the history
don't execute preInit when returning to 3den
  • Loading branch information
Killswitch00 committed Feb 29, 2016
2 parents fcf3ce6 + 5ff0506 commit 9303528
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addons/xeh/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ class Extended_WeaponAssembled_EventHandlers {};
class Extended_WeaponDisassembled_EventHandlers {};

// display xeh
class Extended_DisplayLoad_EventHandlers {};
class Extended_DisplayLoad_EventHandlers {
class RscDisplayInterrupt {
GVAR(3denFix) = QUOTE(call COMPILE_FILE(XEH_interruptDisplayLoad));
};
};
class Extended_DisplayUnload_EventHandlers {};
11 changes: 11 additions & 0 deletions addons/xeh/XEH_interruptDisplayLoad.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "script_component.hpp"

disableSerialization;

params ["_display"];

private _ctrl = _display displayCtrl 104;

if (ctrlText _ctrl == localize "STR_3DEN_RscDisplayInterrupt_ButtonAbort_3DEN_text") then {
_ctrl ctrlAddEventHandler ["buttonClick", {uiNamespace setVariable [QGVAR(3denFix), true]}];
};
6 changes: 6 additions & 0 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

// hack to fix 3den executing preInit unnecessarily when returning from a preview
if (uiNamespace getVariable [QGVAR(3denFix), false]) exitWith {
uiNamespace setVariable [QGVAR(3denFix), false];
diag_log text "[XEH]: 3den preview detected. Abort preInit.";
};

SLX_XEH_DisableLogging = uiNamespace getVariable ["SLX_XEH_DisableLogging", false]; // get from preStart

XEH_LOG("XEH: PreInit started. v" + getText (configFile >> "CfgPatches" >> "cba_common" >> "version") + ". " + PFORMAT_7("MISSIONINIT",missionName,worldName,isMultiplayer,isServer,isDedicated,hasInterface,didJIP));
Expand Down

0 comments on commit 9303528

Please sign in to comment.