diff options
author | peter1138 <peter1138@openttd.org> | 2006-12-10 11:29:14 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-12-10 11:29:14 +0000 |
commit | 0d5e3344fb92893eab104e287c3d6f88ddf5f409 (patch) | |
tree | dd0fc29db7a6a9141e65ad3b6e2d0d173cce9991 /newgrf_config.c | |
parent | 778f97c78650897448d9d901be2943bde99a0a45 (diff) | |
download | openttd-0d5e3344fb92893eab104e287c3d6f88ddf5f409.tar.xz |
(svn r7464) -Codechange: move BuildParamList from newgrf_gui to newgrf_config and
prefix with GRF.
Diffstat (limited to 'newgrf_config.c')
-rw-r--r-- | newgrf_config.c | 17 |
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), |