Remove "last_set" config option. Resolves ticket:49.
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 8 Jun 2006 09:41:23 +0000 (09:41 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 8 Jun 2006 09:41:23 +0000 (09:41 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@434 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/st_set.c
share/config.c
share/config.h

index 66b5f55..aacb320 100644 (file)
@@ -34,6 +34,8 @@
 
 #define SET_GROUP 5 /* number of sets in one screen */
 
+static int last_set = 0;
+
 static int shot_id;
 static int desc_id;
 
@@ -47,13 +49,11 @@ static int set_action(int i)
         return goto_state(&st_title);
 
     case GUI_PREV:
-        config_set_d(CONFIG_LAST_SET,
-                     ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) - 1) * SET_GROUP);
+        last_set = (last_set / SET_GROUP - 1) * SET_GROUP;
         return goto_state(&st_set);
 
     case GUI_NEXT:
-        config_set_d(CONFIG_LAST_SET,
-                     ((config_get_d(CONFIG_LAST_SET) / SET_GROUP) + 1) * SET_GROUP);
+        last_set = (last_set / SET_GROUP + 1) * SET_GROUP;
         return goto_state(&st_set);
 
     case GUI_NULL:
@@ -62,7 +62,7 @@ static int set_action(int i)
     default:
         if (set_exists(i))
         {
-            config_set_d(CONFIG_LAST_SET, i);
+            last_set = i;
             set_goto(i);
             return goto_state(&st_start);
         }
@@ -89,7 +89,6 @@ static int set_enter(void)
 {
     int w = config_get_d(CONFIG_WIDTH);
     int h = config_get_d(CONFIG_HEIGHT);
-    int last_set = config_get_d(CONFIG_LAST_SET);
     int b = last_set / SET_GROUP;
     int i;
 
@@ -103,7 +102,6 @@ static int set_enter(void)
     {
         b = 0;
         last_set = 0;
-        config_set_d(CONFIG_LAST_SET, 0);
     }
 
     audio_music_fade_to(0.5f, "bgm/inter.ogg");
index b0e313f..6dfd993 100644 (file)
@@ -105,7 +105,6 @@ void config_init(void)
     config_set_d(CONFIG_VIEW_DZ,              DEFAULT_VIEW_DZ);
     config_set_d(CONFIG_ROTATE_FAST,          DEFAULT_ROTATE_FAST);
     config_set_d(CONFIG_ROTATE_SLOW,          DEFAULT_ROTATE_SLOW);
-    config_set_d(CONFIG_LAST_SET,             DEFAULT_LAST_SET);
     config_set_d(CONFIG_MODE,                 DEFAULT_MODE);
     config_set_d(CONFIG_CHEAT,                DEFAULT_CHEAT);
     config_set_s(CONFIG_PLAYER,               DEFAULT_PLAYER);
@@ -199,8 +198,6 @@ void config_load(void)
                     config_set_d(CONFIG_ROTATE_FAST,          atoi(val));
                 else if (strcmp(key, "rotate_slow")           == 0)
                     config_set_d(CONFIG_ROTATE_SLOW,          atoi(val));
-                else if (strcmp(key, "last_set")              == 0)
-                    config_set_d(CONFIG_LAST_SET,             atoi(val));
                 else if (strcmp(key, "mode")                  == 0)
                     config_set_d(CONFIG_MODE,                 atoi(val));
                 else if (strcmp(key, "cheat") == 0 && ALLOW_CHEAT)
@@ -311,8 +308,6 @@ void config_save(void)
                 option_d[CONFIG_ROTATE_FAST]);
         fprintf(fp, "rotate_slow          %d\n",
                 option_d[CONFIG_ROTATE_SLOW]);
-        fprintf(fp, "last_set             %d\n",
-                option_d[CONFIG_LAST_SET]);
         fprintf(fp, "mode                 %d\n",
                 option_d[CONFIG_MODE]);
 
index 27edacd..2c01974 100644 (file)
@@ -70,7 +70,6 @@ enum {
     CONFIG_VIEW_DZ,
     CONFIG_ROTATE_FAST,
     CONFIG_ROTATE_SLOW,
-    CONFIG_LAST_SET,
     CONFIG_MODE,
     CONFIG_CHEAT,