From 2e0289e501894c7c840a6a4e08dfbc031518709c Mon Sep 17 00:00:00 2001 From: Maarten Lensink Date: Sun, 30 Aug 2020 15:12:23 +0300 Subject: [PATCH] Making use of String.Format --- .../zscript/ui/statscreen/statscreen.zs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen.zs b/wadsrc/static/zscript/ui/statscreen/statscreen.zs index 18a4f8d7d..6b7daa205 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen.zs @@ -515,7 +515,6 @@ class StatusScreen abstract play version("2.5") void drawTimeScaled (Font fnt, int x, int y, int t, double scale, int color = Font.CR_UNTRANSLATED) { - int sec = Thinker.Tics2Seconds(Plrs[me].stime); if (t < 0) return; @@ -525,23 +524,7 @@ class StatusScreen abstract play version("2.5") t -= minutes * 60; int seconds = t; - String s = ""; - if (hours > 0) - { - s = String.Format("%d", hours) .. ":"; - } - - if (hours > 0 || minutes < 10) - { - s = s .. "0"; - } - s = s .. String.Format("%d", minutes) .. ":"; - - if (seconds < 10) - { - s = s .. "0"; - } - s = s .. String.Format("%d", seconds); + String s = (hours > 0 ? String.Format("%d:", hours) : "") .. String.Format("%02d:%02d", minutes, seconds); drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, color); }