changed internal program versioning naming conventions
authorHolger Schemel <info@artsoft.org>
Thu, 12 Apr 2018 20:23:40 +0000 (22:23 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 12 Apr 2018 20:39:32 +0000 (22:39 +0200)
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).

src/config.c
src/game_mm/mm_main.h
src/libgame/misc.c
src/libgame/setup.c
src/libgame/system.c
src/libgame/system.h
src/main.c
src/main.h

index fe40a69769a255ebb20c146f78c67193887fd6df..eafadddcf3ad71d0ea0a7ccf6263e010818e6ce1 100644 (file)
@@ -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;
 }
index de3248ae774dd5e8fd3b8d77e2bc824229039c33..70758c2443a1ca77365e832682b75e889b04d358 100644 (file)
@@ -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:
index 06ded93686bbe9b672a182bd6ff86263921fd60e..d31ed248b7d4c9322da95812042ab6fcf14716d0 100644 (file)
@@ -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;
index bbfbe9c3d9063057f2d044e94e2401111705a550..bf02c2276e2a6a2f2227e993705fa64d26ad15f3 100644 (file)
@@ -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)
index 139ee57a562d6c2a046d7397c9df6e4d6c445e0e..f9f42fc8d84e8e12463628191103b89b5fd1854c 100644 (file)
@@ -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;
index f3da4ad15bf6d0b5a771638b78b0785a88578c86..c645089b6a3e91d49cce74042daa62280a2ee43d 100644 (file)
 
 
 /* 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;
index 670f5335bf3d06b44fa8bf50fe6fa05c1457bfd7..36cd516fb627d0c425581265c7421b4300c3063b 100644 (file)
@@ -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);
   }
 
index 8dc3374b3d296cc639b4e40fc1f26b86c67cd309..77c2677957f26a34347f1cf0536d8f540846358c 100644 (file)
 
 
 /* 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"
 #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