From 38e08d513a91fe0c084ecfd2d8dfd575224961d2 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Sun, 2 Aug 2015 12:34:35 +0100 Subject: [PATCH] Clear spectator display variable at preInit uiNamespace persists between missions and should be reset on mission start --- addons/spectator/XEH_preInit.sqf | 2 ++ addons/spectator/functions/fnc_handleInterface.sqf | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index 2cc65602cc..a77d731478 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -38,6 +38,8 @@ GVAR(camUnit) = objNull; GVAR(camVision) = -2; GVAR(camZoom) = 1.25; +SETUVAR(GVAR(display),nil); + GVAR(showComp) = true; GVAR(showHelp) = true; GVAR(showIcons) = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 709c0263b2..2fa0d1439c 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -95,9 +95,7 @@ switch (toLower _mode) do { case "onload": { _args params ["_display"]; - with uiNamespace do { - GVAR(display) = _display; - }; + SETUVAR(GVAR(display),_display); // Always show interface and hide map upon opening [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); @@ -151,9 +149,7 @@ switch (toLower _mode) do { //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; }; case "onunload": { - with uiNamespace do { - GVAR(display) = nil; - }; + SETUVAR(GVAR(display),nil); GVAR(camHandler) = nil; GVAR(compHandler) = nil;