]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/flags.h
Fixed a couple bugs, and added Change history and TODO stuff
[irc/gameservirc.git] / gameserv / flags.h
index 2b6067f520e834ef09f896ed34d591cf200c0c61..cf546afd266165d11eeb0e92a3e377475c320712 100644 (file)
  * can hold 8 spaces for flags. 8 spaces at 4 flags per space makes for
  * 32 possible flags for each long int. That means there are 32 flags available
  * for the aClient class, and 32 for the player class.
+ *
+ * Basically if you are having problems visualizing how flags work, think of them in
+ * binary terms:
+ *     Hex     Binary
+ *     0x0001  0001
+ *     0x0002  0010
+ *     0x0004  0100
+ *     0x0008  1000
+ *     Basically, each flag represents a 1. When you add the different flags, you are just
+ *     adding a 1 in the given position. So 1001 would be 0x0009 or flags 0001 and 0008.
  */
 
 // aClient FLAGS ONLY
 #define FLAG_ADMIN 0x0001
 
-
 // PLAYER FLAGS ONLY
-#define FLAG_MASTER 0x0001
-
-
+#define FLAG_MASTER            0x0001
+#define FLAG_ALIVE             0x0002
+#define FLAG_YOURTURN          0x0004
+#define FLAG_WONGAME           0x0008
 
 
 // aClient flags
 
 
 // Player Flags
-#define seenMaster(x)  ((x)->getFlags() & FLAG_MASTER)
-#define setMaster(x)   ((x)->addFlag(FLAG_MASTER))
-#define clearMaster(x) ((x)->remFlag(FLAG_MASTER))
+#define seenMaster(x)          ((x)->getFlags() & FLAG_MASTER)
+#define setMaster(x)           ((x)->addFlag(FLAG_MASTER))
+#define clearMaster(x)         ((x)->remFlag(FLAG_MASTER))
+
+#define isAlive(x)             ((x)->getFlags() & FLAG_ALIVE)
+#define setAlive(x)            ((x)->addFlag(FLAG_ALIVE))
+#define clearAlive(x)          ((x)->remFlag(FLAG_ALIVE))
+
+#define isYourTurn(x)          ((x)->getFlags() & FLAG_YOURTURN)
+#define setYourTurn(x)         ((x)->addFlag(FLAG_YOURTURN))
+#define clearYourTurn(x)       ((x)->remFlag(FLAG_YOURTURN))
 
+#define hasWonGame(x)          ((x)->getFlags() & FLAG_WONGAME)
+#define setWonGame(x)          ((x)->addFlag(FLAG_WONGAME))
+#define clearWonGame(x)                ((x)->remFlag(FLAG_WONGAME))
 
 #endif