Added a tweak to place the GUI into "recently moved" mode upon level end. This will...
[neverball] / ball / set.c
index aeb450e..40e1427 100644 (file)
@@ -20,6 +20,7 @@
 #include "glext.h"
 #include "config.h"
 #include "image.h"
+#include "text.h"
 #include "set.h"
 #include "game.h"
 
@@ -152,8 +153,8 @@ static void set_load_hs(void)
     if (!res && errno != ENOENT)
     {
         fprintf(stderr,
-                _("Error while loading user high-score file '%s': %s\n"),
-                fn, errno ? strerror(errno) : _("Incorrect format"));
+                L_("Error while loading user high-score file '%s': %s\n"),
+                fn, errno ? strerror(errno) : L_("Incorrect format"));
     }
 }
 
@@ -177,7 +178,7 @@ static int set_load(struct set *s, const char *filename)
 
     if (!fin)
     {
-        fprintf(stderr, _("Cannot load the set file '%s': %s\n"),
+        fprintf(stderr, L_("Cannot load the set file '%s': %s\n"),
                 filename, strerror(errno));
         return 0;
     }
@@ -412,29 +413,26 @@ static int set_score_update(struct level_game *lg, const char *player)
 
     lg->score_rank = score_time_insert(&s->time_score, player, timer, coins);
     lg->times_rank = score_time_insert(&s->coin_score, player, timer, coins);
+
     return (lg->score_rank < 3 || lg->times_rank < 3);
 }
 
-
-#define UPDATE(i, x) (strncpy((x).player[(i)], player, MAXNAM))
-
 /* Update the player name for set and level high-score. */
 void score_change_name(struct level_game *lg, const char *player)
 {
     struct set   *s = &set_v[set];
     struct level *l = &level_v[lg->level->number];
 
-    UPDATE(lg->time_rank, l->score.best_times);
-    UPDATE(lg->goal_rank, l->score.unlock_goal);
-    UPDATE(lg->coin_rank, l->score.most_coins);
-    UPDATE(lg->score_rank, s->coin_score);
-    UPDATE(lg->times_rank, s->time_score);
+    strncpy(l->score.best_times.player [lg->time_rank], player, MAXNAM);
+    strncpy(l->score.unlock_goal.player[lg->goal_rank], player, MAXNAM);
+    strncpy(l->score.most_coins.player [lg->coin_rank], player, MAXNAM);
+
+    strncpy(s->coin_score.player[lg->score_rank], player, MAXNAM);
+    strncpy(s->time_score.player[lg->times_rank], player, MAXNAM);
 
     set_store_hs();
 }
 
-#undef UPDATE
-
 static struct level *next_level(int i)
 {
     return set_level_exists(&set_v[set], i + 1) ? &level_v[i + 1] : NULL;
@@ -449,8 +447,7 @@ static struct level *next_normal_level(int i)
     return NULL;
 }
 
-/* Inform the set that a level is finished.  Update next level and score
- * rank fields. */
+/*---------------------------------------------------------------------------*/
 
 void set_finish_level(struct level_game *lg, const char *player)
 {
@@ -471,7 +468,7 @@ void set_finish_level(struct level_game *lg, const char *player)
     }
 
     /* On level completed */
-    if (lg->state == GAME_GOAL)
+    if (lg->status == GAME_GOAL)
     {
         /* Update level scores */
         dirty = level_score_update(lg, player);
@@ -490,7 +487,7 @@ void set_finish_level(struct level_game *lg, const char *player)
     }
 
     /* On goal reached */
-    if (lg->state == GAME_GOAL)
+    if (lg->status == GAME_GOAL)
     {
         /* Identify the following level */
         nl = next_level(ln);