diff options
author | rubidium <rubidium@openttd.org> | 2008-09-14 14:31:37 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-09-14 14:31:37 +0000 |
commit | 6ce4fe40f7b17dcd7a76f0b2a88038726934cd71 (patch) | |
tree | 6bb9bd6e268d2b6609498af869e15e7a681ceff2 /src/newgrf_text.cpp | |
parent | 811193e46889850d4fef3454ed7301e017c6e4a6 (diff) | |
download | openttd-6ce4fe40f7b17dcd7a76f0b2a88038726934cd71.tar.xz |
(svn r14321) -Add: support for newgrfs printing bytes/words/dwords as hexadecimals.
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r-- | src/newgrf_text.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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; |