Clean SWWMUtility.SuperscriptNum up a bit (even though it's not used).

This commit is contained in:
Mari the Deer 2025-02-04 21:18:39 +01:00
commit a99d9e3a12
2 changed files with 12 additions and 8 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1173 \cu(mar 04 feb 2025 10:31:35 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1173 \cu(2025-02-04 10:31:35)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1174 \cu(mar 04 feb 2025 21:18:39 CET)\c-";
SWWM_SHORTVER="\cw1.3pre r1174 \cu(2025-02-04 21:18:39)\c-";

View file

@ -73,14 +73,18 @@ extend Class SWWMUtility
{
// unicode is fun
static const int digs[] = {0x2070,0x00B9,0x00B2,0x00B3,0x2074,0x2075,0x2076,0x2077,0x2078,0x2079};
String str = "";
int digits = int(Log10(val));
for ( int i=digits; i>=0; i-- )
String str = String.Format("%d",val);
int len = str.CodePointCount();
String newstr = "";
for ( int i=0, pos=0; i<len; i++ )
{
int d = int(val/IntPow(10,i))%10;
str.AppendCharacter(digs[d]);
int ch;
[ch, pos] = str.GetNextCodePoint(pos);
if ( (ch >= 0x0030) || (ch <= 0x0039) ) newstr.AppendCharacter(digs[ch-0x0030]);
else if ( ch == 0x002D ) newstr.AppendCharacter(0x207A); // minus
// everything else gets ignored
}
return str;
return newstr;
}
static void ObscureText( String &str, int seed, bool alnum = false, bool minihud = false )