[Tux4kids-commits] r305 - in tuxmath/trunk: data/images/sprites intl src

dbruce-guest at alioth.debian.org dbruce-guest at alioth.debian.org
Wed Oct 24 19:28:56 UTC 2007


Author: dbruce-guest
Date: 2007-10-24 19:28:55 +0000 (Wed, 24 Oct 2007)
New Revision: 305

Modified:
   tuxmath/trunk/data/images/sprites/helpd.png
   tuxmath/trunk/intl/localename.c
   tuxmath/trunk/src/fileops.c
   tuxmath/trunk/src/lessons.c
   tuxmath/trunk/src/titlescreen.c
Log:
bugfix in goldstar code, work on icons


Modified: tuxmath/trunk/data/images/sprites/helpd.png
===================================================================
(Binary files differ)

Modified: tuxmath/trunk/intl/localename.c
===================================================================
--- tuxmath/trunk/intl/localename.c	2007-10-24 12:06:14 UTC (rev 304)
+++ tuxmath/trunk/intl/localename.c	2007-10-24 19:28:55 UTC (rev 305)
@@ -494,10 +494,10 @@
 # define SUBLANG_AZERI_CYRILLIC 0x02
 # endif
 # ifndef SUBLANG_BENGALI_INDIA
-# define SUBLANG_BENGALI_INDIA 0x01
+# define SUBLANG_BENGALI_INDIA 0x00
 # endif
 # ifndef SUBLANG_BENGALI_BANGLADESH
-# define SUBLANG_BENGALI_BANGLADESH 0x02
+# define SUBLANG_BENGALI_BANGLADESH 0x01
 # endif
 # ifndef SUBLANG_CHINESE_MACAU
 # define SUBLANG_CHINESE_MACAU 0x05
@@ -590,16 +590,16 @@
 # define SUBLANG_NEPALI_INDIA 0x02
 # endif
 # ifndef SUBLANG_PUNJABI_INDIA
-# define SUBLANG_PUNJABI_INDIA 0x01
+# define SUBLANG_PUNJABI_INDIA 0x00
 # endif
 # ifndef SUBLANG_PUNJABI_PAKISTAN
-# define SUBLANG_PUNJABI_PAKISTAN 0x02
+# define SUBLANG_PUNJABI_PAKISTAN 0x01
 # endif
 # ifndef SUBLANG_ROMANIAN_ROMANIA
-# define SUBLANG_ROMANIAN_ROMANIA 0x01
+# define SUBLANG_ROMANIAN_ROMANIA 0x00
 # endif
 # ifndef SUBLANG_ROMANIAN_MOLDOVA
-# define SUBLANG_ROMANIAN_MOLDOVA 0x02
+# define SUBLANG_ROMANIAN_MOLDOVA 0x01
 # endif
 # ifndef SUBLANG_SERBIAN_LATIN
 # define SUBLANG_SERBIAN_LATIN 0x02
@@ -607,12 +607,12 @@
 # ifndef SUBLANG_SERBIAN_CYRILLIC
 # define SUBLANG_SERBIAN_CYRILLIC 0x03
 # endif
+# ifndef SUBLANG_SINDHI_INDIA
+# define SUBLANG_SINDHI_INDIA 0x00
+# endif
 # ifndef SUBLANG_SINDHI_PAKISTAN
 # define SUBLANG_SINDHI_PAKISTAN 0x01
 # endif
-# ifndef SUBLANG_SINDHI_AFGHANISTAN
-# define SUBLANG_SINDHI_AFGHANISTAN 0x02
-# endif
 # ifndef SUBLANG_SPANISH_GUATEMALA
 # define SUBLANG_SPANISH_GUATEMALA 0x04
 # endif
@@ -670,14 +670,14 @@
 # ifndef SUBLANG_TAMAZIGHT_ARABIC
 # define SUBLANG_TAMAZIGHT_ARABIC 0x01
 # endif
-# ifndef SUBLANG_TAMAZIGHT_ALGERIA_LATIN
-# define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
+# ifndef SUBLANG_TAMAZIGHT_LATIN
+# define SUBLANG_TAMAZIGHT_LATIN 0x02
 # endif
 # ifndef SUBLANG_TIGRINYA_ETHIOPIA
-# define SUBLANG_TIGRINYA_ETHIOPIA 0x01
+# define SUBLANG_TIGRINYA_ETHIOPIA 0x00
 # endif
 # ifndef SUBLANG_TIGRINYA_ERITREA
-# define SUBLANG_TIGRINYA_ERITREA 0x02
+# define SUBLANG_TIGRINYA_ERITREA 0x01
 # endif
 # ifndef SUBLANG_URDU_PAKISTAN
 # define SUBLANG_URDU_PAKISTAN 0x01

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2007-10-24 12:06:14 UTC (rev 304)
+++ tuxmath/trunk/src/fileops.c	2007-10-24 19:28:55 UTC (rev 305)
@@ -847,6 +847,28 @@
 
   /* Now we check to see which lessons have been previously completed */
   /* so we can display the Gold Stars: */
+  /* Allocate storage for lesson list */
+
+  /* prevent memory leak in case we called this already and */
+  /* free the list:                                         */
+  if(lesson_list_goldstars)
+  {
+    free(lesson_list_goldstars);
+    lesson_list_goldstars = NULL;
+  }
+
+  lesson_list_goldstars = (int*)malloc(num_lessons*sizeof(int));
+  if (!lesson_list_goldstars)
+  {
+    perror("unable to allocate memory for gold star list");
+    return 0;
+  }
+  for (i = 0; i < num_lessons; i++)
+  {
+    lesson_list_goldstars[i] = 0;
+  }
+
+  /* Now read file to see what lessons have been previously completed: */
   read_goldstars();
 
   return (num_lessons > 0);  /* Success! */

Modified: tuxmath/trunk/src/lessons.c
===================================================================
--- tuxmath/trunk/src/lessons.c	2007-10-24 12:06:14 UTC (rev 304)
+++ tuxmath/trunk/src/lessons.c	2007-10-24 19:28:55 UTC (rev 305)
@@ -46,27 +46,8 @@
     return 0;
   }
 
-  /* Allocate storage for lesson list */
 
-  /* prevent memory leak in case we called this already and */
-  /* free the list:                                         */
-  if(lesson_list_goldstars)
-  {
-    free(lesson_list_goldstars);
-    lesson_list_goldstars = NULL;
-  }
 
-  lesson_list_goldstars = (int*)malloc(num_lessons*sizeof(int));
-  if (!lesson_list_goldstars)
-  {
-    perror("unable to allocate memory for gold star list");
-    return 0;
-  }
-  for (i = 0; i < num_lessons; i++)
-  {
-    lesson_list_goldstars[i] = 0;
-  }
-
   /* make sure we start at beginning: */
   rewind(fp);
 

Modified: tuxmath/trunk/src/titlescreen.c
===================================================================
--- tuxmath/trunk/src/titlescreen.c	2007-10-24 12:06:14 UTC (rev 304)
+++ tuxmath/trunk/src/titlescreen.c	2007-10-24 19:28:55 UTC (rev 305)
@@ -886,21 +886,23 @@
  */
 int run_lessons_menu(void)
 {
-  int i;
   int chosen_lesson = -1;
   menu_options menu_opts;
   sprite** star_sprites = NULL;
 
-  /* Set up sprites with: */
-  star_sprites = (sprite**)malloc(num_lessons * sizeof(sprite*));
-  for (i = 0; i < num_lessons; i++)
+  /* Set up sprites (as long as gold star list is valid) */
+  if (lesson_list_goldstars != NULL)
   {
-    if (lesson_list_goldstars[i])
-      star_sprites[i] = sprite_list[SPRITE_GOLDSTAR];
-    else
-      star_sprites[i] = sprite_list[SPRITE_NO_GOLDSTAR];
+    int i;
+    star_sprites = (sprite**)malloc(num_lessons * sizeof(sprite*));
+    for (i = 0; i < num_lessons; i++)
+    {
+      if (lesson_list_goldstars[i])
+        star_sprites[i] = sprite_list[SPRITE_GOLDSTAR];
+      else
+        star_sprites[i] = sprite_list[SPRITE_NO_GOLDSTAR];
+    }
   }
-
   set_default_menu_options(&menu_opts);
 
   chosen_lesson = choose_menu_item((const)lesson_list_titles, star_sprites, num_lessons, menu_opts);
@@ -922,7 +924,7 @@
 
       game();
 
-      /* If successful, display Gold Star for this lesson: */
+      /* If successful, display Gold Star for this lesson! */
       if (MC_MissionAccomplished())
       {
         lesson_list_goldstars[chosen_lesson] = 1;
@@ -944,10 +946,12 @@
     menu_opts.starting_entry = chosen_lesson;
     chosen_lesson = choose_menu_item((const)lesson_list_titles, star_sprites, num_lessons, menu_opts);
   }
+  if (star_sprites)
+  {
+    free(star_sprites);
+    star_sprites = NULL;
+  }
 
-  free(star_sprites);
-  star_sprites = NULL;
-
   if (chosen_lesson < 0)
     return 0;
   else




More information about the Tux4kids-commits mailing list