diff --git a/language.version b/language.version index 587155d61..75f33901c 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r485 \cu(Tue 20 Sep 13:00:26 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r485 \cu(2022-09-20 13:00:26)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r486 \cu(Tue 20 Sep 16:01:57 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r486 \cu(2022-09-20 16:01:57)\c-"; diff --git a/zscript/utility/swwm_utility.zsc b/zscript/utility/swwm_utility.zsc index 42f680527..32b59b1c6 100644 --- a/zscript/utility/swwm_utility.zsc +++ b/zscript/utility/swwm_utility.zsc @@ -279,9 +279,11 @@ Class SWWMUtility return c; } - // not sure if I should use this, looks a bit ugly - static clearscope void ThousandsStr( out String s, int col = -1 ) + // bit ugly, but it works + static clearscope void ThousandsStr( out String s, int col = Font.CR_UNDEFINED, String colstr = "" ) { + if ( (col < Font.CR_UNDEFINED) || (col >= Font.NUM_TEXT_COLORS) ) + ThrowAbortException("col parameter out of range, use colstr for non-standard font colors."); String nstr = s; s.Truncate(0); int len = nstr.CodePointCount(); @@ -295,26 +297,18 @@ Class SWWMUtility t = (t-1)%3; if ( (pos < len) && !t ) { - if ( col != -1 ) - { - s.AppendCharacter(0x1C); - s.AppendCharacter(0x61+col); - } - s.AppendCharacter(0x2C); - if ( col != -1 ) - { - s.AppendCharacter(0x1C); - s.AppendCharacter(0x2D); - } + if ( colstr != "" ) s.AppendFormat("\c[%s],\c-",colstr); + else if ( col != Font.CR_UNDEFINED ) s.AppendFormat("\c%c,\c-",0x61+col); + else s.AppendCharacter(0x2C); } } } - static clearscope String ThousandsNum( int n, int col = -1, int digits = 0 ) + static clearscope String ThousandsNum( int n, int col = Font.CR_UNDEFINED, String colstr = "", int digits = 0 ) { String nstr; if ( digits > 0 ) nstr = String.Format("%0*d",digits,n); else nstr = String.Format("%d",n); - ThousandsStr(nstr,col); + ThousandsStr(nstr,col,colstr); return nstr; }