summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-11-19 23:55:34 +0000
committerrubidium <rubidium@openttd.org>2008-11-19 23:55:34 +0000
commita1853ea27c447c7320bd2669e187365f85c8f7aa (patch)
treeb6bd0fe6e7878375d317df4be1eba41cde3bac48 /src/strings.cpp
parente80a222d3154afdb9acc99afdf6008d6b30480c1 (diff)
downloadopenttd-a1853ea27c447c7320bd2669e187365f85c8f7aa.tar.xz
(svn r14598) -Feature: Action0Industries property 24 (industry suuplies default name for nearby station).
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index 010298062..8512a99c4 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -862,11 +862,24 @@ static char* FormatString(char* buff, const char* str, const int64* argv, uint c
if (st->name != NULL) {
buff = strecpy(buff, st->name, last);
} else {
+ StringID str = st->string_id;
+ if (st->indtype != IT_INVALID) {
+ /* Special case where the industry provides the name for the station */
+ const IndustrySpec *indsp = GetIndustrySpec(st->indtype);
+
+ /* Industry GRFs can change which might remove the station name and
+ * thus cause very strange things. Here we check for that before we
+ * actually set the station name. */
+ if (indsp->station_name != STR_NULL && indsp->station_name != STR_UNDEFINED) {
+ str = indsp->station_name;
+ }
+ }
+
int64 temp[3];
temp[0] = STR_TOWN;
temp[1] = st->town->index;
temp[2] = st->index;
- buff = GetStringWithArgs(buff, st->string_id, temp, last);
+ buff = GetStringWithArgs(buff, str, temp, last);
}
break;
}