diff --git a/src/Config.cpp b/src/Config.cpp index 8a0c3411..f34be282 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -46,7 +46,7 @@ BOOL LoadConfigData(CONFIG *conf) fclose(fp); // Check if version is not correct, and return if it failed - if (strcmp(conf->proof, config_magic)) + if (strcmp(conf->proof, config_magic) != 0) { memset(conf, 0, sizeof(CONFIG)); return FALSE; diff --git a/src/Flags.cpp b/src/Flags.cpp index 5012397c..65bf3521 100644 --- a/src/Flags.cpp +++ b/src/Flags.cpp @@ -6,9 +6,9 @@ // Macros for setting, un-setting and getting flags // Each flag is stored in a bit, so we can use the exact same macros we'd use for bits -#define SET_FLAG(x, i) ((x)[(i) / 8] |= 1 << (i) % 8) -#define UNSET_FLAG(x, i) ((x)[(i) / 8] &= ~(1 << (i) % 8)) -#define GET_FLAG(x, i) ((x)[(i) / 8] & (1 << (i) % 8)) +#define SET_FLAG(x, i) ((x)[(i) / 8] |= 1 << ((i) % 8)) +#define UNSET_FLAG(x, i) ((x)[(i) / 8] &= ~(1 << ((i) % 8))) +#define GET_FLAG(x, i) ((x)[(i) / 8] & (1 << ((i) % 8))) unsigned char gFlagNPC[1000]; unsigned char gSkipFlag[8]; diff --git a/src/Map.cpp b/src/Map.cpp index e5eb0028..e5c03c7d 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -42,7 +42,7 @@ BOOL LoadMapData2(const char *path_map) char check[3]; fread(check, 1, 3, fp); - if (memcmp(check, code_pxma, 3)) + if (memcmp(check, code_pxma, 3) != 0) { fclose(fp); return FALSE; diff --git a/src/NpChar.cpp b/src/NpChar.cpp index d2e2e02d..8fbfadb5 100644 --- a/src/NpChar.cpp +++ b/src/NpChar.cpp @@ -69,7 +69,7 @@ BOOL LoadEvent(const char *path_event) // Read "PXE" check char code[4]; fread(code, 1, 4, fp); - if (memcmp(code, gPassPixEve, 3)) + if (memcmp(code, gPassPixEve, 3) != 0) { #ifdef FIX_BUGS // The original game forgot to close the file here diff --git a/src/Profile.cpp b/src/Profile.cpp index ebdc7566..69904304 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -137,7 +137,7 @@ BOOL LoadProfile(const char *name) // Check header code fread(profile.code, 8, 1, fp); - if (memcmp(profile.code, gProfileCode, 8)) + if (memcmp(profile.code, gProfileCode, 8) != 0) { #ifdef FIX_BUGS fclose(fp); // The original game forgets to close the file diff --git a/src/Stage.cpp b/src/Stage.cpp index fcdebc80..c3988b6b 100644 --- a/src/Stage.cpp +++ b/src/Stage.cpp @@ -250,7 +250,7 @@ MusicID gMusicNo; void ChangeMusic(MusicID no) { - if (no && no == gMusicNo) + if (no != MUS_SILENCE && no == gMusicNo) return; //Stop and keep track of old song diff --git a/src/TextScr.cpp b/src/TextScr.cpp index 423128eb..f48f5e29 100644 --- a/src/TextScr.cpp +++ b/src/TextScr.cpp @@ -33,7 +33,7 @@ #include "Stage.h" #include "Tags.h" -#define IS_COMMAND(c1, c2, c3) gTS.data[gTS.p_read + 1] == c1 && gTS.data[gTS.p_read + 2] == c2 && gTS.data[gTS.p_read + 3] == c3 +#define IS_COMMAND(c1, c2, c3) (gTS.data[gTS.p_read + 1] == (c1) && gTS.data[gTS.p_read + 2] == (c2) && gTS.data[gTS.p_read + 3] == (c3)) #define TSC_BUFFER_SIZE 0x5000