summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-10-18 20:35:59 +0000
committerglx <glx@openttd.org>2007-10-18 20:35:59 +0000
commitf3d79154eb20f7a77b67c51f078bc9e0b3ba0644 (patch)
tree679c53438421bed321195e97ced6e0a2e0b32a4a
parente0461fcd6a5223662233036bf3c66eda1b634c82 (diff)
downloadopenttd-f3d79154eb20f7a77b67c51f078bc9e0b3ba0644.tar.xz
(svn r11293) -Fix: newgrf defined industry news messages use TTD format for args, which is not the same as our. So we must detect those strings and pass them the right params
-rw-r--r--src/industry_cmd.cpp22
-rw-r--r--src/newgrf_text.cpp2
-rw-r--r--src/strgen/strgen.cpp5
3 files changed, 22 insertions, 7 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 28dcd8dc6..bdd6fc6dc 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1621,7 +1621,12 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
const Industry *ind = CreateNewIndustryHelper(RandomTile(), p1, flags, indspec, tilespec_index);
if (ind != NULL) {
SetDParam(0, indspec->name);
- SetDParam(1, ind->town->index);
+ if (indspec->new_industry_text > STR_LAST_STRINGID) {
+ SetDParam(1, STR_TOWN);
+ SetDParam(2, ind->town->index);
+ } else {
+ SetDParam(1, ind->town->index);
+ }
AddNewsItem(indspec->new_industry_text,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
break;
@@ -1829,7 +1834,12 @@ static void MaybeNewIndustry(void)
}
SetDParam(0, ind_spc->name);
- SetDParam(1, ind->town->index);
+ if (ind_spc->new_industry_text > STR_LAST_STRINGID) {
+ SetDParam(1, STR_TOWN);
+ SetDParam(2, ind->town->index);
+ } else {
+ SetDParam(1, ind->town->index);
+ }
AddNewsItem(ind_spc->new_industry_text,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
}
@@ -1984,7 +1994,13 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
}
if (!suppress_message && str != STR_NULL) {
- SetDParam(0, i->index);
+ if (str > STR_LAST_STRINGID) {
+ SetDParam(0, STR_TOWN);
+ SetDParam(1, i->town->index);
+ SetDParam(2, indspec->name);
+ } else {
+ SetDParam(0, i->index);
+ }
AddNewsItem(str,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, closeit ? NT_OPENCLOSE : NT_ECONOMY, 0),
i->xy + TileDiffXY(1, 1), 0);
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp
index 4fdec3f06..dac8300fd 100644
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -636,7 +636,7 @@ uint RemapNewGRFStringControlCode(uint scc, char **buff, const char **str, int64
return SCC_CURRENCY;
case SCC_NEWGRF_PRINT_STRING_ID:
- return SCC_STRING;
+ return SCC_STRING1;
case SCC_NEWGRF_PRINT_DATE:
return SCC_DATE_LONG;
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index cfae3814d..9b9c2dca3 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -1014,7 +1014,6 @@ static void WriteStringsH(const char *filename)
FILE *out;
int i;
int next = -1;
- int lastgrp;
out = fopen("tmp.xxx", "w");
if (out == NULL) fatal("can't open tmp.xxx");
@@ -1023,8 +1022,6 @@ static void WriteStringsH(const char *filename)
fprintf(out, "#ifndef TABLE_STRINGS_H\n");
fprintf(out, "#define TABLE_STRINGS_H\n");
- lastgrp = 0;
-
for (i = 0; i != lengthof(_strings); i++) {
if (_strings[i] != NULL) {
if (next != i) fprintf(out, "\n");
@@ -1033,6 +1030,8 @@ static void WriteStringsH(const char *filename)
}
}
+ fprintf(out, "\nstatic const StringID STR_LAST_STRINGID = 0x%X;\n", next - 1);
+
fprintf(out,
"\nenum {\n"
"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"