Fix some next level pb with practice mode. Fix #58
[neverball] / ball / st_set.c
index 5bae7ab..5816d85 100644 (file)
@@ -68,19 +68,19 @@ static int set_action(int i)
     return 1;
 }
 
-static void gui_set(int id, int i, int sel)
+static void gui_set(int id, int i)
 {
     const struct set *s = get_set(i);
     int jd;
     
     if (set_completed(s)) 
        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_yel, gui_wht);
-    else if (set_extra_bonus_opened(s)) 
+    else if (set_unlocked(s)) 
        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_grn, gui_wht);
     else
        jd = gui_label(id, _(s->name), GUI_SML, GUI_ALL, gui_wht, gui_wht);
     
-    gui_active(jd, i, sel);
+    gui_active(jd, i, 0);
 }
 
 static int set_enter(void)
@@ -93,7 +93,16 @@ static int set_enter(void)
 
     int id, jd, kd;
 
+
     set_init();
+    
+    /* Reset last set if it do not exists */
+    if (!set_exists(last_set))
+    {
+       b = 0;
+       last_set = 0;
+       config_set_d(CONFIG_LAST_SET, 0);
+    }
 
     audio_music_fade_to(0.5f, "bgm/inter.ogg");
     audio_play(AUD_START, 1.f);
@@ -115,7 +124,7 @@ static int set_enter(void)
            {
                /* Display levels */
                for(i=b*SET_GROUP; i<(b+1)*SET_GROUP && set_exists(i); i++)
-                   gui_set(kd, i, last_set == i);
+                   gui_set(kd, i);
                
                /* Display empty slots */
                for(; i<(b+1)*SET_GROUP; i++)