Feature: NewGRF string codes for 0-based dates. diff -r acfd32f81907 src/newgrf_text.cpp --- a/src/newgrf_text.cpp Sat Aug 20 15:11:18 2011 +0200 +++ b/src/newgrf_text.cpp Sat Aug 20 15:11:53 2011 +0200 @@ -567,6 +567,9 @@ } break; + case 0x16: + case 0x17: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE + code - 0x16); break; + default: grfmsg(1, "missing handler for extended format code"); break; @@ -1017,7 +1020,6 @@ case SCC_NEWGRF_PRINT_DWORD: *argv = _newgrf_textrefstack.PopSignedDWord(); break; case SCC_NEWGRF_PRINT_HEX_BYTE: *argv = _newgrf_textrefstack.PopUnsignedByte(); break; - case SCC_NEWGRF_PRINT_HEX_DWORD: *argv = _newgrf_textrefstack.PopUnsignedDWord(); break; case SCC_NEWGRF_PRINT_HEX_QWORD: *argv = _newgrf_textrefstack.PopSignedQWord(); break; case SCC_NEWGRF_PRINT_HEX_WORD: @@ -1030,6 +1032,10 @@ case SCC_NEWGRF_PRINT_WORD_DATE: case SCC_NEWGRF_PRINT_WORD_MONTH_YEAR: *argv = _newgrf_textrefstack.PopUnsignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; break; + case SCC_NEWGRF_PRINT_DWORD_DATE: + case SCC_NEWGRF_PRINT_DWORD_MONTH_YEAR: + case SCC_NEWGRF_PRINT_HEX_DWORD: *argv = _newgrf_textrefstack.PopUnsignedDWord(); break; + case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack.PopUnsignedWord(); break; case SCC_NEWGRF_ROTATE_TOP_4_WORDS: _newgrf_textrefstack.RotateTop4Words(); break; @@ -1064,9 +1070,11 @@ return SCC_NEWGRF_PRINT_STRING_ID; case SCC_NEWGRF_PRINT_WORD_DATE: + case SCC_NEWGRF_PRINT_DWORD_DATE: return SCC_DATE_LONG; case SCC_NEWGRF_PRINT_WORD_MONTH_YEAR: + case SCC_NEWGRF_PRINT_DWORD_MONTH_YEAR: return SCC_DATE_SHORT; case SCC_NEWGRF_PRINT_WORD_SPEED: diff -r acfd32f81907 src/table/control_codes.h --- a/src/table/control_codes.h Sat Aug 20 15:11:18 2011 +0200 +++ b/src/table/control_codes.h Sat Aug 20 15:11:53 2011 +0200 @@ -118,6 +118,8 @@ SCC_NEWGRF_PRINT_UNSIGNED_WORD, ///< Read 2 bytes from the stack as unsigned value SCC_NEWGRF_PRINT_DWORD_CURRENCY, ///< Read 4 bytes from the stack as currency SCC_NEWGRF_PRINT_STRING_ID, ///< Read 2 bytes from the stack as String ID + SCC_NEWGRF_PRINT_DWORD_DATE, ///< Read 4 bytes from the stack as base 0 date + SCC_NEWGRF_PRINT_DWORD_MONTH_YEAR, ///< Read 4 bytes from the stack as base 0 date SCC_NEWGRF_PRINT_WORD_DATE, ///< Read 2 bytes from the stack as base 1920 date SCC_NEWGRF_PRINT_WORD_MONTH_YEAR, ///< Read 2 bytes from the stack as base 1920 date SCC_NEWGRF_PRINT_WORD_SPEED, ///< Read 2 bytes from the stack as signed speed