[Tux4kids-commits] r1232 - in tuxmath/branches/lan: server src

akash gangil gangil-guest at alioth.debian.org
Sun Jul 19 13:33:06 UTC 2009


Author: gangil-guest
Date: 2009-07-19 13:33:04 +0000 (Sun, 19 Jul 2009)
New Revision: 1232

Modified:
   tuxmath/branches/lan/server/server.c
   tuxmath/branches/lan/src/titlescreen.c
Log:
few modifications

Modified: tuxmath/branches/lan/server/server.c
===================================================================
--- tuxmath/branches/lan/server/server.c	2009-07-19 04:23:46 UTC (rev 1231)
+++ tuxmath/branches/lan/server/server.c	2009-07-19 13:33:04 UTC (rev 1232)
@@ -511,9 +511,17 @@
 
 void handle_client_nongame_msg(int i, char* buffer)
 {
+  char buf[NET_BUF_LEN];
+  int x;
   if(strncmp(buffer, "START_GAME", strlen("START_GAME")) == 0)
   {
     start_game(i);
+    client[i].game_ready = 1;
+    snprintf(buf, NET_BUF_LEN, 
+                  "%s",
+                  "Success");
+    x = SDLNet_TCP_Send(client[i].sock, buf, NET_BUF_LEN);
+        
   }
   else if(strncmp(buffer, "SET_NAME", strlen("SET_NAME")) == 0)
   {
@@ -718,7 +726,6 @@
   char buf[NET_BUF_LEN];
   char buffer[NET_BUF_LEN];
   int x,j;
-  game_in_progress = 1;  //setting the game_in_progress flag to '1'
   snprintf(buf, NET_BUF_LEN,
                 "Player %s added for next math game",
                 client[i].name);
@@ -736,17 +743,7 @@
     if((client[j].game_ready != 1)
     && (client[j].sock != NULL))
     {
-      if (SDLNet_TCP_Recv(client[j].sock, buffer, NET_BUF_LEN) > 0)
-      {
-        if(strncmp(buffer, "START_GAME", 10) == 0)
-        {
-          client[j].game_ready = 1;
-          snprintf(buf, NET_BUF_LEN, 
-                "%s\n",
-                "Success");
-          x = SDLNet_TCP_Send(client[j].sock, buf, NET_BUF_LEN);
-        }
-      }
+     return;      
     }
   }
 
@@ -762,6 +759,7 @@
 #endif
 
 
+  game_in_progress = 1;  //setting the game_in_progress flag to '1'
   //Start a new math game as far as mathcards is concerned:
   if (!MC_StartGame())
   {

Modified: tuxmath/branches/lan/src/titlescreen.c
===================================================================
--- tuxmath/branches/lan/src/titlescreen.c	2009-07-19 04:23:46 UTC (rev 1231)
+++ tuxmath/branches/lan/src/titlescreen.c	2009-07-19 13:33:04 UTC (rev 1232)
@@ -905,6 +905,7 @@
    }    
    LAN_SetName(player_name);
    Ready(_("Click OK when Ready"));
+   LAN_StartGame();
    Standby(_("Waiting For Other Players"),_("To Connect"));
    game();
    }   




More information about the Tux4kids-commits mailing list