[Tux4kids-commits] r1582 - tuxmath/trunk/src

David Bruce dbruce-guest at alioth.debian.org
Mon Oct 12 18:49:44 UTC 2009


Author: dbruce-guest
Date: 2009-10-12 18:49:44 +0000 (Mon, 12 Oct 2009)
New Revision: 1582

Modified:
   tuxmath/trunk/src/server.c
   tuxmath/trunk/src/server.h
Log:
Beginning server-side handling of player scores

Modified: tuxmath/trunk/src/server.c
===================================================================
--- tuxmath/trunk/src/server.c	2009-10-12 18:49:38 UTC (rev 1581)
+++ tuxmath/trunk/src/server.c	2009-10-12 18:49:44 UTC (rev 1582)
@@ -301,6 +301,7 @@
       client[i].game_ready = 0;   /* waiting for user to OK game start */
       client[i].name[0] = '\0';   /* no nicknames yet                  */
       client[i].sock = NULL;      /* sockets start out unconnected     */
+      client[i].score = 0;
     }
   }
 

Modified: tuxmath/trunk/src/server.h
===================================================================
--- tuxmath/trunk/src/server.h	2009-10-12 18:49:38 UTC (rev 1581)
+++ tuxmath/trunk/src/server.h	2009-10-12 18:49:44 UTC (rev 1582)
@@ -2,9 +2,6 @@
 
         server.h
 
-        Description: As of now it conatins the enum, which identifies
-        the network commands , as they are added(WORK IN PROGRESS).
-
         Author: David Bruce, Akash Gangil and the TuxMath team, (C) 2009
 
         Copyright: See COPYING file that comes with this distribution (briefly, GNU GPL version 2 or later)
@@ -22,8 +19,9 @@
 #define SERVER_NAME_TIMEOUT 30000
 
 typedef struct client_type {
-  int game_ready;                 //game_ready = 1 , if client has said OK to start, and 0 otherwise
+  int game_ready;   //game_ready = 1 means client has said OK to start
   char name[NAME_SIZE];
+  int score;
   TCPsocket sock;
 }client_type;
 
@@ -40,32 +38,32 @@
 // };
 
 
-/*enum for messages for SendMessage*/
-enum {
-  ANSWER_CORRECT,
-  LIST_SET_UP,
-  NO_QUESTION_LIST
-};
+// /*enum for messages for SendMessage*/
+// enum {
+//   ANSWER_CORRECT,
+//   LIST_SET_UP,
+//   NO_QUESTION_LIST
+// };
 
 
 /* Ways to run the server - all accept command-line style arguments: */
 
-/* 1. Type "tuxmathserver" at command line to run as standalone program.              */
+/* 1. Type "tuxmathserver" at command line to run as standalone program. */
 
-/* From within Tuxmath:                                                               */
+/* From within Tuxmath: */
 
 #ifdef HAVE_PTHREAD_H
-/* 2. Using POSIX threads library (RECOMMENDED if phtreads available on your system): */
+/* 2. Using POSIX threads library (RECOMMENDED if pthreads available on your system): */
 int RunServer_pthread(int argc, char* argv[]);
 #endif
 
 /* 3. As a standalone program using system() - same as "tuxmathserver" at console:    */
 int RunServer_prog(int argc, char* argv[]);
-/* 4. Using old-school Unix fork() call:                                              */
+
+/* TODO 4. Using old-school Unix fork() call: */
 int RunServer_fork(int argc, char* argv[]);
 
-/* 2, 3, and 4 all return immediately, with the server running in a separate thread   */
-/* or process.  But if you don't mind waiting...                                      */
-/* 5. Plain "blocking" function call, leaving scheduling issues up to you:            */ 
+/* 2, 3, and 4 all return immediately, with the server running in a separate thread or process.  But if you don't mind waiting... */
+/* 5. Plain "blocking" function call, leaving scheduling issues up to you: */
 int RunServer(int argc, char **argv);
 #endif




More information about the Tux4kids-commits mailing list