From 43c54d51e810d78d0eb1902dfcf243e9a0a2c873 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 2 Sep 2015 01:40:38 +0200 Subject: [PATCH 1/5] hide clock on map if no watch in inventory, #414 --- addons/map/functions/fnc_onDrawMap.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/map/functions/fnc_onDrawMap.sqf b/addons/map/functions/fnc_onDrawMap.sqf index bc147884e4..0c95e903e6 100644 --- a/addons/map/functions/fnc_onDrawMap.sqf +++ b/addons/map/functions/fnc_onDrawMap.sqf @@ -2,3 +2,8 @@ #include "script_component.hpp" ((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates); + +// hide time when no map in inventory +if (!isNull ACE_player) then { + ((_this select 0) displayCtrl 101) ctrlShow ("ItemWatch" in assignedItems ACE_player); +}; From 29efc13556657ba74e00357c09ef789f7c3dd7f2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 2 Sep 2015 01:59:07 +0200 Subject: [PATCH 2/5] hide clock, use eventhandler --- addons/map/XEH_postInitClient.sqf | 13 ++++++++++++- addons/map/functions/fnc_onDrawMap.sqf | 4 +--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index ef528d5233..b85d91bf16 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -98,4 +98,15 @@ call FUNC(determineZoom); }] call EFUNC(common,addEventHandler); }; }; -}] call EFUNC(common,addEventHandler); \ No newline at end of file +}] call EFUNC(common,addEventHandler); + +// hide clock on map if player has no watch +GVAR(hasWatch) = true; + +["playerInventoryChanged", { + if (isNull (_this select 0)) exitWith { + GVAR(hasWatch) = true; + }; + + GVAR(hasWatch) = "ItemWatch" in (_this select 1 select 17); +}] call ace_common_fnc_addEventhandler diff --git a/addons/map/functions/fnc_onDrawMap.sqf b/addons/map/functions/fnc_onDrawMap.sqf index 0c95e903e6..cc0824919a 100644 --- a/addons/map/functions/fnc_onDrawMap.sqf +++ b/addons/map/functions/fnc_onDrawMap.sqf @@ -4,6 +4,4 @@ ((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates); // hide time when no map in inventory -if (!isNull ACE_player) then { - ((_this select 0) displayCtrl 101) ctrlShow ("ItemWatch" in assignedItems ACE_player); -}; +((_this select 0) displayCtrl 101) ctrlShow GVAR(hasWatch); From 07ab7d1c35fc9d263a152c7b1816115c408b4dcf Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 2 Sep 2015 02:00:53 +0200 Subject: [PATCH 3/5] correct comment --- addons/map/functions/fnc_onDrawMap.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/map/functions/fnc_onDrawMap.sqf b/addons/map/functions/fnc_onDrawMap.sqf index cc0824919a..37ec5a7000 100644 --- a/addons/map/functions/fnc_onDrawMap.sqf +++ b/addons/map/functions/fnc_onDrawMap.sqf @@ -3,5 +3,5 @@ ((_this select 0) displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates); -// hide time when no map in inventory +// hide clock when no watch in inventory, or whatever never ever ((_this select 0) displayCtrl 101) ctrlShow GVAR(hasWatch); From 76bb2bd2b8e2942847bfcffcee08964d03c7b213 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 3 Sep 2015 13:37:36 +0200 Subject: [PATCH 4/5] replace function with FUNC macro --- addons/map/XEH_postInitClient.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index b85d91bf16..f832c89c7b 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -107,6 +107,5 @@ GVAR(hasWatch) = true; if (isNull (_this select 0)) exitWith { GVAR(hasWatch) = true; }; - GVAR(hasWatch) = "ItemWatch" in (_this select 1 select 17); -}] call ace_common_fnc_addEventhandler +}] call EFUNC(common,addEventHandler) From 6b7f84b297d9f6af0f1629b74ca5cc2c873efa50 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 3 Sep 2015 13:39:17 +0200 Subject: [PATCH 5/5] add missing ; --- addons/map/XEH_postInitClient.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index f832c89c7b..02800c2540 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -108,4 +108,4 @@ GVAR(hasWatch) = true; GVAR(hasWatch) = true; }; GVAR(hasWatch) = "ItemWatch" in (_this select 1 select 17); -}] call EFUNC(common,addEventHandler) +}] call EFUNC(common,addEventHandler);