mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Use CBA Versioning System properly (#7173)
* Use CBA Versioning System properly * Update CBA include to CBA v3.12.2 + excessive concatenation cleanup
This commit is contained in:
parent
5dbaef4e07
commit
2d0c61a874
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
#include "script_version.hpp"
|
#include "script_version.hpp"
|
||||||
|
|
||||||
#define VERSION MAJOR.MINOR.PATCHLVL.BUILD
|
#define VERSION MAJOR.MINOR
|
||||||
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
|
#define VERSION_STR MAJOR.MINOR.PATCHLVL.BUILD
|
||||||
|
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
|
||||||
|
|
||||||
// MINIMAL required version for the Mod. Components can specify others..
|
// MINIMAL required version for the Mod. Components can specify others..
|
||||||
#define REQUIRED_VERSION 1.94
|
#define REQUIRED_VERSION 1.94
|
||||||
|
@ -51,21 +51,55 @@
|
|||||||
#define MAINLOGIC main
|
#define MAINLOGIC main
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ADDON DOUBLES(PREFIX,COMPONENT)
|
||||||
|
#define MAIN_ADDON DOUBLES(PREFIX,main)
|
||||||
|
|
||||||
|
/* -------------------------------------------
|
||||||
|
Macro: VERSION_CONFIG
|
||||||
|
Define CBA Versioning System config entries.
|
||||||
|
|
||||||
|
VERSION should be a floating-point number (1 separator).
|
||||||
|
VERSION_STR is a string representation of the version.
|
||||||
|
VERSION_AR is an array representation of the version.
|
||||||
|
|
||||||
|
VERSION must always be defined, otherwise it is 0.
|
||||||
|
VERSION_STR and VERSION_AR default to VERSION if undefined.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
None
|
||||||
|
|
||||||
|
Example:
|
||||||
|
(begin example)
|
||||||
|
#define VERSION 1.0
|
||||||
|
#define VERSION_STR 1.0.1
|
||||||
|
#define VERSION_AR 1,0,1
|
||||||
|
|
||||||
|
class CfgPatches {
|
||||||
|
class MyMod_main {
|
||||||
|
VERSION_CONFIG;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
(end)
|
||||||
|
|
||||||
|
Author:
|
||||||
|
?, Jonpas
|
||||||
|
------------------------------------------- */
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
#define VERSION 0
|
#define VERSION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef VERSION_STR
|
||||||
|
#define VERSION_STR VERSION
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef VERSION_AR
|
#ifndef VERSION_AR
|
||||||
#define VERSION_AR VERSION
|
#define VERSION_AR VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VERSION_CONFIG
|
#ifndef VERSION_CONFIG
|
||||||
#define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION); versionAr[] = {VERSION_AR}
|
#define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION_STR); versionAr[] = {VERSION_AR}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ADDON DOUBLES(PREFIX,COMPONENT)
|
|
||||||
#define MAIN_ADDON DOUBLES(PREFIX,main)
|
|
||||||
|
|
||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
Group: Debugging
|
Group: Debugging
|
||||||
------------------------------------------- */
|
------------------------------------------- */
|
||||||
@ -775,7 +809,7 @@ Author:
|
|||||||
|
|
||||||
// This only works for binarized configs after recompiling the pbos
|
// This only works for binarized configs after recompiling the pbos
|
||||||
// TODO: Reduce amount of calls / code..
|
// TODO: Reduce amount of calls / code..
|
||||||
#define COMPILE_FILE2_CFG_SYS(var1) compile preProcessFileLineNumbers var1
|
#define COMPILE_FILE2_CFG_SYS(var1) compile preprocessFileLineNumbers var1
|
||||||
#define COMPILE_FILE2_SYS(var1) COMPILE_FILE2_CFG_SYS(var1)
|
#define COMPILE_FILE2_SYS(var1) COMPILE_FILE2_CFG_SYS(var1)
|
||||||
|
|
||||||
#define COMPILE_FILE_SYS(var1,var2,var3) COMPILE_FILE2_SYS('PATHTO_SYS(var1,var2,var3)')
|
#define COMPILE_FILE_SYS(var1,var2,var3) COMPILE_FILE2_SYS('PATHTO_SYS(var1,var2,var3)')
|
||||||
@ -785,13 +819,13 @@ Author:
|
|||||||
#define SETVARMAINS(var1) SETVARS(var1,MAINLOGIC)
|
#define SETVARMAINS(var1) SETVARS(var1,MAINLOGIC)
|
||||||
#define GVARMAINS(var1,var2) var1##_##var2
|
#define GVARMAINS(var1,var2) var1##_##var2
|
||||||
#define CFGSETTINGSS(var1,var2) configFile >> "CfgSettings" >> #var1 >> #var2
|
#define CFGSETTINGSS(var1,var2) configFile >> "CfgSettings" >> #var1 >> #var2
|
||||||
//#define SETGVARS(var1,var2,var3) ##var1##_##var2##_##var3 =
|
//#define SETGVARS(var1,var2,var3) var1##_##var2##_##var3 =
|
||||||
//#define SETGVARMAINS(var1,var2) ##var1##_##var2 =
|
//#define SETGVARMAINS(var1,var2) var1##_##var2 =
|
||||||
|
|
||||||
// Compile-Once, JIT: On first use.
|
// Compile-Once, JIT: On first use.
|
||||||
// #define PREPMAIN_SYS(var1,var2,var3) ##var1##_fnc_##var3 = { ##var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call ##var1##_fnc_##var3 } else { _this call ##var1##_fnc_##var3 } }
|
// #define PREPMAIN_SYS(var1,var2,var3) var1##_fnc_##var3 = { var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call var1##_fnc_##var3 } else { _this call var1##_fnc_##var3 } }
|
||||||
// #define PREP_SYS(var1,var2,var3) ##var1##_##var2##_fnc_##var3 = { ##var1##_##var2##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call ##var1##_##var2##_fnc_##var3 } else { _this call ##var1##_##var2##_fnc_##var3 } }
|
// #define PREP_SYS(var1,var2,var3) var1##_##var2##_fnc_##var3 = { var1##_##var2##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call var1##_##var2##_fnc_##var3 } else { _this call var1##_##var2##_fnc_##var3 } }
|
||||||
// #define PREP_SYS2(var1,var2,var3,var4) ##var1##_##var2##_fnc_##var4 = { ##var1##_##var2##_fnc_##var4 = COMPILE_FILE_SYS(var1,var3,DOUBLES(fnc,var4)); if (isNil "_this") then { call ##var1##_##var2##_fnc_##var4 } else { _this call ##var1##_##var2##_fnc_##var4 } }
|
// #define PREP_SYS2(var1,var2,var3,var4) var1##_##var2##_fnc_##var4 = { var1##_##var2##_fnc_##var4 = COMPILE_FILE_SYS(var1,var3,DOUBLES(fnc,var4)); if (isNil "_this") then { call var1##_##var2##_fnc_##var4 } else { _this call var1##_##var2##_fnc_##var4 } }
|
||||||
|
|
||||||
// Compile-Once, at Macro. As opposed to Compile-Once, on first use.
|
// Compile-Once, at Macro. As opposed to Compile-Once, on first use.
|
||||||
#define PREPMAIN_SYS(var1,var2,var3) var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3))
|
#define PREPMAIN_SYS(var1,var2,var3) var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3))
|
||||||
@ -890,6 +924,39 @@ Author:
|
|||||||
#define SETVARMAIN SETVARMAINS(PREFIX)
|
#define SETVARMAIN SETVARMAINS(PREFIX)
|
||||||
#define IFCOUNT(var1,var2,var3) if (count var1 > var2) then { var3 = var1 select var2 };
|
#define IFCOUNT(var1,var2,var3) if (count var1 > var2) then { var3 = var1 select var2 };
|
||||||
|
|
||||||
|
/* -------------------------------------------
|
||||||
|
Macro: PREP()
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Defines a function.
|
||||||
|
|
||||||
|
Full file path:
|
||||||
|
'\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_<FNC>.sqf'
|
||||||
|
|
||||||
|
Resulting function name:
|
||||||
|
'PREFIX_COMPONENT_<FNC>'
|
||||||
|
|
||||||
|
The PREP macro should be placed in a script run by a XEH preStart and XEH preInit event.
|
||||||
|
|
||||||
|
The PREP macro allows for CBA function caching, which drastically speeds up load times.
|
||||||
|
Beware though that function caching is enabled by default and as such to disable it, you need to
|
||||||
|
#define DISABLE_COMPILE_CACHE above your #include "script_components.hpp" include!
|
||||||
|
|
||||||
|
The function will be defined in ui and mission namespace. It can not be overwritten without
|
||||||
|
a mission restart.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
FUNCTION NAME - Name of the function, unquoted <STRING>
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
(begin example)
|
||||||
|
PREP(banana);
|
||||||
|
call FUNC(banana);
|
||||||
|
(end)
|
||||||
|
|
||||||
|
Author:
|
||||||
|
dixon13
|
||||||
|
------------------------------------------- */
|
||||||
//#define PREP(var1) PREP_SYS(PREFIX,COMPONENT_F,var1)
|
//#define PREP(var1) PREP_SYS(PREFIX,COMPONENT_F,var1)
|
||||||
|
|
||||||
#ifdef DISABLE_COMPILE_CACHE
|
#ifdef DISABLE_COMPILE_CACHE
|
||||||
@ -900,13 +967,6 @@ Author:
|
|||||||
#define PREPMAIN(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(PREFIX,fnc,var1)'] call SLX_XEH_COMPILE_NEW
|
#define PREPMAIN(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(PREFIX,fnc,var1)'] call SLX_XEH_COMPILE_NEW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RECOMPILE
|
|
||||||
#undef RECOMPILE
|
|
||||||
#define RECOMPILE recompile = 1
|
|
||||||
#else
|
|
||||||
#define RECOMPILE recompile = 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
Macro: PATHTO_FNC()
|
Macro: PATHTO_FNC()
|
||||||
|
|
||||||
@ -916,6 +976,7 @@ Description:
|
|||||||
Full file path in addons:
|
Full file path in addons:
|
||||||
'\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_<FNC>.sqf'
|
'\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_<FNC>.sqf'
|
||||||
Define 'RECOMPILE' to enable recompiling.
|
Define 'RECOMPILE' to enable recompiling.
|
||||||
|
Define 'SKIP_FUNCTION_HEADER' to skip adding function header.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
FUNCTION NAME - Name of the function, unquoted <STRING>
|
FUNCTION NAME - Name of the function, unquoted <STRING>
|
||||||
@ -936,8 +997,22 @@ Examples:
|
|||||||
Author:
|
Author:
|
||||||
dixon13, commy2
|
dixon13, commy2
|
||||||
------------------------------------------- */
|
------------------------------------------- */
|
||||||
|
#ifdef RECOMPILE
|
||||||
|
#undef RECOMPILE
|
||||||
|
#define RECOMPILE recompile = 1
|
||||||
|
#else
|
||||||
|
#define RECOMPILE recompile = 0
|
||||||
|
#endif
|
||||||
|
// Set function header type: -1 - no header; 0 - default header; 1 - system header.
|
||||||
|
#ifdef SKIP_FUNCTION_HEADER
|
||||||
|
#define CFGFUNCTION_HEADER headerType = -1
|
||||||
|
#else
|
||||||
|
#define CFGFUNCTION_HEADER headerType = 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PATHTO_FNC(func) class func {\
|
#define PATHTO_FNC(func) class func {\
|
||||||
file = QPATHTOF(DOUBLES(fnc,func).sqf);\
|
file = QPATHTOF(DOUBLES(fnc,func).sqf);\
|
||||||
|
CFGFUNCTION_HEADER;\
|
||||||
RECOMPILE;\
|
RECOMPILE;\
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,6 +1161,7 @@ Author:
|
|||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
Macro: SCRIPT()
|
Macro: SCRIPT()
|
||||||
Sets name of script (relies on PREFIX and COMPONENT values being #defined).
|
Sets name of script (relies on PREFIX and COMPONENT values being #defined).
|
||||||
|
Define 'SKIP_SCRIPT_NAME' to skip adding scriptName.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
NAME - Name of script [Indentifier]
|
NAME - Name of script [Indentifier]
|
||||||
@ -1098,8 +1174,11 @@ Example:
|
|||||||
Author:
|
Author:
|
||||||
Spooner
|
Spooner
|
||||||
------------------------------------------- */
|
------------------------------------------- */
|
||||||
#define SCRIPT(NAME) \
|
#ifndef SKIP_SCRIPT_NAME
|
||||||
scriptName 'PREFIX\COMPONENT\NAME'
|
#define SCRIPT(NAME) scriptName 'PREFIX\COMPONENT\NAME'
|
||||||
|
#else
|
||||||
|
#define SCRIPT(NAME) /* nope */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* -------------------------------------------
|
/* -------------------------------------------
|
||||||
Macros: EXPLODE_n()
|
Macros: EXPLODE_n()
|
||||||
|
Loading…
Reference in New Issue
Block a user