From a4a83c4a08ca142e70e5ea9627caedb795c8087c Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 2 Mar 2017 23:59:09 +0100 Subject: [PATCH] add CBA_fnc_allNamespaces (#608) * add CBA_fnc_allNamespaces * clarify types in function header --- addons/common/CfgFunctions.hpp | 1 + addons/common/fnc_allNamespaces.sqf | 24 ++++++++++++++++++++++++ addons/common/fnc_createNamespace.sqf | 4 +--- addons/common/script_component.hpp | 2 ++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 addons/common/fnc_allNamespaces.sqf diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index 954b51908..03f2c6565 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -114,6 +114,7 @@ class CfgFunctions { PATHTO_FNC(removePlayerAction); PATHTO_FNC(createNamespace); PATHTO_FNC(deleteNamespace); + PATHTO_FNC(allNamespaces); PATHTO_FNC(directCall); PATHTO_FNC(objectRandom); PATHTO_FNC(execNextFrame); diff --git a/addons/common/fnc_allNamespaces.sqf b/addons/common/fnc_allNamespaces.sqf new file mode 100644 index 000000000..9fa05938d --- /dev/null +++ b/addons/common/fnc_allNamespaces.sqf @@ -0,0 +1,24 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_allNamespaces + +Description: + Reports namespaces created with CBA_fnc_createNamespace. + +Parameters: + None + +Returns: + _namespaces - all custom namespaces + +Examples: + (begin example) + _namespaces = call CBA_fnc_allNamespaces; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" +SCRIPT(allNamespaces); + +nearestLocations [DUMMY_POSITION, ["CBA_NamespaceDummy"], 1] + nearestObjects [DUMMY_POSITION, ["CBA_NamespaceDummy"], 1] diff --git a/addons/common/fnc_createNamespace.sqf b/addons/common/fnc_createNamespace.sqf index dfcc8dc61..7daae3509 100644 --- a/addons/common/fnc_createNamespace.sqf +++ b/addons/common/fnc_createNamespace.sqf @@ -4,7 +4,7 @@ Function: CBA_fnc_createNamespace Description: Creates a namespace. Used to store and read variables via setVariable and getVariable. - The Namespace is destroyed after the mission ends. getVariable ARRAY is not supported. + The Namespace is destroyed after the mission ends. Parameters: _isGlobal - create a global namespace (optional, default: false) @@ -26,8 +26,6 @@ Author: #include "script_component.hpp" SCRIPT(createNamespace); -#define DUMMY_POSITION [-1000, -1000, 0] - params [["_isGlobal", false]]; if (_isGlobal isEqualTo true) then { diff --git a/addons/common/script_component.hpp b/addons/common/script_component.hpp index 32ce786be..3018585f6 100644 --- a/addons/common/script_component.hpp +++ b/addons/common/script_component.hpp @@ -11,3 +11,5 @@ #endif #include "\x\cba\addons\main\script_macros.hpp" + +#define DUMMY_POSITION [-1000, -1000, 0]