Added a MODE_COUNT macro to reduce FIXME count and cleaned up some code.
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Wed, 3 Oct 2007 21:58:33 +0000 (21:58 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Wed, 3 Oct 2007 21:58:33 +0000 (21:58 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@1182 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/levels.c
ball/mode.h
ball/st_demo.c
ball/st_goal.c
ball/st_pause.c
ball/st_shared.c

index 956e2ed..2377d34 100644 (file)
@@ -136,6 +136,8 @@ int level_same(void)
     return level_play(curr_lg()->level, curr_lg()->mode);
 }
 
+/*---------------------------------------------------------------------------*/
+
 void level_update_player_name(void)
 {
     char player[MAXNAM];
@@ -146,4 +148,3 @@ void level_update_player_name(void)
 }
 
 /*---------------------------------------------------------------------------*/
-
index 3ddb316..bfc0bd5 100644 (file)
@@ -7,6 +7,8 @@
 #define MODE_NORMAL     2
 #define MODE_PRACTICE   3
 
+#define MODE_COUNT 3
+
 void mode_set(int);
 int  curr_mode(void);
 
index b75f8c4..1642891 100644 (file)
@@ -131,15 +131,10 @@ static int gui_demo_status(int id, const struct demo *d)
         mode = mode_to_str(0, 0);
         j = strlen(mode);
 
-        /* FIXME
-         *
-         * This stuff should not require changes each time a mode is
-         * added or removed.
-         */
-
-        for (i = 1; i <= MODE_PRACTICE; i++)
+        for (i = 1; i <= MODE_COUNT; i++)
         {
             k = strlen(mode_to_str(i, 0));
+
             if (k > j)
             {
                 j = k;
index f2c2e5b..6964834 100644 (file)
@@ -43,6 +43,8 @@ static int balls_id;
 static int coins_id;
 static int score_id;
 
+/* Bread crumbs. */
+
 static int new_name;
 static int be_back_soon;
 
@@ -90,6 +92,9 @@ static int goal_action(int i)
 
 static int goal_enter(void)
 {
+    const char *s1 = _("New Record");
+    const char *s2 = _("GOAL");
+
     int id, jd, kd;
 
     const struct level_game *lg = curr_lg();
@@ -113,9 +118,9 @@ static int goal_enter(void)
         int gid;
 
         if (high)
-            gid = gui_label(id, _("New Record"), GUI_MED, GUI_ALL, gui_grn, gui_grn);
+            gid = gui_label(id, s1, GUI_MED, GUI_ALL, gui_grn, gui_grn);
         else
-            gid = gui_label(id, _("GOAL"), GUI_LRG, GUI_ALL, gui_blu, gui_grn);
+            gid = gui_label(id, s2, GUI_LRG, GUI_ALL, gui_blu, gui_grn);
 
         gui_space(id);
 
index c522641..f15e0b0 100644 (file)
@@ -83,6 +83,7 @@ static int pause_action(int i)
     return 1;
 }
 
+/*---------------------------------------------------------------------------*/
 
 static int pause_enter(void)
 {
@@ -124,13 +125,13 @@ static int pause_enter(void)
     return id;
 }
 
-void pause_paint(int id, float st)
+static void pause_paint(int id, float st)
 {
     shared_paint(id, st);
     hud_paint();
 }
 
-void pause_timer(int id, float dt)
+static void pause_timer(int id, float dt)
 {
     gui_timer(id, dt);
     hud_timer (dt);
index 65c2aca..74b5e35 100644 (file)
@@ -38,8 +38,9 @@ void shared_timer(int id, float dt)
     audio_timer(dt);
 }
 
-int shared_point_basic(int id, int x, int y)
 /* Pulse, activate and return the active id (if changed)*/
+
+int shared_point_basic(int id, int x, int y)
 {
     int jd = gui_point(id, x, y);
     if (jd)