From 5a370e9ed845f277c993d5473ceab8390546193e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 29 Nov 2024 20:48:49 +0100 Subject: [PATCH] added separating standard and extended game version numbers --- src/config.c | 2 +- src/files.c | 28 +++++++++++++++++----------- src/main.h | 7 ++++++- src/tape.c | 8 +++++--- src/tape.h | 2 ++ src/tools.c | 2 +- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/config.c b/src/config.c index be3a6271..8d007573 100644 --- a/src/config.c +++ b/src/config.c @@ -61,7 +61,7 @@ char *getVersionString(VersionType version) char *getProgramRealVersionString(void) { - return getVersionString(GAME_VERSION_ACTUAL); + return getVersionString(GAME_VERSION_ACTUAL_FULL); } char *getProgramVersionString(void) diff --git a/src/files.c b/src/files.c index 9c8cb98c..839d5fb5 100644 --- a/src/files.c +++ b/src/files.c @@ -9286,6 +9286,8 @@ static int LoadTape_VERS(File *file, int chunk_size, struct TapeInfo *tape) tape->file_version = getFileVersion(file); tape->game_version = getFileVersion(file); + tape->game_version_full = tape->game_version; + return chunk_size; } @@ -9328,6 +9330,8 @@ static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape) tape->engine_version = engine_version; else tape->engine_version = tape->game_version; + + tape->engine_version_full = tape->engine_version; } return chunk_size; @@ -9335,8 +9339,8 @@ static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape) static int LoadTape_VERX(File *file, int chunk_size, struct TapeInfo *tape) { - tape->game_version |= getFileVersionExtended(file); - tape->engine_version |= getFileVersionExtended(file); + tape->game_version_full = tape->game_version | getFileVersionExtended(file); + tape->engine_version_full = tape->engine_version | getFileVersionExtended(file); return chunk_size; } @@ -9625,7 +9629,8 @@ void LoadTapeFromFilename(char *filename) } // pre-2.0 tape files have no game version, so use file version here - tape.game_version = tape.file_version; + tape.game_version = tape.file_version; + tape.game_version_full = tape.file_version; } if (tape.file_version < FILE_VERSION_1_2) @@ -9703,9 +9708,9 @@ void LoadTapeFromFilename(char *filename) Debug("files:LoadTapeFromFilename", "tape file version: %s", getVersionString(tape.file_version)); Debug("files:LoadTapeFromFilename", "tape game version: %s", - getVersionString(tape.game_version)); + getVersionString(tape.game_version_full)); Debug("files:LoadTapeFromFilename", "tape engine version: %s", - getVersionString(tape.engine_version)); + getVersionString(tape.engine_version_full)); #endif } @@ -9790,8 +9795,8 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape) static void SaveTape_VERX(FILE *file, struct TapeInfo *tape) { - putFileVersionExtended(file, tape->game_version); - putFileVersionExtended(file, tape->engine_version); + putFileVersionExtended(file, tape->game_version_full); + putFileVersionExtended(file, tape->engine_version_full); } static void SaveTape_SCRN(FILE *file, struct TapeInfo *tape) @@ -9889,8 +9894,9 @@ static void SaveTapeExt(char *filename) { int i; - tape.file_version = FILE_VERSION_ACTUAL; - tape.game_version = GAME_VERSION_ACTUAL; + tape.file_version = FILE_VERSION_ACTUAL; + tape.game_version = GAME_VERSION_ACTUAL; + tape.game_version_full = GAME_VERSION_ACTUAL_FULL; tape.num_participating_players = 0; @@ -9978,8 +9984,8 @@ void DumpTape(struct TapeInfo *tape) Print("Tape of level set '%s', level %03d\n", tape->level_identifier, tape->level_nr); Print("- tape date: %04d-%02d-%02d\n", year4, month, day); Print("- file version: %s\n", getVersionString(tape->file_version)); - Print("- game version: %s\n", getVersionString(tape->game_version)); - Print("- engine version: %s\n", getVersionString(tape->engine_version)); + Print("- game version: %s\n", getVersionString(tape->game_version_full)); + Print("- engine version: %s\n", getVersionString(tape->engine_version_full)); Print("- solution tape: %s\n", tape->solved ? "yes" : tape->game_version < VERSION_IDENT(4,3,2,3) ? "unknown" : "no"); diff --git a/src/main.h b/src/main.h index dfbf7812..615f6862 100644 --- a/src/main.h +++ b/src/main.h @@ -3174,7 +3174,12 @@ enum #define GAME_VERSION_2_0 FILE_VERSION_2_0 #define GAME_VERSION_3_0 FILE_VERSION_3_0 -#define GAME_VERSION_ACTUAL VERSION_IDENT_FULL(PROGRAM_VERSION_SUPER, \ +#define GAME_VERSION_ACTUAL VERSION_IDENT(PROGRAM_VERSION_SUPER, \ + PROGRAM_VERSION_MAJOR, \ + PROGRAM_VERSION_MINOR, \ + PROGRAM_VERSION_PATCH) + +#define GAME_VERSION_ACTUAL_FULL VERSION_IDENT_FULL(PROGRAM_VERSION_SUPER, \ PROGRAM_VERSION_MAJOR, \ PROGRAM_VERSION_MINOR, \ PROGRAM_VERSION_PATCH, \ diff --git a/src/tape.c b/src/tape.c index c6eeee4e..b99e9b10 100644 --- a/src/tape.c +++ b/src/tape.c @@ -718,9 +718,11 @@ void TapeErase(void) tape.random_seed = InitRND(level.random_seed); - tape.file_version = FILE_VERSION_ACTUAL; - tape.game_version = GAME_VERSION_ACTUAL; - tape.engine_version = level.game_version; + tape.file_version = FILE_VERSION_ACTUAL; + tape.game_version = GAME_VERSION_ACTUAL; + tape.game_version_full = GAME_VERSION_ACTUAL_FULL; + tape.engine_version = level.game_version; + tape.engine_version_full = level.game_version; tape.property_bits = TAPE_PROPERTY_NONE; diff --git a/src/tape.h b/src/tape.h index 1c909cd5..63f655b8 100644 --- a/src/tape.h +++ b/src/tape.h @@ -194,7 +194,9 @@ struct TapeInfo { VersionType file_version; // file format version the tape is stored with VersionType game_version; // game release version the tape was created with + VersionType game_version_full; // game release version the tape was created with (full) VersionType engine_version; // game engine version the tape was recorded with + VersionType engine_version_full; // game engine version the tape was recorded with (full) char score_tape_basename[MAX_FILENAME_LEN + 1]; char level_identifier[MAX_FILENAME_LEN + 1]; diff --git a/src/tools.c b/src/tools.c index 054ae399..f9275690 100644 --- a/src/tools.c +++ b/src/tools.c @@ -10690,7 +10690,7 @@ boolean useOldEngine_BD(void) return TRUE; // use old BD game engine if playing tapes from old 4.4.0.0 pre-release versions - if (tape.game_version < VERSION_IDENT_FULL(4,4,0,0, 0,4,0)) + if (tape.game_version_full < VERSION_IDENT_FULL(4,4,0,0, 0,4,0)) return TRUE; return FALSE; -- 2.34.1