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

akash gangil gangil-guest at alioth.debian.org
Fri Jul 10 15:14:56 UTC 2009


Author: gangil-guest
Date: 2009-07-10 15:14:55 +0000 (Fri, 10 Jul 2009)
New Revision: 1178

Modified:
   tuxmath/branches/lan/src/game.c
Log:
game progress in between waves nicely , now need to tackle exit conditions MC_*

Modified: tuxmath/branches/lan/src/game.c
===================================================================
--- tuxmath/branches/lan/src/game.c	2009-07-10 13:29:00 UTC (rev 1177)
+++ tuxmath/branches/lan/src/game.c	2009-07-10 15:14:55 UTC (rev 1178)
@@ -175,7 +175,7 @@
 static void draw_console_image(int i);
 
 static void reset_level(void);
-static int add_comet(char *);
+static int add_comet(char *,char *);
 static void add_score(int inc);
 static void reset_comets(void);
 
@@ -280,7 +280,9 @@
 
     check_messages(buf);
     seperate_commmand_and_buf(command,buf);
+ 
 
+
     /* Most code now in smaller functions: */
     game_handle_user_events();
     game_handle_demo();
@@ -295,8 +297,8 @@
     game_draw();
     /* figure out if we should leave loop: */
 //    game_status = check_exit_conditions();               //would have to work on these , as they follow question linked list method
-  
  
+ 
 
     /* If we're in "PAUSE" mode, pause! */
     if (paused)
@@ -329,6 +331,7 @@
         now_time = MS_PER_FRAME;
       SDL_Delay(now_time);
     }
+
   }
   while(GAME_IN_PROGRESS == game_status);
   /* END OF MAIN GAME LOOP! */
@@ -1487,13 +1490,11 @@
     {
       if ((rand() % 2) == 0 || num_comets_alive == 0)
       {
-        if(strncmp(command,"SEND_QUESTION",strlen("SEND_QUESTION"))!=0)
-        {
-          if (add_comet(buf))
+          if (add_comet(command,buf))
           {
             num_attackers--;
           }
-        }
+        
       }
     }
     else
@@ -2563,7 +2564,7 @@
 
 
 /* Add a comet to the game (if there's room): */
-int add_comet(char buf[NET_BUF_LEN])
+int add_comet(char command[NET_BUF_LEN],char buf[NET_BUF_LEN])
 {
   static int prev_city = -1;
   int i, found;
@@ -2609,13 +2610,15 @@
  /*Server replacement for the above 5 comments*/
    say_to_server("NEXT_QUESTION");
    printf("buf is %s\n",buf);
-   if(!Make_Flashcard(buf, &(comets[found].flashcard)))
+   if(strncmp(command,"SEND_QUESTION",strlen("SEND_QUESTION"))==0) 
    {
-     return 0;
-   }
+     if(!Make_Flashcard(buf, &(comets[found].flashcard)))
+     {
+       return 0;
+     }
+   
 
 
-
   /* If we make it to here, create a new comet!                  */
 
   comets[found].answer = comets[found].flashcard.answer;
@@ -2684,7 +2687,7 @@
 
   /* Record the time at which this comet was created */
   comets[found].time_started = SDL_GetTicks();
-
+}
   /* comet slot found and question found so return successfully: */
   return 1;
 }




More information about the Tux4kids-commits mailing list