[Tux4kids-commits] r1200 - tuxmath/branches/lan/src

akash gangil gangil-guest at alioth.debian.org
Tue Jul 14 08:10:11 UTC 2009


Author: gangil-guest
Date: 2009-07-14 08:10:10 +0000 (Tue, 14 Jul 2009)
New Revision: 1200

Modified:
   tuxmath/branches/lan/src/game.c
   tuxmath/branches/lan/src/network.c
   tuxmath/branches/lan/src/network.h
Log:
corrsponding changes to server , wrong answeres included

Modified: tuxmath/branches/lan/src/game.c
===================================================================
--- tuxmath/branches/lan/src/game.c	2009-07-14 07:59:49 UTC (rev 1199)
+++ tuxmath/branches/lan/src/game.c	2009-07-14 08:10:10 UTC (rev 1200)
@@ -1457,9 +1457,9 @@
       {
         /* Tell MathCards about it - question not answered correctly: */
         /* FIXME will need LAN_NotAnsweredCorrectly() here if using network */
-        MC_NotAnsweredCorrectly(&(comets[i].flashcard));
+        //MC_NotAnsweredCorrectly(&(comets[i].flashcard));
+          LAN_NotAnsweredCorrectly(&(comets[i].flashcard));
 
-
         /* Store the time the question was present on screen (do this */
         /* in a way that avoids storing it if the time wrapped around */
         ctime = SDL_GetTicks();

Modified: tuxmath/branches/lan/src/network.c
===================================================================
--- tuxmath/branches/lan/src/network.c	2009-07-14 07:59:49 UTC (rev 1199)
+++ tuxmath/branches/lan/src/network.c	2009-07-14 08:10:10 UTC (rev 1200)
@@ -333,10 +333,27 @@
   return 1;
 }
     
+int LAN_NotAnsweredCorrectly(MC_FlashCard* fc)
+{
+  int len;
+  char buffer[NET_BUF_LEN];
 
+  snprintf(buffer, NET_BUF_LEN, 
+                  "%s %d\n",
+                  "WRONG_ANSWER",
+                  fc->question_id);
+  len = strlen(buffer) + 1;
+  if (SDLNet_TCP_Send(sd, (void *)buffer, NET_BUF_LEN) < NET_BUF_LEN)
+  {
+    fprintf(stderr, "SDLNet_TCP_Send: %s\n", SDLNet_GetError());
+    exit(EXIT_FAILURE);
+  }
+  return 1;
+}
 
 
 
+
 /*This mainly is a network version of all the MathCards Functions
   MC_* that have integer as their return value*/
 /* Looks to me like it just sends "statement".  Again, when we send a  */

Modified: tuxmath/branches/lan/src/network.h
===================================================================
--- tuxmath/branches/lan/src/network.h	2009-07-14 07:59:49 UTC (rev 1199)
+++ tuxmath/branches/lan/src/network.h	2009-07-14 08:10:10 UTC (rev 1200)
@@ -29,7 +29,7 @@
 /* These functions are how the client tells things to the server: */
 int LAN_StartGame(void);
 int LAN_AnsweredCorrectly(MC_FlashCard* fc);
-
+int LAN_NotAnsweredCorrectly(MC_FlashCard* fc);
 /* This is how the client receives messages from the server: */
 int LAN_NextMsg(char* buf);
 




More information about the Tux4kids-commits mailing list