From 1e536622a2743fc19b695283a5265f58b91a3c88 Mon Sep 17 00:00:00 2001 From: router Date: Mon, 13 Jun 2022 05:47:08 +0300 Subject: [PATCH] format infinities (#7009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * format infinities * ๐Ÿคจ --- core/src/mindustry/core/UI.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/core/UI.java b/core/src/mindustry/core/UI.java index 7cd9e79303..5904aed9be 100644 --- a/core/src/mindustry/core/UI.java +++ b/core/src/mindustry/core/UI.java @@ -595,8 +595,9 @@ public class UI implements ApplicationListener, Loadable{ } public static String formatAmount(long number){ - //prevent overflow - if(number == Long.MIN_VALUE) number ++; + //prevent things like bars displaying erroneous representations of casted infinities + if(number == Long.MAX_VALUE) return "โˆž"; + if(number == Long.MIN_VALUE) return "-โˆž"; long mag = Math.abs(number); String sign = number < 0 ? "-" : "";