summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-06-12 13:22:14 +0000
committermaedhros <maedhros@openttd.org>2007-06-12 13:22:14 +0000
commit109dd33c4a7d73ef08c2f02ca1b06475c6ba85b0 (patch)
tree5ee61ed1866ad23ad460d7ef74060ce9760f90df /src/newgrf_config.cpp
parentd1e71eb34e20d8871ab5f41ecc63389a4cc0a6b7 (diff)
downloadopenttd-109dd33c4a7d73ef08c2f02ca1b06475c6ba85b0.tar.xz
(svn r10114) -Fix: Only load newgrf error messages if the language matches the current
language. Since only one error can be loaded anyway, if the language didn't match you'd get "Undefined string". Also since we're only loading one language there's no need to use AddGRFString any more.
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 3e3cfdc52..6d6709c6b 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -97,7 +97,12 @@ void ClearGRFConfig(GRFConfig **config)
free((*config)->full_path);
free((*config)->name);
free((*config)->info);
- free((*config)->error);
+
+ if ((*config)->error != NULL) {
+ free((*config)->error->custom_message);
+ free((*config)->error->data);
+ free((*config)->error);
+ }
}
free(*config);
*config = NULL;
@@ -134,6 +139,8 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src)
if (src->error != NULL) {
c->error = CallocT<GRFError>(1);
memcpy(c->error, src->error, sizeof(GRFError));
+ if (src->error->data != NULL) c->error->data = strdup(src->error->data);
+ if (src->error->custom_message != NULL) c->error->custom_message = strdup(src->error->custom_message);
}
*dst = c;