project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ChickenLiver

Pages: [1]
1
User modifications / Re: Mod that comma delimits some monetary amounts
« on: February 20, 2010, 11:26:12 am »
Thanks for the suggestions.  I would have used the locale in the first place, but I've always found it rather difficult to find the relevant docs on such things.  Managed to find the function, however, and I'm now using it.

I'm using the numeric locale information rather than the currency specific information, because credits are being used instead of the locale's currency.  In the US, for example, prefixing the credit amount with 'c' instead of '$' would just look bizarre.

Also fixed up the style, and formatted a couple other large numbers.

Updated diff attached to first post.

2
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.

Pages: [1]