[Tux4kids-commits] r1046 - tuxmath/branches/lan/server

akash gangil gangil-guest at alioth.debian.org
Sun Jun 14 12:50:29 UTC 2009


Author: gangil-guest
Date: 2009-06-14 12:50:28 +0000 (Sun, 14 Jun 2009)
New Revision: 1046

Added:
   tuxmath/branches/lan/server/server.h
Modified:
   tuxmath/branches/lan/server/server.c
Log:
setting up a enum list for better understanding

Modified: tuxmath/branches/lan/server/server.c
===================================================================
--- tuxmath/branches/lan/server/server.c	2009-06-14 02:50:22 UTC (rev 1045)
+++ tuxmath/branches/lan/server/server.c	2009-06-14 12:50:28 UTC (rev 1046)
@@ -23,7 +23,7 @@
 #include "SDL_net.h"
 #include "transtruct.h"
 #include "mathcards.h"
- 
+#include "server.h" 
 
 TCPsocket sd, csd; /* Socket descriptor, Client socket descriptor */
 
@@ -33,7 +33,7 @@
         IPaddress ip, *remoteIP;
         int quit, quit2;
         char buffer[512];
-        char func;
+        int network_function=0;
         MC_FlashCard* fc;
    //     size_t length;
 
@@ -79,7 +79,7 @@
                         quit2 = 0;
                         while (!quit2)
                         {
-                                func='\0';
+                                
                                 if (SDLNet_TCP_Recv(csd, buffer, 512) > 0)
                                 {
                                         printf("Client say: %s\n", buffer);
@@ -87,19 +87,19 @@
                                         //'a' for the setting up the question list                                           
                                         if(strcmp(buffer,"a")==0)
                                         {
-                                           func='1';              
+                                           network_function=SETUP_QUESTION_LIST;              
 					} 
                                        
 					//'b' for asking for a question(flashcard)
                                         if(strcmp(buffer,"b")==0)
                                         {
-                                           func='2';              
+                                           network_function=SEND_A_QUESTION;              
 					} 
  
-					switch(func)
+					switch(network_function)
  
 					{
-						case '1':                                                //mainly to setup the question list
+						case SETUP_QUESTION_LIST:                                                //mainly to setup the question list
                                                  
                                                  {
                                                    if (!MC_StartGame())
@@ -112,7 +112,7 @@
                                                    break;                                           
                                                  } 
 						
-                                                case '2':
+                                                case SEND_A_QUESTION:
                                                   
                                                   {
 

Added: tuxmath/branches/lan/server/server.h
===================================================================
--- tuxmath/branches/lan/server/server.h	                        (rev 0)
+++ tuxmath/branches/lan/server/server.h	2009-06-14 12:50:28 UTC (rev 1046)
@@ -0,0 +1,25 @@
+/*
+
+        server.h
+
+        Description: As of now it conatinsthe 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)
+
+*/
+
+
+
+#ifndef SERVER_H
+#define SERVER_H
+
+
+enum {
+  SETUP_QUESTION_LIST,
+  SEND_A_QUESTION
+};
+
+#endif




More information about the Tux4kids-commits mailing list