summaryrefslogtreecommitdiff
path: root/src/newgrf_text.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-20 22:35:11 +0000
committerfrosch <frosch@openttd.org>2011-08-20 22:35:11 +0000
commit26530063f137cbd5bdaebfb54338cadeb9fa2ed2 (patch)
tree0f33fb2dc02fef0ff6e4cffde879dd4d09e5f070 /src/newgrf_text.cpp
parentcc89bec4a2df692a7513a64e8b879cd603e4e5d3 (diff)
downloadopenttd-26530063f137cbd5bdaebfb54338cadeb9fa2ed2.tar.xz
(svn r22778) -Add: [NewGRF] Stringcodes for printing 0-based dates. (Hirundo)
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r--src/newgrf_text.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index 10d8cc692..a6e4d6800 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -567,6 +567,9 @@ 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;
+
default:
grfmsg(1, "missing handler for extended format code");
break;
@@ -1017,7 +1020,6 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_DWORD_SIGNED: *argv = _newgrf_textrefstack.PopSignedDWord(); break;
case SCC_NEWGRF_PRINT_BYTE_HEX: *argv = _newgrf_textrefstack.PopUnsignedByte(); break;
- case SCC_NEWGRF_PRINT_DWORD_HEX: *argv = _newgrf_textrefstack.PopUnsignedDWord(); break;
case SCC_NEWGRF_PRINT_QWORD_HEX: *argv = _newgrf_textrefstack.PopUnsignedQWord(); break;
case SCC_NEWGRF_PRINT_WORD_HEX:
@@ -1027,6 +1029,10 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
case SCC_NEWGRF_PRINT_WORD_UNSIGNED: *argv = _newgrf_textrefstack.PopUnsignedWord(); break;
+ case SCC_NEWGRF_PRINT_DWORD_DATE_LONG:
+ case SCC_NEWGRF_PRINT_DWORD_DATE_SHORT:
+ case SCC_NEWGRF_PRINT_DWORD_HEX: *argv = _newgrf_textrefstack.PopUnsignedDWord(); break;
+
case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
case SCC_NEWGRF_PRINT_WORD_DATE_SHORT: *argv = _newgrf_textrefstack.PopUnsignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; break;
@@ -1064,9 +1070,11 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const
return SCC_NEWGRF_PRINT_WORD_STRING_ID;
case SCC_NEWGRF_PRINT_WORD_DATE_LONG:
+ case SCC_NEWGRF_PRINT_DWORD_DATE_LONG:
return SCC_DATE_LONG;
case SCC_NEWGRF_PRINT_WORD_DATE_SHORT:
+ case SCC_NEWGRF_PRINT_DWORD_DATE_SHORT:
return SCC_DATE_SHORT;
case SCC_NEWGRF_PRINT_WORD_SPEED: