Some very humble code pretty-up.
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Wed, 12 Jul 2006 15:51:20 +0000 (15:51 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Wed, 12 Jul 2006 15:51:20 +0000 (15:51 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@504 78b8d119-cf0a-0410-b17c-f493084dd1d7

ball/level.c
ball/levels.c
ball/main.c

index 8d82e21..9003f8f 100644 (file)
@@ -126,15 +126,11 @@ int level_load(const char *filename, struct level *level)
     /* Try to load the sol file */
     if (!sol_load_only_file(&sol, filename))
     {
-        fprintf(stderr, _("Error while loading level file '%s': "), filename);
-        if (errno)
-           perror(NULL);
-        else
-           fprintf(stderr, _("Not a valid level file\n"));
+        fprintf(stderr, _("Error while loading level file '%s': \n"), filename,
+                errno ? strerror(errno) : _("Not a valid level file\n"));
         return 0;
     }
 
-    /* Set filename */
     strcpy(level->file, filename);
 
     /* Init hs with default values */
@@ -164,7 +160,6 @@ int level_load(const char *filename, struct level *level)
     HOP(level->goal_score.timer, <=);
     HOP(level->coin_score.coins, >=);
 
-    /* Free the sol structure, no more needed */
     sol_free(&sol);
 
     return 1;
@@ -214,7 +209,7 @@ const char *mode_to_str(int m)
     case MODE_NORMAL:    return _("Normal");
     case MODE_PRACTICE:  return _("Practice");
     case MODE_SINGLE:    return _("Single");
-    default:             return "???";
+    default:             return _("Unknown");
     }
 }
 
@@ -229,7 +224,7 @@ const char *state_to_str(int m)
     case GAME_SPEC:
     case GAME_GOAL:    return _("Success");
     case GAME_FALL:    return _("Fall-out");
-    default:           return "???";
+    default:           return _("Unknown");
     }
 }
 
index 50dd645..1c9ccb1 100644 (file)
@@ -63,20 +63,24 @@ int level_play_go(void)
     return demo_play_init(USER_REPLAY_FILE, l, lg);
 }
 
+/* Prepare to play a single level */
 
 void level_play_single(const char *filename)
-/* Prepare to play a single level */
 {
     struct level *l = &single_level;
+
     level_load(filename, l);
     level_play(l, MODE_SINGLE);
 }
 
-void level_play(const struct level *l, int m)
 /* Prepare to play a level sequence from the `i'th level */
+
+void level_play(const struct level *l, int m)
 {
     struct level_game *lg = &current_level_game;
-    memset(lg, 0, sizeof(struct level_game));
+
+    memset(lg, 0, sizeof (struct level_game));
+
     lg->mode  = m;
     lg->level = l;
     lg->balls = 3;
@@ -96,8 +100,9 @@ int count_extra_balls(int old_score, int coins)
     return sum / 100;
 }
 
-void level_stop(int state, int state_value, int clock, int coins)
 /* Stop the current playing level */
+
+void level_stop(int state, int state_value, int clock, int coins)
 {
     struct level_game *lg = &current_level_game;
     int mode = lg->mode;
index 843fc75..ff97ead 100644 (file)
@@ -253,7 +253,7 @@ static void parse_args(int argc, char **argv)
         }
         else if (CASE("-v") || CASE("--version"))
         {
-            printf(_("%s: %s version %s\n"), exec, TITLE, VERSION);
+            printf("%s %s\n", TITLE, VERSION);
             exit(0);
         }
         else if (CASE("--data") && MAND)
@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
     {
         if (!level_replay(replay_path))
         {
-            fprintf(stderr, _("Replay file '%s':  %s\n"), replay_path,
+            fprintf(stderr, _("Replay file '%s': %s\n"), replay_path,
                     errno ? strerror(errno) : _("Not a replay file"));
             return 1;
         }
@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
             {
                 st_paint();
                 gui_blank();
-                SDL_Delay(10); /* Be nice! */
+                SDL_Delay(10);
             }
             else
             {