[Tux4kids-commits] r1015 - in tuxmath/trunk: data/missions/multiplay src

B. Luchen cheezmeister-guest at alioth.debian.org
Mon Jun 8 01:12:25 UTC 2009


Author: cheezmeister-guest
Date: 2009-06-08 01:12:25 +0000 (Mon, 08 Jun 2009)
New Revision: 1015

Modified:
   tuxmath/trunk/data/missions/multiplay/ace
   tuxmath/trunk/data/missions/multiplay/commando
   tuxmath/trunk/data/missions/multiplay/ranger
   tuxmath/trunk/data/missions/multiplay/scout
   tuxmath/trunk/data/missions/multiplay/space_cadet
   tuxmath/trunk/src/multiplayer.c
Log:
Fleshing out of turn-based multiplayer--settings/winners

Modified: tuxmath/trunk/data/missions/multiplay/ace
===================================================================
--- tuxmath/trunk/data/missions/multiplay/ace	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/data/missions/multiplay/ace	2009-06-08 01:12:25 UTC (rev 1015)
@@ -1,6 +1,5 @@
 # multiplay ace lesson file
 
-play_through_list = 0
 allow_speedup = 1
 use_feedback = 0
 addition_allowed = 1
@@ -46,7 +45,7 @@
 comprehensive = 1
 min_formula_nums = 2
 max_formula_nums = 2
-avg_list_length = 250
+avg_list_length = 25
 vary_list_length = 0
 max_answer = 400
 starting_comets = 2
@@ -58,7 +57,6 @@
 slow_after_wrong = 0
 max_questions = 25000
 bonus_comet_interval = 20
-fraction_to_keep = 1
 allow_pause = 0
 bonus_speed_ratio = 2.0
 

Modified: tuxmath/trunk/data/missions/multiplay/commando
===================================================================
--- tuxmath/trunk/data/missions/multiplay/commando	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/data/missions/multiplay/commando	2009-06-08 01:12:25 UTC (rev 1015)
@@ -1,6 +1,5 @@
 # multiplay commando lesson file
 
-play_through_list = 0
 allow_speedup = 1
 use_feedback = 0
 addition_allowed = 1
@@ -46,7 +45,7 @@
 comprehensive = 0
 min_formula_nums = 3
 max_formula_nums = 4
-avg_list_length = 250
+avg_list_length = 25
 vary_list_length = 0
 starting_comets = 2
 extra_comets_per_wave = 2
@@ -57,7 +56,6 @@
 slow_after_wrong = 1
 max_questions = 25000
 bonus_comet_interval = 20
-fraction_to_keep = 1
 allow_pause = 0
 bonus_speed_ratio = 2.0
 

Modified: tuxmath/trunk/data/missions/multiplay/ranger
===================================================================
--- tuxmath/trunk/data/missions/multiplay/ranger	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/data/missions/multiplay/ranger	2009-06-08 01:12:25 UTC (rev 1015)
@@ -1,6 +1,5 @@
 # multiplay_ranger lesson file
 
-play_through_list = 0
 allow_speedup = 1
 use_feedback = 0
 addition_allowed = 1
@@ -47,7 +46,7 @@
 comprehensive = 1
 min_formula_nums = 2
 max_formula_nums = 2
-avg_list_length = 250
+avg_list_length = 25
 vary_list_length = 0
 
 starting_comets = 2
@@ -59,6 +58,5 @@
 slow_after_wrong = 0
 max_questions = 25000
 bonus_comet_interval = 10
-fraction_to_keep = 1.00
 allow_pause = 0
 bonus_speed_ratio = 1.8

Modified: tuxmath/trunk/data/missions/multiplay/scout
===================================================================
--- tuxmath/trunk/data/missions/multiplay/scout	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/data/missions/multiplay/scout	2009-06-08 01:12:25 UTC (rev 1015)
@@ -1,6 +1,5 @@
 # multiplay_scout lesson file
 
-play_through_list = 0
 allow_speedup = 1
 use_feedback = 0
 addition_allowed = 1
@@ -34,7 +33,7 @@
 comprehensive = 1
 min_formula_nums = 2
 max_formula_nums = 2
-avg_list_length = 250
+avg_list_length = 25
 vary_list_length = 0
 max_answer = 20
 starting_comets = 2
@@ -46,7 +45,6 @@
 slow_after_wrong = 0
 max_questions = 5000
 bonus_comet_interval = 10
-fraction_to_keep = 1.00
 allow_pause = 0
 bonus_speed_ratio = 1.5
 

Modified: tuxmath/trunk/data/missions/multiplay/space_cadet
===================================================================
--- tuxmath/trunk/data/missions/multiplay/space_cadet	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/data/missions/multiplay/space_cadet	2009-06-08 01:12:25 UTC (rev 1015)
@@ -1,6 +1,5 @@
 # multiplay space cadet lesson file
 
-play_through_list = 0
 allow_speedup = 1
 use_feedback = 0
 addition_allowed = 1
@@ -25,7 +24,7 @@
 comprehensive = 1
 min_formula_nums = 2
 max_formula_nums = 2
-avg_list_length = 121
+avg_list_length = 12
 vary_list_length = 0
 max_answer = 10
 starting_comets = 2
@@ -37,6 +36,5 @@
 slow_after_wrong = 0
 max_questions = 5000
 bonus_comet_interval = 10
-fraction_to_keep = 1.00
 allow_pause = 0
 bonus_speed_ratio = 1.2

Modified: tuxmath/trunk/src/multiplayer.c
===================================================================
--- tuxmath/trunk/src/multiplayer.c	2009-06-07 22:20:28 UTC (rev 1014)
+++ tuxmath/trunk/src/multiplayer.c	2009-06-08 01:12:25 UTC (rev 1015)
@@ -112,15 +112,16 @@
     //sort out winners
     for (i = 0; i < params[PLAYERS]; ++i)
     {
+      hiscore = 0;
       for (currentplayer = 0; currentplayer < params[PLAYERS]; ++currentplayer)
       {
-        if (pscores[currentplayer] > hiscore)
+        if (pscores[currentplayer] >= hiscore)
         {
           hiscore = pscores[currentplayer];
           currentwinner = currentplayer;
         }
       winners[i] = currentwinner;
-      pscores[currentwinner] = 0;
+      pscores[currentwinner] = -1;
       }
     }
   }
@@ -164,17 +165,24 @@
 void showWinners(int* winners, int num)
 {
   int skip = 0;
+  int i = 0;
   const int boxspeed = 3;
-  char text[HIGH_SCORE_NAME_LENGTH + strlen(" wins!")];
+  int sectionlength = num * (HIGH_SCORE_NAME_LENGTH + strlen(" wins!\n"));
+  char text[sectionlength];
   SDL_Rect box = {screen->w / 2, screen->h / 2, 0, 0};
   SDL_Rect center = box;
   SDL_Event evt;
 
   const char* winnername = (winners[0] == -1 ? "Nobody" : pnames[winners[0]] );
   
+  snprintf(text, HIGH_SCORE_NAME_LENGTH + strlen(" wins!"),
+                    "%s wins!\n", winnername);
+  for (i = 1; i < num; ++i)
+  {
+    snprintf(strchr(text, '\0'), sectionlength, _("Then %s\n"), pnames[winners[i]]);
+  }
+  
   tmdprintf("%s", pnames[winners[0]] );
-  tmdprintf("%d\n", snprintf(text, HIGH_SCORE_NAME_LENGTH + strlen(" wins!"),
-                    "%s wins!", winnername) );
   tmdprintf("Win text: %s\n", text);
 
   DarkenScreen(1);
@@ -209,6 +217,7 @@
 int initMP()
 {
   int i;
+  int success = 1;
   char nrstr[HIGH_SCORE_NAME_LENGTH * 3];
   int nplayers = params[PLAYERS];
 
@@ -221,9 +230,14 @@
   };
 
   tmdprintf("Reading in difficulty settings...\n");
-  if (!read_global_config_file() ||
-      !read_named_config_file("multiplay/mpoptions") ||
-      !read_named_config_file(config_files[params[DIFFICULTY]]) )
+
+  success *= read_global_config_file();
+
+  success *= read_named_config_file("multiplay/mpoptions");
+
+  success *= read_named_config_file(config_files[params[DIFFICULTY]]);
+
+  if (!success)
   {
     printf("Couldn't read in settings for %s\n",
            config_files[params[DIFFICULTY]] );




More information about the Tux4kids-commits mailing list