1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 05:29:11 +00:00

Codechange: Use {ZEROFILL_NUM} instead of custom seprintf + {RAW_STRING}

This commit is contained in:
Rubidium
2023-04-16 19:36:43 +02:00
committed by rubidium42
parent e97bf271dc
commit 29b09523d1
2 changed files with 4 additions and 9 deletions

View File

@@ -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);
}