diff --git a/src/lang/english.txt b/src/lang/english.txt index 66bfb9f4fc..347b857b46 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5574,6 +5574,7 @@ STR_JUST_CURRENCY_LONG :{CURRENCY_LONG} STR_JUST_CARGO_LIST :{CARGO_LIST} STR_JUST_INT :{NUM} STR_JUST_DECIMAL :{DECIMAL} +STR_JUST_DECIMAL1 :{DECIMAL1} STR_JUST_DATE_TINY :{DATE_TINY} STR_JUST_DATE_SHORT :{DATE_SHORT} STR_JUST_DATE_LONG :{DATE_LONG} diff --git a/src/strings.cpp b/src/strings.cpp index c378d5e9a0..d04fa9a3f2 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1247,6 +1247,12 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg break; } + case SCC_DECIMAL1: {// {DECIMAL1} + int64 number = args->GetInt64(SCC_DECIMAL1); + buff = FormatCommaNumber(buff, number, last, 1); + break; + } + case SCC_NUM: // {NUM} buff = FormatNoCommaNumber(buff, args->GetInt64(SCC_NUM), last); break; diff --git a/src/table/control_codes.h b/src/table/control_codes.h index cef2d77f05..6fc9d35c77 100644 --- a/src/table/control_codes.h +++ b/src/table/control_codes.h @@ -87,6 +87,7 @@ enum StringControlCode { SCC_STRING, SCC_COMMA, SCC_DECIMAL, + SCC_DECIMAL1, SCC_NUM, SCC_ZEROFILL_NUM, SCC_HEX, diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index 371c63cd04..63532de1d7 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -104,6 +104,7 @@ static const CmdStruct _cmd_structs[] = { /* Numbers */ {"COMMA", EmitSingleChar, SCC_COMMA, 1, 0, C_NONE}, // Number with comma {"DECIMAL", EmitSingleChar, SCC_DECIMAL, 2, 0, C_NONE}, // Number with comma and fractional part. Second parameter is number of fractional digits, first parameter is number times 10**(second parameter). + {"DECIMAL1", EmitSingleChar, SCC_DECIMAL1, 1, 0, C_NONE}, // Decimal with fixed second parameter of 1 {"NUM", EmitSingleChar, SCC_NUM, 1, 0, C_NONE}, // Signed number {"ZEROFILL_NUM", EmitSingleChar, SCC_ZEROFILL_NUM, 2, 0, C_NONE}, // Unsigned number with zero fill, e.g. "02". First parameter is number, second minimum length {"BYTES", EmitSingleChar, SCC_BYTES, 1, 0, C_NONE}, // Unsigned number with "bytes", i.e. "1.02 MiB or 123 KiB"