Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve VERSION_CONFIG #1221

Merged
merged 5 commits into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions addons/help/XEH_preStart.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ private _credits = [];

private _version = "";

if (isText (_x >> "version")) then {
_version = format [" v%1", getText (_x >> "version")];
if (isText (_x >> "versionStr")) then {
_version = format [" v%1", getText (_x >> "versionStr")];
} else {
if (isNumber (_x >> "version")) then {
_version = format [" v%1", getNumber (_x >> "version")];
} else {
if (isText (_x >> "version")) then {
_version = format [" v%1", getText (_x >> "version")];
};
};
};

private _author = getText (_x >> "author") call CBA_fnc_sanitizeHTML;
Expand Down
42 changes: 38 additions & 4 deletions addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,55 @@
#define MAINLOGIC main
#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
#define VERSION 0
#endif

#ifndef VERSION_STR
#define VERSION_STR VERSION
#endif

#ifndef VERSION_AR
#define VERSION_AR VERSION
#endif

#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

#define ADDON DOUBLES(PREFIX,COMPONENT)
#define MAIN_ADDON DOUBLES(PREFIX,main)

/* -------------------------------------------
Group: Debugging
------------------------------------------- */
Expand Down
5 changes: 3 additions & 2 deletions addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
// We will use the DATE for the BUILD# in the format YYMMDD - VM
#include "script_version.hpp"

#define VERSION MAJOR.MINOR.PATCHLVL.BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
#define VERSION MAJOR.MINOR
#define VERSION_STR MAJOR.MINOR.PATCHLVL.BUILD
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD

// MINIMAL required version for the Mod. Components can specify others..
#define REQUIRED_VERSION 1.94
Expand Down