summaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
authorludde <ludde@openttd.org>2005-07-15 18:30:13 +0000
committerludde <ludde@openttd.org>2005-07-15 18:30:13 +0000
commit3486e7e9d5d24e2e0595b7a8d517581b926b85cd (patch)
tree77cbbb71361c4ceb1306dc06c65b6364221d6c2f /strings.c
parent157addf5e9d85e513355edb97d513443ba9c131f (diff)
downloadopenttd-3486e7e9d5d24e2e0595b7a8d517581b926b85cd.tar.xz
(svn r2580) Change: Added {INDUSTRY} command for printing industry names instead of the old {TOWN} {STRING} way.
- The formatting of the industry name can be controlled with the string STR_INDUSTRY_FORMAT. Change: Changed several occurences of {STRING1} into {TOWN} to get rid of townnametype being used directly.
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/strings.c b/strings.c
index 03eb5be36..9e1db8a55 100644
--- a/strings.c
+++ b/strings.c
@@ -10,6 +10,7 @@
#include "news.h"
#include "screenshot.h"
#include "waypoint.h"
+#include "industry.h"
static char *StationGetSpecialString(char *buff, int x);
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed);
@@ -529,11 +530,27 @@ static char *FormatString(char *buff, const char *str, const int32 *argv)
break;
}
- case 10: {
+ case 10: { /* {STATIONFEATURES} */
buff = StationGetSpecialString(buff, GetInt32(&argv));
break;
}
+ case 11: { /* {INDUSTRY} */
+ Industry *i = GetIndustry(GetInt32(&argv));
+ int32 args[2];
+
+ // industry not valid anymore?
+ if (i->xy == 0)
+ break;
+
+ // First print the town name and the industry type name
+ // The string STR_INDUSTRY_PATTERN controls the formatting
+ args[0] = i->town->index;
+ args[1] = i->type + STR_4802_COAL_MINE;
+ buff = FormatString(buff, GetStringPtr(STR_INDUSTRY_FORMAT), args);
+ break;
+ }
+
default:
error("!invalid escape sequence in string");
}