summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-06-18 23:00:55 +0000
committerglx <glx@openttd.org>2007-06-18 23:00:55 +0000
commit23af871615557914fd36744afe46a93a360603ce (patch)
treef4318f970123dab2462d27992cd283f78f4d5885 /src/strings.cpp
parent7d6c255044a1e6b9a60d31468d870493270db13c (diff)
downloadopenttd-23af871615557914fd36744afe46a93a360603ce.tar.xz
(svn r10211) -Feature: [NewGRF] Add support for action 0F
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index f434bf90f..24fc29c47 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -28,6 +28,7 @@
#include "cargotype.h"
#include "group.h"
#include "debug.h"
+#include "newgrf_townname.h"
/* for opendir/readdir/closedir */
# include "fios.h"
@@ -825,8 +826,8 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
} else {
int32 temp[2];
- temp[0] = st->town->townnametype;
- temp[1] = st->town->townnameparts;
+ temp[0] = STR_TOWN;
+ temp[1] = st->town->index;
buff = GetStringWithArgs(buff, st->string_id, temp, last);
}
break;
@@ -839,7 +840,21 @@ static char* FormatString(char* buff, const char* str, const int32* argv, uint c
assert(IsValidTown(t));
temp[0] = t->townnameparts;
- buff = GetStringWithArgs(buff, t->townnametype, temp, last);
+ uint32 grfid = t->townnamegrfid;
+
+ if (grfid == 0) {
+ /* Original town name */
+ buff = GetStringWithArgs(buff, t->townnametype, temp, last);
+ } else {
+ /* Newgrf town name */
+ if (GetGRFTownName(grfid) != NULL) {
+ /* The grf is loaded */
+ buff = GRFTownNameGenerate(buff, t->townnamegrfid, t->townnametype, t->townnameparts, last);
+ } else {
+ /* Fallback to english original */
+ buff = GetStringWithArgs(buff, SPECSTR_TOWNNAME_ENGLISH, temp, last);
+ }
+ }
break;
}