mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use {ZEROFILL_NUM} instead of custom seprintf + {RAW_STRING}
This commit is contained in:
parent
e97bf271dc
commit
29b09523d1
|
@ -5521,10 +5521,10 @@ STR_VEHICLE_NAME_AIRCRAFT_POWERNAUT_HELICOPTER :Powernaut Helic
|
|||
|
||||
##id 0x8800
|
||||
# Formatting of some strings
|
||||
STR_FORMAT_DATE_TINY :{RAW_STRING}-{RAW_STRING}-{NUM}
|
||||
STR_FORMAT_DATE_TINY :{ZEROFILL_NUM}-{ZEROFILL_NUM}-{NUM}
|
||||
STR_FORMAT_DATE_SHORT :{STRING} {NUM}
|
||||
STR_FORMAT_DATE_LONG :{STRING} {STRING} {NUM}
|
||||
STR_FORMAT_DATE_ISO :{2:NUM}-{1:RAW_STRING}-{0:RAW_STRING}
|
||||
STR_FORMAT_DATE_ISO :{2:NUM}-{1:ZEROFILL_NUM}-{0:ZEROFILL_NUM}
|
||||
|
||||
STR_FORMAT_COMPANY_NUM :(Company {COMMA})
|
||||
STR_FORMAT_GROUP_NAME :Group {COMMA}
|
||||
|
|
|
@ -448,13 +448,8 @@ static char *FormatTinyOrISODate(char *buff, Date date, StringID str, const char
|
|||
YearMonthDay ymd;
|
||||
ConvertDateToYMD(date, &ymd);
|
||||
|
||||
char day[3];
|
||||
char month[3];
|
||||
/* We want to zero-pad the days and months */
|
||||
seprintf(day, lastof(day), "%02i", ymd.day);
|
||||
seprintf(month, lastof(month), "%02i", ymd.month + 1);
|
||||
|
||||
int64 args[] = {(int64)(size_t)day, (int64)(size_t)month, ymd.year};
|
||||
/* Day and month are zero-padded with ZEROFILL_NUM, hence the two 2s. */
|
||||
int64 args[] = {ymd.day, 2, ymd.month + 1, 2, ymd.year};
|
||||
StringParameters tmp_params(args);
|
||||
return FormatString(buff, GetStringPtr(str), &tmp_params, last);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue