1
User modifications / Mod that comma delimits some monetary amounts
« on: February 20, 2010, 02:28:12 am »
Not really sure this is the right forum for this, as it requires recompilation, but I'm not submitting it as a patch because of the possibility it breaks some po files...Anyways...
Here's a small mod that adds thousand separators to some prices. Separator character and placement is based on regional settings. Stats screen, purchase screen, the credits display at the top, and only one or two other places currently affected. Makes it easier to parse large values, in my opinion. Replacing "*cvar:value" with "*cvar:formatInt:value" in *.ufo files will use thousand separators on integers. Note that it presumably only works in string fields, and not in functions. The way I modified the ufo syntax is a bit of a hack, but it works.
Not sure if I'll extend this to other screens that display prices. If anyone else cares to play with it, it's basically just replacing "variantOfSprintf(string, _("Possibly some stuff\t %i c"), cost)" with "variantOfSprintf(string, _("Possibly some stuff\t %s c"), FormatInt(cost))" all over the place. Note that this might cause issues with some of the translations in po files.
It also fixes a few minor bugs: No gap between number and c in max debits allowed and no terminating "c" at all on funding screen. Also, there was a bug in string length checking in Com_MacroExpandString().
Requires recompilation to run, unfortunately.
Here's a small mod that adds thousand separators to some prices. Separator character and placement is based on regional settings. Stats screen, purchase screen, the credits display at the top, and only one or two other places currently affected. Makes it easier to parse large values, in my opinion. Replacing "*cvar:value" with "*cvar:formatInt:value" in *.ufo files will use thousand separators on integers. Note that it presumably only works in string fields, and not in functions. The way I modified the ufo syntax is a bit of a hack, but it works.
Not sure if I'll extend this to other screens that display prices. If anyone else cares to play with it, it's basically just replacing "variantOfSprintf(string, _("Possibly some stuff\t %i c"), cost)" with "variantOfSprintf(string, _("Possibly some stuff\t %s c"), FormatInt(cost))" all over the place. Note that this might cause issues with some of the translations in po files.
It also fixes a few minor bugs: No gap between number and c in max debits allowed and no terminating "c" at all on funding screen. Also, there was a bug in string length checking in Com_MacroExpandString().
Requires recompilation to run, unfortunately.