diff --git a/addons/common/CfgFunctions.hpp b/addons/common/CfgFunctions.hpp index 476bdc683..5c4cac9fb 100644 --- a/addons/common/CfgFunctions.hpp +++ b/addons/common/CfgFunctions.hpp @@ -129,6 +129,7 @@ class CfgFunctions { PATHTO_FNC(deleteNamespace); PATHTO_FNC(allNamespaces); PATHTO_FNC(directCall); + PATHTO_FNC(getMacro); PATHTO_FNC(objectRandom); PATHTO_FNC(execNextFrame); PATHTO_FNC(execAfterNFrames); diff --git a/addons/common/fnc_getMacro.inc.sqf b/addons/common/fnc_getMacro.inc.sqf new file mode 100644 index 000000000..0dda80fae --- /dev/null +++ b/addons/common/fnc_getMacro.inc.sqf @@ -0,0 +1,44 @@ +switch (_this) do { + case "__DATE_ARR__": { [__DATE_ARR__] }; // [2024,11,10,16,19,39] + case "__DATE_STR__": { __DATE_STR__ }; // "2024/11/10, 16:19:39" + case "__DATE_STR_ISO8601__": { __DATE_STR_ISO8601__ }; // "2024-11-10T22:19:39Z" + case "__TIME__": { '__TIME__' }; // 16:19:39 (quoted because invalid number) + case "__TIME_UTC__": { '__TIME_UTC__' }; // 22:19:39 + case "__TIMESTAMP_UTC__": { '__TIMESTAMP_UTC__' }; // 1731277179 (quoted because float will not have precision for 32+ bits) + case "__DAY__": { __DAY__ }; // 10 + case "__MONTH__": { __MONTH__ }; // 11 + case "__YEAR__": { __YEAR__ }; // 2024 + case "__GAME_VER__": { '__GAME_VER__' }; // 2.18.152302 (quoted because invalid number) + case "__GAME_VER_MAJ__": { __GAME_VER_MAJ__ }; // 2 + case "__GAME_VER_MIN__": { __GAME_VER_MIN__ }; // 18 + case "__GAME_BUILD__": { __GAME_BUILD__ }; // 152302 + case "__A3_DIAG__": { + #if __A3_DIAG__ + true + #else + false + #endif + }; + case "__A3_DEBUG__": { + #if __A3_DEBUG__ + true + #else + false + #endif + }; + case "__A3_EXPERIMENTAL__": { + #if __A3_EXPERIMENTAL__ + true + #else + false + #endif + }; + case "__A3_PROFILING__": { + #if __A3_PROFILING__ + true + #else + false + #endif + }; + default { "ERROR-invalid macro"}; +} diff --git a/addons/common/fnc_getMacro.sqf b/addons/common/fnc_getMacro.sqf new file mode 100644 index 000000000..3576ff02c --- /dev/null +++ b/addons/common/fnc_getMacro.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* ---------------------------------------------------------------------------- +Function: CBA_fnc_getMacro + +Description: + Gets the value of special macros + +Parameters: + 0: Macro Name + +Returns: + None + +Examples: + (begin example) + "__DATE_ARR__" call CBA_fnc_getMacro; + (end) + +Author: + PabstMirror +---------------------------------------------------------------------------- */ + +params ["_macro"]; + +_macro call compileScript [QPATHTOF(fnc_getMacro.inc.sqf)]