moved code to get time string for hall of fame to separate function
authorHolger Schemel <info@artsoft.org>
Wed, 23 Feb 2022 22:33:43 +0000 (23:33 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 23 Feb 2022 22:34:14 +0000 (23:34 +0100)
src/screens.c

index 7b05d4f1f15ada61f7183fd95a3ecf1bffbee3f7..4d5eee917fa237afc334290f2419c6bd2e53221b 100644 (file)
@@ -5769,14 +5769,8 @@ void DrawHallOfFame(int level_nr)
   DrawChooseTree(&score_entry_current);
 }
 
-static char *getHallOfFameScoreText(int nr)
+static char *getHallOfFameTimeText(int nr)
 {
-  if (!level.rate_time_over_score)
-    return int2str(scores.entry[nr].score, 5); // show normal score
-
-  if (level.use_step_counter)
-    return int2str(scores.entry[nr].time, 5);  // show number of steps
-
   static char score_text[10];
   int time_seconds = scores.entry[nr].time / FRAMES_PER_SECOND;
   int mm = (time_seconds / 60) % 60;
@@ -5787,6 +5781,16 @@ static char *getHallOfFameScoreText(int nr)
   return score_text;
 }
 
+static char *getHallOfFameScoreText(int nr)
+{
+  if (!level.rate_time_over_score)
+    return int2str(scores.entry[nr].score, 5); // show normal score
+  else if (level.use_step_counter)
+    return int2str(scores.entry[nr].time, 5);  // show number of steps
+  else
+    return getHallOfFameTimeText(nr);          // show playing time
+}
+
 static void HandleHallOfFame_SelectLevel(int step, int direction)
 {
   int old_level_nr = level_nr;