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

David Bruce dbruce-guest at alioth.debian.org
Mon Aug 31 15:36:20 UTC 2009


Author: dbruce-guest
Date: 2009-08-31 15:36:19 +0000 (Mon, 31 Aug 2009)
New Revision: 1469

Modified:
   tuxmath/branches/lan/src/game.c
   tuxmath/branches/lan/src/titlescreen.c
Log:
fix of arcade play



Modified: tuxmath/branches/lan/src/game.c
===================================================================
--- tuxmath/branches/lan/src/game.c	2009-08-31 15:03:34 UTC (rev 1468)
+++ tuxmath/branches/lan/src/game.c	2009-08-31 15:36:19 UTC (rev 1469)
@@ -2842,33 +2842,30 @@
   }
 
 
-  /* Get math question for new comet - the following function fills in */
-  /* the flashcard struct that is part of the comet struct:            */
+  /* Get math question for new comet - if playing in LAN mode, we */
+  /* get the next question from our local queue. If not in LAN    */
+  /* mode, we get it with a direct function call to MathCards     */
    
-   /* FIXME what we really need here is the capability within network.c to queue  */
-   /* any questions that have been received from the server in check_messages(),  */
-   /* and a function that gives us the next question in the local queue if there  */
-   /* is one. We can't assume that it will arrive from the server right at the    */
-   /* time we happen to need it to make a new comet. So I'm commenting out        */
-   /* the 'say_to_server()' call as well - DSB                                     */
   if(Opts_LanMode())
   {
 #ifdef HAVE_LIBSDL_NET
     for (i = 0; i < TEST_COMETS; i++)
-     {
-       if(comets_questions[comet_counter % TEST_COMETS].question_id != -1)
-       {
-         copy_card(&(comets_questions[comet_counter % TEST_COMETS]), &(comets[found].flashcard)); //will be replaced on set up of new system
-         comet_counter++;
-         break;
-       }
-     }
-     if(comet_counter > TEST_COMETS)
-       comet_counter -= TEST_COMETS;
-     if(i == TEST_COMETS)
-       return 0;
-     
+    {
+      if(comets_questions[i].question_id != -1)
+      {
+        copy_card(&(comets_questions[i]), &(comets[found].flashcard));
+        erase_flashcard(&(comets_questions[i]));
+        break;
+      }
+    }
+
+    if(i == TEST_COMETS)
+    {
+      tmdprintf("add_comet() called but no question available in queue\n");
+      return 0;
+    } 
 #else
+    /* NOTE: Should not be able to get to here */
     if (!MC_NextQuestion(&(comets[found].flashcard)))
     {
       /* no more questions available - cannot create comet.  */

Modified: tuxmath/branches/lan/src/titlescreen.c
===================================================================
--- tuxmath/branches/lan/src/titlescreen.c	2009-08-31 15:03:34 UTC (rev 1468)
+++ tuxmath/branches/lan/src/titlescreen.c	2009-08-31 15:36:19 UTC (rev 1469)
@@ -1019,7 +1019,8 @@
       if (read_named_config_file(arcade_config_files[choice]))
       {
         audioMusicUnload();
-
+	Opts_SetLanMode(0);
+        game();
         RecalcTitlePositions();
         if (Opts_GetGlobalOpt(MENU_MUSIC)) {
           audioMusicLoad( "tuxi.ogg", -1 );




More information about the Tux4kids-commits mailing list