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

akash gangil gangil-guest at alioth.debian.org
Sun Jul 19 20:11:35 UTC 2009


Author: gangil-guest
Date: 2009-07-19 20:11:33 +0000 (Sun, 19 Jul 2009)
New Revision: 1234

Modified:
   tuxmath/branches/lan/server/server.c
   tuxmath/branches/lan/src/game.c
   tuxmath/branches/lan/src/highscore.c
   tuxmath/branches/lan/src/transtruct.h
Log:
clients startting at the same time , questions received by them are also same in their terminals, but this isnt reflected in their comets , syntax will be improved , once method works

Modified: tuxmath/branches/lan/server/server.c
===================================================================
--- tuxmath/branches/lan/server/server.c	2009-07-19 19:15:45 UTC (rev 1233)
+++ tuxmath/branches/lan/server/server.c	2009-07-19 20:11:33 UTC (rev 1234)
@@ -747,6 +747,15 @@
     }
   }
 
+ /***********************Will be modified**************/
+  snprintf(buf, NET_BUF_LEN, 
+          "%s\n",
+          "GO_TO_GAME");          
+  for(j = 0; j < num_clients; j++)
+   x = SDLNet_TCP_Send(client[j].sock, buf, sizeof(buf));   
+ /*****************************************************/
+
+
   /* If no players join the game (should not happen) */
   if(num_clients == 0)
   {

Modified: tuxmath/branches/lan/src/game.c
===================================================================
--- tuxmath/branches/lan/src/game.c	2009-07-19 19:15:45 UTC (rev 1233)
+++ tuxmath/branches/lan/src/game.c	2009-07-19 20:11:33 UTC (rev 1234)
@@ -557,7 +557,7 @@
   /* to use MC_StartUsingWrongs() */
   /* NOTE MC_StartGame() will return 0 if the list length is zero due */
   /* (for example) to all math operations being deselected */
-#ifdef HAVE_LIBSDL_NET
+/*#ifdef HAVE_LIBSDL_NET
   if (!LAN_StartGame())
   {
     fprintf(stderr, "\nLAN_StartGame() failed!");
@@ -571,7 +571,7 @@
     return 0;
   }
 #endif
-
+*/
   /* Allocate memory */
   comets = NULL;  // set in case allocation fails partway through
   cities = NULL;

Modified: tuxmath/branches/lan/src/highscore.c
===================================================================
--- tuxmath/branches/lan/src/highscore.c	2009-07-19 19:15:45 UTC (rev 1233)
+++ tuxmath/branches/lan/src/highscore.c	2009-07-19 20:11:33 UTC (rev 1234)
@@ -19,9 +19,9 @@
 #include "options.h"
 #include "SDL_extras.h"
 #include "convert_utf.h"
+#include "network.h"
 
 
-
 typedef struct high_score_entry {
   int score;
   char name[HIGH_SCORE_NAME_LENGTH];
@@ -751,15 +751,14 @@
   SDL_Rect loc;
   SDL_Rect TuxRect,
            stopRect;
+  char buf[NET_BUF_LEN];
 
   int finished = 0;
   int tux_frame = 0;
   Uint32 frame = 0;
   Uint32 start = 0;
-  const int BG_Y = 100;
-  const int BG_WIDTH = 400;
-  const int BG_HEIGHT = 200;
 
+
   sprite* Tux = LoadSprite("tux/bigtux", IMG_ALPHA);
 
 
@@ -846,7 +845,15 @@
         }
       }
     }
- 
+   while(!check_messages(buf))
+   {
+     if(strncmp(buf,"GO_TO_GAME",strlen("GO_TO_GAME"))==0)
+     {
+       finished = 1;
+       playsound(SND_TOCK);
+       break;
+     }     
+   }
     /* --- make tux blink --- */
     switch (frame % TUX6)
     {

Modified: tuxmath/branches/lan/src/transtruct.h
===================================================================
--- tuxmath/branches/lan/src/transtruct.h	2009-07-19 19:15:45 UTC (rev 1233)
+++ tuxmath/branches/lan/src/transtruct.h	2009-07-19 20:11:33 UTC (rev 1234)
@@ -14,7 +14,7 @@
 #ifndef TRANSTRUCT_H
 #define TRANSTRUCT_H
 
-//#define LAN_DEBUG
+#define LAN_DEBUG
 #define NET_BUF_LEN 512
 #define DEFAULT_PORT 4779
 #define NAME_SIZE 50




More information about the Tux4kids-commits mailing list