summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-06-18 23:00:55 +0000
committerglx <glx@openttd.org>2007-06-18 23:00:55 +0000
commit23af871615557914fd36744afe46a93a360603ce (patch)
treef4318f970123dab2462d27992cd283f78f4d5885 /src/newgrf_config.cpp
parent7d6c255044a1e6b9a60d31468d870493270db13c (diff)
downloadopenttd-23af871615557914fd36744afe46a93a360603ce.tar.xz
(svn r10211) -Feature: [NewGRF] Add support for action 0F
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 74ec3b837..2c1cb15a4 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -124,8 +124,9 @@ void ClearGRFConfigList(GRFConfig **config)
/** Copy a GRF Config list
* @param dst pointer to destination list
* @param src pointer to source list values
+ * @param init_only the copied GRF will be processed up to GLS_INIT
* @return pointer to the last value added to the destination list */
-GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src)
+GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src, bool init_only)
{
/* Clear destination as it will be overwritten */
ClearGRFConfigList(dst);
@@ -143,6 +144,8 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src)
if (src->error->custom_message != NULL) c->error->custom_message = strdup(src->error->custom_message);
}
+ if (init_only) SETBIT(c->flags, GCF_INIT_ONLY);
+
*dst = c;
dst = &c->next;
}
@@ -190,7 +193,7 @@ void AppendStaticGRFConfigs(GRFConfig **dst)
GRFConfig **tail = dst;
while (*tail != NULL) tail = &(*tail)->next;
- CopyGRFConfigList(tail, _grfconfig_static);
+ CopyGRFConfigList(tail, _grfconfig_static, false);
RemoveDuplicatesFromGRFConfigList(*dst);
}
@@ -210,14 +213,7 @@ void AppendToGRFConfigList(GRFConfig **dst, GRFConfig *el)
/* Reset the current GRF Config to either blank or newgame settings */
void ResetGRFConfig(bool defaults)
{
- GRFConfig **c = &_grfconfig;
-
- if (defaults) {
- c = CopyGRFConfigList(c, _grfconfig_newgame);
- } else {
- ClearGRFConfigList(c);
- }
-
+ CopyGRFConfigList(&_grfconfig, _grfconfig_newgame, !defaults);
AppendStaticGRFConfigs(&_grfconfig);
}