summaryrefslogtreecommitdiff
path: root/src/newgrf_text.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-10-29 20:56:58 +0000
committeryexo <yexo@openttd.org>2011-10-29 20:56:58 +0000
commit307ca24427928234fccd36a3235b296c0b9d21f3 (patch)
treec4b7f93a27df8000ce4546dbb04dfd0553352b1b /src/newgrf_text.cpp
parent8732e328c42e65c650527e25db557a4a64fcd661 (diff)
downloadopenttd-307ca24427928234fccd36a3235b296c0b9d21f3.tar.xz
(svn r23063) -Add: [NewGRF] stringscodes 9A 19 and 9A 20 to print 'short volume' and 'short weight' respectively
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r--src/newgrf_text.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index 4da01d2f1..e31e68ff0 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -377,7 +377,7 @@ struct UnmappedChoiceList : ZeroedMemoryAllocator {
const char *str = this->strings[this->strings.Contains(idx) ? idx : 0];
/* Limit the length of the string we copy to 0xFE. The length is written above
* as a byte and we need room for the final '\0'. */
- size_t len = min(0xFE, strlen(str));
+ size_t len = min<size_t>(0xFE, strlen(str));
memcpy(d, str, len);
d += len;
*d++ = '\0';
@@ -470,7 +470,7 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, bool allow_newline
case 0x84: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_DATE_LONG + c - 0x82); break;
case 0x85: d += Utf8Encode(d, SCC_NEWGRF_DISCARD_WORD); break;
case 0x86: d += Utf8Encode(d, SCC_NEWGRF_ROTATE_TOP_4_WORDS); break;
- case 0x87: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_VOLUME); break;
+ case 0x87: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_VOLUME_LONG); break;
case 0x88: d += Utf8Encode(d, SCC_BLUE); break;
case 0x89: d += Utf8Encode(d, SCC_SILVER); break;
case 0x8A: d += Utf8Encode(d, SCC_GOLD); break;
@@ -519,7 +519,7 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, bool allow_newline
/* 0x09, 0x0A are TTDPatch internal use only string codes. */
case 0x0B: d += Utf8Encode(d, SCC_NEWGRF_PRINT_QWORD_HEX); 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 0x0D: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG); break;
case 0x0E:
case 0x0F: {
if (str[0] == '\0') goto string_end;
@@ -582,7 +582,9 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, bool allow_newline
case 0x16:
case 0x17:
- case 0x18: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16); break;
+ case 0x18:
+ case 0x19:
+ case 0x20: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16); break;
default:
grfmsg(1, "missing handler for extended format code");
@@ -1038,11 +1040,13 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_QWORD_HEX: *argv = _newgrf_textrefstack.PopUnsignedQWord(); break;
case SCC_NEWGRF_PRINT_WORD_SPEED:
- case SCC_NEWGRF_PRINT_WORD_VOLUME:
+ case SCC_NEWGRF_PRINT_WORD_VOLUME_LONG:
+ case SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT:
case SCC_NEWGRF_PRINT_WORD_SIGNED: *argv = _newgrf_textrefstack.PopSignedWord(); break;
case SCC_NEWGRF_PRINT_WORD_HEX:
- case SCC_NEWGRF_PRINT_WORD_WEIGHT:
+ case SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG:
+ case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
case SCC_NEWGRF_PRINT_WORD_POWER:
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
case SCC_NEWGRF_PRINT_WORD_UNSIGNED: *argv = _newgrf_textrefstack.PopUnsignedWord(); break;
@@ -1098,12 +1102,18 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_SPEED:
return SCC_VELOCITY;
- case SCC_NEWGRF_PRINT_WORD_VOLUME:
+ case SCC_NEWGRF_PRINT_WORD_VOLUME_LONG:
return SCC_VOLUME;
- case SCC_NEWGRF_PRINT_WORD_WEIGHT:
+ case SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT:
+ return SCC_VOLUME_SHORT;
+
+ case SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG:
return SCC_WEIGHT;
+ case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
+ return SCC_WEIGHT_SHORT;
+
case SCC_NEWGRF_PRINT_WORD_POWER:
return SCC_POWER;