diff --git a/code/intermission.cpp b/code/intermission.cpp index 4e04073..d7b6663 100644 --- a/code/intermission.cpp +++ b/code/intermission.cpp @@ -142,23 +142,8 @@ void setStatusLines() int timeTaken = currentGame.timeTaken; - signed char clock = 0; - while (timeTaken > 3599) - { - clock++; - timeTaken -= 3600; - } + snprintf(string, sizeof string, "Total Time : %2d:%02d:%02d", timeTaken / 3600, (timeTaken / 60) % 60, timeTaken % 60); - sprintf(string, "Total Time : %.2d", clock); - - clock = 0; - while (timeTaken > 59) - { - clock++; - timeTaken -= 60; - } - - sprintf(string, "%s:%.2d:%.2d", string, clock, timeTaken); graphics.textSurface(26, string, -1, 0, FONT_WHITE); graphics.textSurface(27, "Current Status", -1, 0, FONT_WHITE); diff --git a/code/missions.cpp b/code/missions.cpp index 33dca2a..a5fcf4d 100644 --- a/code/missions.cpp +++ b/code/missions.cpp @@ -871,23 +871,7 @@ void missionFinishedScreen() currentGame.timeTaken += engine.timeTaken; - signed char clock = 0; - while (engine.timeTaken > 3599) - { - clock++; - engine.timeTaken -= 3600; - } - - sprintf(temp, "Mission Time: %.2d", clock); - - clock = 0; - while (engine.timeTaken > 59) - { - clock++; - engine.timeTaken -= 60; - } - - sprintf(temp, "%s:%.2d:%.2d", temp, clock, engine.timeTaken); + snprintf(temp, sizeof temp, "Mission Time: %2d:%02d:%02d", engine.timeTaken / 3600, (engine.timeTaken / 60) % 60, engine.timeTaken % 60); graphics.drawString(temp, -1, 500, FONT_WHITE);