diff options
author | ludde <ludde@openttd.org> | 2005-07-15 18:30:13 +0000 |
---|---|---|
committer | ludde <ludde@openttd.org> | 2005-07-15 18:30:13 +0000 |
commit | 3486e7e9d5d24e2e0595b7a8d517581b926b85cd (patch) | |
tree | 77cbbb71361c4ceb1306dc06c65b6364221d6c2f /strings.c | |
parent | 157addf5e9d85e513355edb97d513443ba9c131f (diff) | |
download | openttd-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.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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"); } |