From: Holger Schemel Date: Thu, 12 Apr 2018 20:23:40 +0000 (+0200) Subject: changed internal program versioning naming conventions X-Git-Tag: 4.1.1.0~198 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3e10387c490e2db8997d6e909d7d13d71fe876e3;p=rocksndiamonds.git changed internal program versioning naming conventions Before, program version numbers consisting of four parts were named "MAJOR.MINOR.PATCH.BUILD" internally. From now on, this will be named "SUPER.MAJOR.MINOR.PATCH" instead, because this better reflects how the four parts of the version numbers are really used nowadays. For the Mirror Magic game engine, "MAJOR.MINOR.PATCH" is still used internally, as there is no fourth part for the version number, so the names of these version number parts currently do not match the parts of the internal R'n'D version numbers with the same name, but parts 1, 2 and 3 (which would be "SUPER.MAJOR.MINOR" in R'n'D version numbers). --- diff --git a/src/config.c b/src/config.c index fe40a697..eafadddc 100644 --- a/src/config.c +++ b/src/config.c @@ -30,8 +30,8 @@ char *getProgramRealVersionString() static char program_version_string[32]; sprintf(program_version_string, "%d.%d.%d.%d%s", - PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH, - PROGRAM_VERSION_BUILD, PROGRAM_VERSION_EXTRA); + PROGRAM_VERSION_SUPER, PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, + PROGRAM_VERSION_PATCH, PROGRAM_VERSION_EXTRA); return program_version_string; } diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index de3248ae..70758c24 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -1176,9 +1176,9 @@ extern int num_element_info; /* functions for version handling */ #define MM_VERSION_IDENT(x,y,z) VERSION_IDENT(x,y,z,0) -#define MM_VERSION_MAJOR(x) VERSION_MAJOR(x) -#define MM_VERSION_MINOR(x) VERSION_MINOR(x) -#define MM_VERSION_PATCH(x) VERSION_PATCH(x) +#define MM_VERSION_MAJOR(x) VERSION_PART_1(x) +#define MM_VERSION_MINOR(x) VERSION_PART_2(x) +#define MM_VERSION_PATCH(x) VERSION_PART_3(x) /* file version numbers for resource files (levels, score, setup, etc.) ** currently supported/known file version numbers: diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 06ded936..d31ed248 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1442,28 +1442,28 @@ int putFileChunk(FILE *file, char *chunk_name, int chunk_size, int getFileVersion(File *file) { + int version_super = getByteFromFile(file); int version_major = getByteFromFile(file); int version_minor = getByteFromFile(file); int version_patch = getByteFromFile(file); - int version_build = getByteFromFile(file); - return VERSION_IDENT(version_major, version_minor, version_patch, - version_build); + return VERSION_IDENT(version_super, version_major, version_minor, + version_patch); } int putFileVersion(FILE *file, int version) { if (file != NULL) { + int version_super = VERSION_SUPER(version); int version_major = VERSION_MAJOR(version); int version_minor = VERSION_MINOR(version); int version_patch = VERSION_PATCH(version); - int version_build = VERSION_BUILD(version); + fputc(version_super, file); fputc(version_major, file); fputc(version_minor, file); fputc(version_patch, file); - fputc(version_build, file); } return 4; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index bbfbe9c3..bf02c227 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1575,7 +1575,7 @@ char *getCookie(char *file_type) sprintf(cookie, "%s_%s_FILE_VERSION_%d.%d", program.cookie_prefix, file_type, - program.version_major, program.version_minor); + program.version_super, program.version_major); return cookie; } @@ -1600,7 +1600,7 @@ int getFileVersionFromCookieString(const char *cookie) const int len_pattern1 = strlen(pattern1); const int len_pattern2 = strlen(pattern2); const int len_pattern = len_pattern1 + len_pattern2; - int version_major, version_minor; + int version_super, version_major; if (len_cookie <= len_pattern) return -1; @@ -1616,10 +1616,10 @@ int getFileVersionFromCookieString(const char *cookie) ptr_cookie2[2] < '0' || ptr_cookie2[2] > '9') return -1; - version_major = ptr_cookie2[0] - '0'; - version_minor = ptr_cookie2[2] - '0'; + version_super = ptr_cookie2[0] - '0'; + version_major = ptr_cookie2[2] - '0'; - return VERSION_IDENT(version_major, version_minor, 0, 0); + return VERSION_IDENT(version_super, version_major, 0, 0); } boolean checkCookieString(const char *cookie, const char *template) diff --git a/src/libgame/system.c b/src/libgame/system.c index 139ee57a..f9f42fc8 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -87,10 +87,10 @@ void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir, program.cookie_prefix = cookie_prefix; + program.version_super = VERSION_SUPER(program_version); program.version_major = VERSION_MAJOR(program_version); program.version_minor = VERSION_MINOR(program_version); program.version_patch = VERSION_PATCH(program_version); - program.version_build = VERSION_BUILD(program_version); program.version_ident = program_version; program.version_string = program_version_string; diff --git a/src/libgame/system.h b/src/libgame/system.h index f3da4ad1..c645089b 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -596,10 +596,15 @@ /* macros for version handling */ -#define VERSION_MAJOR(x) ((x) / 1000000) -#define VERSION_MINOR(x) (((x) % 1000000) / 10000) -#define VERSION_PATCH(x) (((x) % 10000) / 100) -#define VERSION_BUILD(x) ((x) % 100) +#define VERSION_PART_1(x) ((x) / 1000000) +#define VERSION_PART_2(x) (((x) % 1000000) / 10000) +#define VERSION_PART_3(x) (((x) % 10000) / 100) +#define VERSION_PART_4(x) ((x) % 100) + +#define VERSION_SUPER(x) VERSION_PART_1(x) +#define VERSION_MAJOR(x) VERSION_PART_2(x) +#define VERSION_MINOR(x) VERSION_PART_3(x) +#define VERSION_PATCH(x) VERSION_PART_4(x) #define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d)) @@ -780,10 +785,10 @@ struct ProgramInfo FILE *log_file[NUM_LOGS]; /* log file handles for out/err files */ FILE *log_file_default[NUM_LOGS]; /* default log file handles (out/err) */ + int version_super; int version_major; int version_minor; int version_patch; - int version_build; int version_ident; char *version_string; diff --git a/src/main.c b/src/main.c index 670f5335..36cd516f 100644 --- a/src/main.c +++ b/src/main.c @@ -7635,10 +7635,10 @@ static void print_version() { Print(" (%s %d.%d.%d.%d%s)", PROGRAM_TITLE_STRING, + PROGRAM_VERSION_SUPER, PROGRAM_VERSION_MAJOR, PROGRAM_VERSION_MINOR, PROGRAM_VERSION_PATCH, - PROGRAM_VERSION_BUILD, PROGRAM_VERSION_EXTRA); } diff --git a/src/main.h b/src/main.h index 8dc3374b..77c26779 100644 --- a/src/main.h +++ b/src/main.h @@ -2513,10 +2513,10 @@ /* program information and versioning definitions */ -#define PROGRAM_VERSION_MAJOR 4 -#define PROGRAM_VERSION_MINOR 1 -#define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 1 +#define PROGRAM_VERSION_SUPER 4 +#define PROGRAM_VERSION_MAJOR 1 +#define PROGRAM_VERSION_MINOR 0 +#define PROGRAM_VERSION_PATCH 1 #define PROGRAM_VERSION_EXTRA "" #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" @@ -2556,10 +2556,10 @@ #define GAME_VERSION_2_0 FILE_VERSION_2_0 #define GAME_VERSION_3_0 FILE_VERSION_3_0 -#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_MAJOR, \ +#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_SUPER, \ + PROGRAM_VERSION_MAJOR, \ PROGRAM_VERSION_MINOR, \ - PROGRAM_VERSION_PATCH, \ - PROGRAM_VERSION_BUILD) + PROGRAM_VERSION_PATCH) /* values for game_emulation */ #define EMU_NONE 0