summaryrefslogtreecommitdiff
path: root/src/newgrf_text.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-12-23 13:38:50 +0000
committerfrosch <frosch@openttd.org>2016-12-23 13:38:50 +0000
commitb25afb239a81ef47d2339daed343d3a169d8863a (patch)
tree1d9e3ffe256ed3cbe2f921e44010f70b15c95d74 /src/newgrf_text.cpp
parent2c8b84f21daab684afb8e4bc241f71a0260eced6 (diff)
downloadopenttd-b25afb239a81ef47d2339daed343d3a169d8863a.tar.xz
(svn r27706) -Feature: [NewGRF] String command 9A 1E to print the name of a cargo type.
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r--src/newgrf_text.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index daf9db443..2c9fe6579 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -527,6 +527,7 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, bool allow_newline
case 0x1B:
case 0x1C:
case 0x1D:
+ case 0x1E:
d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16);
break;
@@ -996,6 +997,7 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
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_CARGO_NAME:
if (argv_size < 1) {
DEBUG(misc, 0, "Too many NewGRF string parameters.");
return 0;
@@ -1059,6 +1061,10 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_STRING_ID:
*argv = MapGRFStringID(_newgrf_textrefstack.grffile->grfid, _newgrf_textrefstack.PopUnsignedWord());
break;
+
+ case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
+ *argv = 1 << GetCargoTranslation(_newgrf_textrefstack.PopUnsignedWord(), _newgrf_textrefstack.grffile);
+ break;
}
} else {
/* Consume additional parameter characters */
@@ -1128,6 +1134,9 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_CARGO_TINY:
return SCC_CARGO_TINY;
+ case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
+ return SCC_CARGO_LIST;
+
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
return SCC_STATION_NAME;