From 6ce4fe40f7b17dcd7a76f0b2a88038726934cd71 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 14 Sep 2008 14:31:37 +0000 Subject: (svn r14321) -Add: support for newgrfs printing bytes/words/dwords as hexadecimals. --- src/newgrf_text.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/newgrf_text.cpp') diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index ce3bda10c..4178eda0a 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -284,6 +284,16 @@ char *TranslateTTDPatchCodes(uint32 grfid, const char *str) d += Utf8Encode(d, SCC_NEWGRF_UNPRINT); d += Utf8Encode(d, *str++); break; + case 6: + d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_BYTE); + break; + case 7: + d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_WORD); + break; + case 8: + d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_DWORD); + break; + default: grfmsg(1, "missing handler for extended format code"); break; @@ -625,6 +635,10 @@ uint RemapNewGRFStringControlCode(uint scc, char **buff, const char **str, int64 case SCC_NEWGRF_PRINT_DWORD_CURRENCY: 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_WORD: case SCC_NEWGRF_PRINT_WORD_SPEED: case SCC_NEWGRF_PRINT_WORD_LITRES: case SCC_NEWGRF_PRINT_UNSIGNED_WORD: *argv = _newgrf_textrefstack->PopUnsignedWord(); break; @@ -653,6 +667,11 @@ uint RemapNewGRFStringControlCode(uint scc, char **buff, const char **str, int64 case SCC_NEWGRF_PRINT_UNSIGNED_WORD: return SCC_COMMA; + case SCC_NEWGRF_PRINT_HEX_BYTE: + case SCC_NEWGRF_PRINT_HEX_WORD: + case SCC_NEWGRF_PRINT_HEX_DWORD: + return SCC_HEX; + case SCC_NEWGRF_PRINT_DWORD_CURRENCY: case SCC_NEWGRF_PRINT_QWORD_CURRENCY: return SCC_CURRENCY; -- cgit v1.2.3-54-g00ecf