Merge pull request #43 from abalfoort/upd_defs

Update definitions according to CMakeLists.txt
This commit is contained in:
Yamagi 2024-03-16 12:17:34 +01:00 committed by GitHub
commit 24844dc176
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 22 deletions

View File

@ -61,12 +61,12 @@
* created on other systems or architectures. This will * created on other systems or architectures. This will
* crash q2 in spectacular ways * crash q2 in spectacular ways
*/ */
#ifndef YQ2_OSTYPE #ifndef YQ2OSTYPE
#error YQ2_OSTYPE should be defined by the build system #error YQ2OSTYPE should be defined by the build system
#endif #endif
#ifndef YQ2_ARCH #ifndef YQ2ARCH
#error YQ2_ARCH should be defined by the build system #error YQ2ARCH should be defined by the build system
#endif #endif
/* /*
@ -74,29 +74,29 @@
* macros, implemented by savegame version YQ2-1. * macros, implemented by savegame version YQ2-1.
*/ */
#if defined(__APPLE__) #if defined(__APPLE__)
#define OSTYPE_1 "MacOS X" #define YQ2OSTYPE_1 "MacOS X"
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#define OSTYPE_1 "FreeBSD" #define YQ2OSTYPE_1 "FreeBSD"
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
#define OSTYPE_1 "OpenBSD" #define YQ2OSTYPE_1 "OpenBSD"
#elif defined(__linux__) #elif defined(__linux__)
#define OSTYPE_1 "Linux" #define YQ2OSTYPE_1 "Linux"
#elif defined(_WIN32) #elif defined(_WIN32)
#define OSTYPE_1 "Windows" #define YQ2OSTYPE_1 "Windows"
#else #else
#define OSTYPE_1 "Unknown" #define YQ2OSTYPE_1 "Unknown"
#endif #endif
#if defined(__i386__) #if defined(__i386__)
#define ARCH_1 "i386" #define YQ2ARCH_1 "i386"
#elif defined(__x86_64__) #elif defined(__x86_64__)
#define ARCH_1 "amd64" #define YQ2ARCH_1 "amd64"
#elif defined(__sparc__) #elif defined(__sparc__)
#define ARCH_1 "sparc64" #define YQ2ARCH_1 "sparc64"
#elif defined(__ia64__) #elif defined(__ia64__)
#define ARCH_1 "ia64" #define YQ2ARCH_1 "ia64"
#else #else
#define ARCH_1 "unknown" #define YQ2ARCH_1 "unknown"
#endif #endif
/* /*
@ -771,8 +771,8 @@ WriteGame(const char *filename, qboolean autosave)
Q_strlcpy(sv.ver, SAVEGAMEVER, sizeof(sv.ver)); Q_strlcpy(sv.ver, SAVEGAMEVER, sizeof(sv.ver));
Q_strlcpy(sv.game, GAMEVERSION, sizeof(sv.game)); Q_strlcpy(sv.game, GAMEVERSION, sizeof(sv.game));
Q_strlcpy(sv.os, YQ2_OSTYPE, sizeof(sv.os) - 1); Q_strlcpy(sv.os, YQ2OSTYPE, sizeof(sv.os) - 1);
Q_strlcpy(sv.arch, YQ2_ARCH, sizeof(sv.arch)); Q_strlcpy(sv.arch, YQ2ARCH, sizeof(sv.arch));
fwrite(&sv, sizeof(sv), 1, f); fwrite(&sv, sizeof(sv), 1, f);
@ -846,7 +846,7 @@ ReadGame(const char *filename)
fclose(f); fclose(f);
gi.error("Savegame from another game.so.\n"); gi.error("Savegame from another game.so.\n");
} }
else if (strcmp(sv.os, OSTYPE_1) != 0) else if (strcmp(sv.os, YQ2OSTYPE_1) != 0)
{ {
fclose(f); fclose(f);
gi.error("Savegame from another os.\n"); gi.error("Savegame from another os.\n");
@ -860,7 +860,7 @@ ReadGame(const char *filename)
gi.error("Savegame from another architecture.\n"); gi.error("Savegame from another architecture.\n");
} }
#else #else
if (strcmp(sv.arch, ARCH_1) != 0) if (strcmp(sv.arch, YQ2ARCH_1) != 0)
{ {
fclose(f); fclose(f);
gi.error("Savegame from another architecture.\n"); gi.error("Savegame from another architecture.\n");
@ -874,16 +874,16 @@ ReadGame(const char *filename)
fclose(f); fclose(f);
gi.error("Savegame from another game.so.\n"); gi.error("Savegame from another game.so.\n");
} }
else if (strcmp(sv.os, YQ2_OSTYPE) != 0) else if (strcmp(sv.os, YQ2OSTYPE) != 0)
{ {
fclose(f); fclose(f);
gi.error("Savegame from another os.\n"); gi.error("Savegame from another os.\n");
} }
else if (strcmp(sv.arch, YQ2_ARCH) != 0) else if (strcmp(sv.arch, YQ2ARCH) != 0)
{ {
#if defined(_WIN32) && (defined(__i386__) || defined(_M_IX86)) #if defined(_WIN32) && (defined(__i386__) || defined(_M_IX86))
// before savegame version "YQ2-4" (and after version 1), // before savegame version "YQ2-4" (and after version 1),
// the official Win32 binaries accidentally had the YQ2_ARCH "AMD64" // the official Win32 binaries accidentally had the YQ2ARCH "AMD64"
// instead of "i386" set due to a bug in the Makefile. // instead of "i386" set due to a bug in the Makefile.
// This quirk allows loading those savegames anyway // This quirk allows loading those savegames anyway
if (save_ver >= 4 || strcmp(sv.arch, "AMD64") != 0) if (save_ver >= 4 || strcmp(sv.arch, "AMD64") != 0)