From 579f6ea4008c2b0ceddd30fede9012b7bfb86ff5 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 22 Jan 2016 00:55:40 +0100 Subject: [PATCH 1/2] add CBA_fnc_createNamespace and CBA_fnc_deleteNamespace --- addons/common/CfgFunctions.hpp | 12 ++++++++++++ addons/common/CfgLocationTypes.hpp | 13 +++++++++++++ addons/common/config.cpp | 1 + addons/common/fnc_createNamespace.sqf | 24 ++++++++++++++++++++++++ addons/common/fnc_deleteNamespace.sqf | 25 +++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 addons/common/CfgLocationTypes.hpp create mode 100644 addons/common/fnc_createNamespace.sqf create mode 100644 addons/common/fnc_deleteNamespace.sqf diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index faa3588b3..22c945d99 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -87,6 +87,12 @@ class CfgFunctions description = "Creates a marker all at once."; file = "\x\cba\addons\common\fnc_createMarker.sqf"; }; + // CBA_fnc_createNamespace + class createNamespace + { + description = "Creates a namespace. Used to store and read variables via setVariable and getVariable."; + file = "\x\cba\addons\common\fnc_createNamespace.sqf"; + }; // CBA_fnc_createTrigger class createTrigger { @@ -105,6 +111,12 @@ class CfgFunctions description = "A function used to delete entities"; file = "\x\cba\addons\common\fnc_deleteEntity.sqf"; }; + // CBA_fnc_deleteNamespace + class deleteNamespace + { + description = "Deletes a namespace created with CBA_fnc_createNamespace."; + file = "\x\cba\addons\common\fnc_deleteNamespace.sqf"; + }; // CBA_fnc_determineMuzzles class determineMuzzles { diff --git a/addons/common/CfgLocationTypes.hpp b/addons/common/CfgLocationTypes.hpp new file mode 100644 index 000000000..d4a424861 --- /dev/null +++ b/addons/common/CfgLocationTypes.hpp @@ -0,0 +1,13 @@ + +class CfgLocationTypes { + class CBA_NamespaceDummy { + name = ""; + drawStyle = "name"; + texture = ""; + color[] = {0,0,0,0}; + size = 0; + textSize = 0; + shadow = 0; + font = "PuristaMedium"; + }; +}; diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 7801eeb5f..7004eeb55 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -16,6 +16,7 @@ class CfgPatches { #include "CfgFunctions.hpp" #include "CfgPerFrame.hpp" #include "CfgRemoteExec.hpp" +#include "CfgLocationTypes.hpp" class CBA_DirectCall { class dummy; diff --git a/addons/common/fnc_createNamespace.sqf b/addons/common/fnc_createNamespace.sqf new file mode 100644 index 000000000..8185afbab --- /dev/null +++ b/addons/common/fnc_createNamespace.sqf @@ -0,0 +1,24 @@ +/* ---------------------------------------------------------------------------- +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. + +Parameters: + None + +Returns: + _namespace - a namespace + +Examples: + (begin example) + _namespace = call CBA_fnc_createNamespace; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" + +createLocation ["CBA_NamespaceDummy", [-1000, -1000, 0], 0, 0] diff --git a/addons/common/fnc_deleteNamespace.sqf b/addons/common/fnc_deleteNamespace.sqf new file mode 100644 index 000000000..c4cbe2f21 --- /dev/null +++ b/addons/common/fnc_deleteNamespace.sqf @@ -0,0 +1,25 @@ +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_deleteNamespace + +Description: + Deletes a namespace created with CBA_fnc_createNamespace. + +Parameters: + _namespace - a namespace + +Returns: + None + +Examples: + (begin example) + _namespace call CBA_fnc_deleteNamespace; + (end) + +Author: + commy2 +---------------------------------------------------------------------------- */ +#include "script_component.hpp" + +params [["_namespace", locationNull, [locationNull]]]; + +deleteLocation _namespace; From ba97fbd16a705737cef5b29f332e4f803e1f3c9d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 13 Feb 2016 11:16:12 +0100 Subject: [PATCH 2/2] add SCRIPT() macros --- addons/common/fnc_createNamespace.sqf | 1 + addons/common/fnc_deleteNamespace.sqf | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/common/fnc_createNamespace.sqf b/addons/common/fnc_createNamespace.sqf index 8185afbab..5dbc5cd7e 100644 --- a/addons/common/fnc_createNamespace.sqf +++ b/addons/common/fnc_createNamespace.sqf @@ -20,5 +20,6 @@ Author: commy2 ---------------------------------------------------------------------------- */ #include "script_component.hpp" +SCRIPT(createNamespace); createLocation ["CBA_NamespaceDummy", [-1000, -1000, 0], 0, 0] diff --git a/addons/common/fnc_deleteNamespace.sqf b/addons/common/fnc_deleteNamespace.sqf index c4cbe2f21..8ed1d53b3 100644 --- a/addons/common/fnc_deleteNamespace.sqf +++ b/addons/common/fnc_deleteNamespace.sqf @@ -19,6 +19,7 @@ Author: commy2 ---------------------------------------------------------------------------- */ #include "script_component.hpp" +SCRIPT(deleteNamespace); params [["_namespace", locationNull, [locationNull]]];