1
0
Fork 0

Codechange: swap `int + year` to `year + int`

This way the operator+ without implicit constructor call is used
pull/13214/head
Rubidium 2024-12-31 23:20:41 +01:00 committed by rubidium42
parent 58ba8c122b
commit 9b3f4dff4c
3 changed files with 4 additions and 4 deletions

View File

@ -366,8 +366,8 @@ void DeserializeNetworkGameInfo(Packet &p, NetworkGameInfo &info, const GameInfo
info.clients_on = p.Recv_uint8 ();
info.spectators_on = p.Recv_uint8 ();
if (game_info_version < 3) { // 16 bits dates got scrapped and are read earlier
info.calendar_date = p.Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
info.calendar_start = p.Recv_uint16() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
info.calendar_date = CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + p.Recv_uint16();
info.calendar_start = CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + p.Recv_uint16();
}
if (game_info_version < 6) while (p.Recv_uint8() != 0) {} // Used to contain the map-name.
info.map_width = p.Recv_uint16();

View File

@ -1018,7 +1018,7 @@ static ChangeInfoResult CommonVehicleChangeInfo(EngineInfo *ei, int prop, ByteRe
{
switch (prop) {
case 0x00: // Introduction date
ei->base_intro = buf.ReadWord() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR;
ei->base_intro = CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + buf.ReadWord();
break;
case 0x02: // Decay speed

View File

@ -905,7 +905,7 @@ char32_t RemapNewGRFStringControlCode(char32_t scc, const char **str, StringPara
/* Dates from NewGRFs have 1920-01-01 as their zero point, convert it to OpenTTD's epoch. */
case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
case SCC_NEWGRF_PRINT_WORD_DATE_SHORT: parameters.SetParam(0, _newgrf_textrefstack.PopUnsignedWord() + CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR); break;
case SCC_NEWGRF_PRINT_WORD_DATE_SHORT: parameters.SetParam(0, CalendarTime::DAYS_TILL_ORIGINAL_BASE_YEAR + _newgrf_textrefstack.PopUnsignedWord()); break;
case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack.PopUnsignedWord(); break;