summaryrefslogtreecommitdiff
path: root/newgrf_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'newgrf_config.c')
-rw-r--r--newgrf_config.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/newgrf_config.c b/newgrf_config.c
index aecdf4055..ac7b60fd5 100644
--- a/newgrf_config.c
+++ b/newgrf_config.c
@@ -6,6 +6,7 @@
#include "macros.h"
#include "debug.h"
#include "variables.h"
+#include "string.h"
#include "saveload.h"
#include "md5.h"
#include "newgrf.h"
@@ -261,6 +262,22 @@ const GRFConfig *GetGRFConfig(uint32 grfid)
}
+/* Build a space separated list of parameters, and terminate */
+char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last)
+{
+ uint i;
+
+ /* Return an empty string if there are no parameters */
+ if (c->num_params == 0) return strecpy(dst, "", last);
+
+ for (i = 0; i < c->num_params; i++) {
+ if (i > 0) dst = strecpy(dst, " ", last);
+ dst += snprintf(dst, last - dst, "%d", c->param[i]);
+ }
+ return dst;
+}
+
+
static const SaveLoad _grfconfig_desc[] = {
SLE_STR(GRFConfig, filename, SLE_STR, 0x40),
SLE_VAR(GRFConfig, grfid, SLE_UINT32),