boolean pause state
authorMischa POSLAWSKY <netris@shiar.org>
Mon, 5 Mar 2007 10:44:55 +0000 (11:44 +0100)
committerMischa POSLAWSKY <netris@shiar.org>
Mon, 5 Mar 2007 10:44:55 +0000 (11:44 +0100)
client.c
server.c

index e3a2ffc8f63262a59854802d5856e75678276bda..344a4409091fe595feded89ad1d1a6890cabb6c9 100644 (file)
--- a/client.c
+++ b/client.c
@@ -73,7 +73,7 @@ static char *cmds[] = {
 };
 
 static char *hostStr;
-static int paused = 0;
+static bool paused = 0;
 static char lastadd;
 
 
@@ -251,8 +251,7 @@ void game_setpaused(void)
 
        paused = Game.started < 1;
        for (i = 1; i < MAX_SCREENS; i++) if (Players[i].alive > 0)
-               paused |= Players[i].flags & SCF_paused;
-       if (paused) paused = 1;
+               paused |= (Players[i].flags & SCF_paused) != 0;
 }
 
 void game_reset(void)
index 3d6652ac43118fb24fb4bf724a32ae9491b7d9fd..b30ba02a21e2bf3d4c424d646666e6964b973097 100644 (file)
--- a/server.c
+++ b/server.c
@@ -21,6 +21,7 @@
 #include "netris.h"
 
 #include <stdlib.h>
+#include <stdbool.h>
 #include <ctype.h>
 #include <string.h>
 #include <sys/types.h>
@@ -222,7 +223,7 @@ int StartServer(void)
        MyEvent event;
        netint2 currentpiece[MAX_SCREENS];
        int playersReady = 0;
-       int paused = 1;
+       bool paused = 1;
        int i;
        char teams[10][7] = {
                "", "Green", "Cyan", "Blue", "Purple",
@@ -360,10 +361,9 @@ int StartServer(void)
                                        paused = Game.started < 1;
                                        for (i = 1; i < MAX_SCREENS; i++)
                                                if (Players[i].alive > 0)
-                                                       paused |= Players[i].flags & SCF_paused;
+                                                       paused |= (Players[i].flags & SCF_paused) != 0;
                                        fprintf(stderr, "* Player #%d (un)paused (pause=%d)\n",
                                                event.u.net.sender, paused);
-                                       if (paused) paused = 1;
                                        goto sendtoall;
                                } //NP_pause
                                default: //relay data to all players