Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always re-run preInit on mission load/new #685

Merged
merged 2 commits into from
May 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions addons/xeh/fnc_initDisplay3DEN.sqf
Original file line number Diff line number Diff line change
@@ -1,21 +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}];

// switching terrains in 3den will reset missionNamespace
add3DENEventHandler ["OnTerrainNew", {[] call CBA_fnc_preInit}];

private _fnc_preInitMissionConfig = {
{
if (_x select 0 == "" && {_x select 1 == "preInit"}) then {
[] call (_x select 2);
};
} forEach (missionConfigFile call CBA_fnc_compileEventHandlers);
private _fnc_watchDog = {
if (!ISPROCESSED(missionNamespace)) then {
diag_log text format ["XEH: missionNamespace processed [%1]", ISPROCESSED(missionNamespace)];
Copy link
Contributor

Choose a reason for hiding this comment

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

ISPROCESSED(missionNamespace) is always false, because that is the condition of the if.

[] call CBA_fnc_preInit;
};
};

add3DENEventHandler ["OnMissionNew", _fnc_preInitMissionConfig];
add3DENEventHandler ["OnMissionLoad", _fnc_preInitMissionConfig];
_display displayAddEventHandler ["MouseMoving", _fnc_watchDog];
_display displayAddEventHandler ["MouseHolding", _fnc_watchDog];