summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-20 23:07:37 +0000
committerfrosch <frosch@openttd.org>2011-08-20 23:07:37 +0000
commit3edfd1c9d291a5a8e542414e0bea7e7809d2092b (patch)
tree8afbdf31154970f385e230d088fd18b3fc1cbb00 /src
parent26530063f137cbd5bdaebfb54338cadeb9fa2ed2 (diff)
downloadopenttd-3edfd1c9d291a5a8e542414e0bea7e7809d2092b.tar.xz
(svn r22779) -Add: [NewGRF] Stringcode for printing a unsinged word in power units. (Hirundo)
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_text.cpp7
-rw-r--r--src/table/control_codes.h7
2 files changed, 10 insertions, 4 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index a6e4d6800..8aa4f935d 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -568,7 +568,8 @@ char *TranslateTTDPatchCodes(uint32 grfid, uint8 language_id, const char *str, i
break;
case 0x16:
- case 0x17: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16); break;
+ case 0x17:
+ case 0x18: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16); break;
default:
grfmsg(1, "missing handler for extended format code");
@@ -1026,6 +1027,7 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_SPEED:
case SCC_NEWGRF_PRINT_WORD_VOLUME:
case SCC_NEWGRF_PRINT_WORD_WEIGHT:
+ case SCC_NEWGRF_PRINT_WORD_POWER:
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
case SCC_NEWGRF_PRINT_WORD_UNSIGNED: *argv = _newgrf_textrefstack.PopUnsignedWord(); break;
@@ -1086,6 +1088,9 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_WEIGHT:
return SCC_WEIGHT;
+ case SCC_NEWGRF_PRINT_WORD_POWER:
+ return SCC_POWER;
+
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
return SCC_STATION_NAME;
diff --git a/src/table/control_codes.h b/src/table/control_codes.h
index 355ae8753..4d86b5a30 100644
--- a/src/table/control_codes.h
+++ b/src/table/control_codes.h
@@ -120,9 +120,9 @@ enum StringControlCode {
SCC_NEWGRF_PRINT_WORD_STRING_ID, ///< Read 2 bytes from the stack as String ID
SCC_NEWGRF_PRINT_WORD_DATE_LONG, ///< Read 2 bytes from the stack as base 1920 date
SCC_NEWGRF_PRINT_WORD_DATE_SHORT, ///< Read 2 bytes from the stack as base 1920 date
- SCC_NEWGRF_PRINT_WORD_SPEED, ///< Read 2 bytes from the stack as signed speed
- SCC_NEWGRF_PRINT_WORD_VOLUME, ///< Read 2 bytes from the stack as signed volume
- SCC_NEWGRF_PRINT_WORD_WEIGHT, ///< Read 2 bytes from the stack as signed weight
+ SCC_NEWGRF_PRINT_WORD_SPEED, ///< Read 2 bytes from the stack as unsigned speed
+ SCC_NEWGRF_PRINT_WORD_VOLUME, ///< Read 2 bytes from the stack as unsigned volume
+ SCC_NEWGRF_PRINT_WORD_WEIGHT, ///< Read 2 bytes from the stack as unsigned weight
SCC_NEWGRF_PRINT_WORD_STATION_NAME, ///< Read 2 bytes from the stack as station name
SCC_NEWGRF_PRINT_QWORD_CURRENCY, ///< Read 8 bytes from the stack as currency
SCC_NEWGRF_PRINT_BYTE_HEX, ///< Read 1 byte from the stack and print it as hex
@@ -131,6 +131,7 @@ enum StringControlCode {
SCC_NEWGRF_PRINT_QWORD_HEX, ///< Read 8 bytes from the stack and print it as hex
SCC_NEWGRF_PRINT_DWORD_DATE_LONG, ///< Read 4 bytes from the stack as base 0 date
SCC_NEWGRF_PRINT_DWORD_DATE_SHORT, ///< Read 4 bytes from the stack as base 0 date
+ SCC_NEWGRF_PRINT_WORD_POWER, ///< Read 2 bytes from the stack as unsigned power
SCC_NEWGRF_PUSH_WORD, ///< Pushes 2 bytes onto the stack
SCC_NEWGRF_UNPRINT, ///< "Unprints" the given number of bytes from the string
SCC_NEWGRF_DISCARD_WORD, ///< Discard the next two bytes