ref: 7a3bea3c0afee85ec5d049aae7b2a4aa1782ed49
parent: 71015da19b825a3ab3b5db431f737b3fd2e97565
author: Gabriel Ravier <gabravier@gmail.com>
date: Wed May 8 04:34:22 EDT 2019
Change Flags.cpp to use macros Pixel probably did this tbh Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
--- a/src/Flags.cpp
+++ b/src/Flags.cpp
@@ -7,6 +7,10 @@
unsigned char gFlagNPC[1000];
unsigned char gSkipFlag[8];
+#define SET_BIT(x, i) ((x)[(i) / 8] |= 1 << (i) % 8;)
+#define UNSET_BIT(x, i) ((x)[(i) / 8] &= ~(1 << (i) % 8);)
+#define GET_BIT(x, i) ((x)[(i) / 8] & (1 << (i) % 8))
+
//Flag inits
void InitFlags()
{
@@ -21,17 +25,17 @@
//NPC flags
void SetNPCFlag(long a)
{
- gFlagNPC[a / 8] |= 1 << a % 8;
+ SET_BIT(gFlagNPC, a);
}
void CutNPCFlag(long a)
{
- gFlagNPC[a / 8] &= ~(1 << a % 8);
+ UNSET_BIT(gFlagNPC, a);
}
BOOL GetNPCFlag(long a)
{
- if (gFlagNPC[a / 8] & (1 << a % 8))
+ if (GET_BIT(gFlagNPC, a))
return TRUE;
else
return FALSE;
@@ -40,17 +44,17 @@
//Skip flags
void SetSkipFlag(long a)
{
- gSkipFlag[a / 8] |= 1 << a % 8;
+ SET_BIT(gSkipFlag, a);
}
void CutSkipFlag(long a)
{
- gSkipFlag[a / 8] &= ~(1 << a % 8);
+ UNSET_BIT(gSkipFlag, a);
}
BOOL GetSkipFlag(long a)
{
- if (gSkipFlag[a / 8] & (1 << a % 8))
+ if (GET_BIT(gSkipFlag, a))
return TRUE;
else
return FALSE;