(svn r14321) -Add: support for newgrfs printing bytes/words/dwords as hexadecimals.

This commit is contained in:
rubidium
2008-09-14 14:31:37 +00:00
parent 811193e468
commit 6ce4fe40f7
3 changed files with 32 additions and 1 deletions

View File

@@ -267,6 +267,10 @@ static char *FormatNoCommaNumber(char *buff, int64 number, const char *last)
return buff;
}
static char *FormatHexNumber(char *buff, int64 number, const char *last)
{
return buff + snprintf(buff, last - buff, "0x%x", (uint32)number);
}
static char *FormatYmdString(char *buff, Date date, const char* last)
{
@@ -815,6 +819,10 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
buff = FormatNoCommaNumber(buff, GetInt64(&argv), last);
break;
case SCC_HEX: // {HEX}
buff = FormatHexNumber(buff, GetInt64(&argv), last);
break;
case SCC_CURRENCY: // {CURRENCY}
buff = FormatGenericCurrency(buff, _currency, GetInt64(&argv), false, last);
break;