Move global static variables out of headers

A few headers had some global static varaibles declared in their headers which
is very bad.
This commit is contained in:
GravisZro 2024-05-28 17:46:31 -04:00
parent e74ba03986
commit b66821cfd6
5 changed files with 22 additions and 21 deletions

View File

@ -3585,6 +3585,19 @@ int SpecialFindDoorName(const char *name) {
return -1;
}
static inline char* GetCurrentSumString() {
static char output_buf[100];
output_buf[0] = '\0';
auto digest = Level_md5->digest();
char bytestr[10] = "";
// Do level checksum
for (int i = 0; i < 16; i++) {
snprintf(bytestr, sizeof(bytestr), "%.2x", digest[i]);
strcat(output_buf, bytestr);
}
return output_buf;
}
extern bool Disable_editor_rendering;
#define LEVEL_LOADED_PCT_CALC (filelen) ? (float)(chunk_size + chunk_start) / (float)filelen : 0.0f

View File

@ -733,16 +733,4 @@ inline void GetLevelMD5Sum(uint8_t digest[16]) {
}
Level_md5->digest(digest);
}
#include <string.h>
inline char *GetCurrentSumString() {
static char output_buf[100];
output_buf[0] = '\0';
auto digest = Level_md5->digest();
char bytestr[10] = "";
// Do level checksum
for (int i = 0; i < 16; i++) {
snprintf(bytestr, sizeof(bytestr), "%.2x", digest[i]);
strcat(output_buf, bytestr);
}
return output_buf;
}

View File

@ -315,6 +315,9 @@ void SGSSnapshot(CFILE *fp);
#define GAMESAVE_SLOT_Y2 110
#define GAMESAVE_SLOT_X 12
// we need this directory to load the savegame from
static char LGS_Path[_MAX_PATH];
extern int Times_game_restored;
// available for all.
int Quicksave_game_slot = -1;

View File

@ -186,9 +186,6 @@ int LoadGameState(const char *pathname);
#define gs_ReadInt(_f, _i) ((_i) = cf_ReadInt(_f))
#define gs_ReadFloat(_f, _fl) ((_fl) = cf_ReadFloat(_f))
// we need this directory to load the savegame from
static char LGS_Path[PSPATHNAME_LEN];
// writes out translation tables.
void SGSXlateTables(CFILE *fp);

View File

@ -134,11 +134,11 @@
#endif
// #define DEBUG_LEVEL 0 //DAJ
#if defined(WIN32) || defined(__LINUX__)
static const int OSMBOX_OK = 1;
static const int OSMBOX_YESNO = 2;
static const int OSMBOX_YESNOCANCEL = 3;
static const int OSMBOX_ABORTRETRYIGNORE = 4;
static const int OSMBOX_OKCANCEL = 5;
constexpr const int OSMBOX_OK = 1;
constexpr const int OSMBOX_YESNO = 2;
constexpr const int OSMBOX_YESNOCANCEL = 3;
constexpr const int OSMBOX_ABORTRETRYIGNORE = 4;
constexpr const int OSMBOX_OKCANCEL = 5;
#else
#define OSMBOX_OK 1
#define OSMBOX_YESNO 2