diff options
author | rubidium <rubidium@openttd.org> | 2010-11-16 11:50:26 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-16 11:50:26 +0000 |
commit | 0f2a9877b8fd2032872e9b23d5e6a8b1b1f13200 (patch) | |
tree | c72b14ff7c7277ce2d0124b5fae8f189b198ae0a | |
parent | 4b4db5d86ea618e4aa4e71f16875c79d6f98b161 (diff) | |
download | openttd-0f2a9877b8fd2032872e9b23d5e6a8b1b1f13200.tar.xz |
(svn r21204) -Codechange: unify style of string code conversion
-rw-r--r-- | src/newgrf_text.cpp | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 6cba7c00c..3d7a1ad39 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -307,39 +307,26 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, const char *str, i case 0x98: d += Utf8Encode(d, SCC_BLACK); break; case 0x9A: switch (*str++) { - case 0: // FALL THROUGH - case 1: - d += Utf8Encode(d, SCC_NEWGRF_PRINT_QWORD_CURRENCY); - break; - case 3: { + case 0x00: // FALL THROUGH + case 0x01: d += Utf8Encode(d, SCC_NEWGRF_PRINT_QWORD_CURRENCY); break; + case 0x03: { uint16 tmp = ((uint8)*str++); tmp |= ((uint8)*str++) << 8; d += Utf8Encode(d, SCC_NEWGRF_PUSH_WORD); d += Utf8Encode(d, tmp); break; } - case 4: + case 0x04: 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; - case 0x0B: - d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_QWORD); - break; - case 0x0C: - d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_STATION_NAME); - break; - case 0x0D: - d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_WEIGHT); - break; + case 0x06: d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_BYTE); break; + case 0x07: d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_WORD); break; + case 0x08: d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_DWORD); break; + /* 0x09, 0x0A are TTDPatch internal use only string codes. */ + case 0x0B: d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_QWORD); break; + case 0x0C: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_STATION_NAME); break; + case 0x0D: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_WEIGHT); break; default: grfmsg(1, "missing handler for extended format code"); @@ -347,20 +334,20 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, const char *str, i } break; - case 0x9E: d += Utf8Encode(d, 0x20AC); break; // Euro - case 0x9F: d += Utf8Encode(d, 0x0178); break; // Y with diaeresis - case 0xA0: d += Utf8Encode(d, SCC_UPARROW); break; - case 0xAA: d += Utf8Encode(d, SCC_DOWNARROW); break; - case 0xAC: d += Utf8Encode(d, SCC_CHECKMARK); break; - case 0xAD: d += Utf8Encode(d, SCC_CROSS); break; - case 0xAF: d += Utf8Encode(d, SCC_RIGHTARROW); break; - case 0xB4: d += Utf8Encode(d, SCC_TRAIN); break; - case 0xB5: d += Utf8Encode(d, SCC_LORRY); break; - case 0xB6: d += Utf8Encode(d, SCC_BUS); break; - case 0xB7: d += Utf8Encode(d, SCC_PLANE); break; - case 0xB8: d += Utf8Encode(d, SCC_SHIP); break; + case 0x9E: d += Utf8Encode(d, 0x20AC); break; // Euro + case 0x9F: d += Utf8Encode(d, 0x0178); break; // Y with diaeresis + case 0xA0: d += Utf8Encode(d, SCC_UPARROW); break; + case 0xAA: d += Utf8Encode(d, SCC_DOWNARROW); break; + case 0xAC: d += Utf8Encode(d, SCC_CHECKMARK); break; + case 0xAD: d += Utf8Encode(d, SCC_CROSS); break; + case 0xAF: d += Utf8Encode(d, SCC_RIGHTARROW); break; + case 0xB4: d += Utf8Encode(d, SCC_TRAIN); break; + case 0xB5: d += Utf8Encode(d, SCC_LORRY); break; + case 0xB6: d += Utf8Encode(d, SCC_BUS); break; + case 0xB7: d += Utf8Encode(d, SCC_PLANE); break; + case 0xB8: d += Utf8Encode(d, SCC_SHIP); break; case 0xB9: d += Utf8Encode(d, SCC_SUPERSCRIPT_M1); break; - case 0xBC: d += Utf8Encode(d, SCC_SMALLUPARROW); break; + case 0xBC: d += Utf8Encode(d, SCC_SMALLUPARROW); break; case 0xBD: d += Utf8Encode(d, SCC_SMALLDOWNARROW); break; default: /* Validate any unhandled character */ |