Skip to content

Commit

Permalink
Switch to watchdog to run preInit in 3den
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed May 17, 2017
1 parent 92a141d commit e7286f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 9 additions & 8 deletions addons/xeh/fnc_initDisplay3DEN.sqf
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "script_component.hpp"

// fix for preInit = 1 functions not being executed when entering 3den from main menu
[] call CBA_fnc_preInit;
params ["_display"];

// since 1.60, preInit = 1 functions aren't executed when returning from a preview either ...
add3DENEventHandler ["OnMissionPreviewEnd", {[] call CBA_fnc_preInit}];
private _fnc_watchDog = {
if (!ISPROCESSED(missionNamespace)) then {
diag_log text format ["XEH: missionNamespace processed [%1]", ISPROCESSED(missionNamespace)];
[] call CBA_fnc_preInit;
};
};

// switching terrains in 3den will reset missionNamespace
add3DENEventHandler ["OnTerrainNew", {[] call CBA_fnc_preInit}];
add3DENEventHandler ["OnMissionNew", {[] call CBA_fnc_preInit}];
add3DENEventHandler ["OnMissionLoad", {[] call CBA_fnc_preInit}];
_display displayAddEventHandler ["MouseMoving", _fnc_watchDog];
_display displayAddEventHandler ["MouseHolding", _fnc_watchDog];
2 changes: 0 additions & 2 deletions addons/xeh/fnc_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

diag_log text format ["XEH: missionNamespace processed [%1]", ISPROCESSED(missionNamespace)];

if (ISPROCESSED(missionNamespace)) exitWith {
diag_log text "[XEH]: preInit already executed. Abort preInit.";
};
Expand Down

0 comments on commit e7286f8

Please sign in to comment.