#include "ship.h"
#include "server.h"
#include "trade.h"
-#include "version.h"
#include "xy.h"
static void sct_oninit(void *);
static void lchr_oninit(void *);
static void nchr_oninit(void *);
+static char dummy_cache;
+
/* Number of elements in ARRAY. */
#define SZ(array) (sizeof(array) / sizeof((array)[0]))
ARRAY_TABLE(empfile, EF_MAX, EFF_CFG),
NULL, NULL, NULL, NULL},
{EF_VERSION, "version", NULL, NULL, NULL, EF_BAD,
- sizeof(PACKAGE_STRING), -1, EFF_STATIC, version, 1, 0, 1, 1, -1,
+ 0, -1, EFF_MEM | EFF_STATIC, &dummy_cache, 1, 0, 1, 1, -1,
NULL, NULL, NULL, NULL},
{EF_META, "meta", NULL, NULL, mdchr_ca, EF_BAD,
PTR_CACHE(mdchr_ca, EFF_CFG),
#include <config.h>
+#include <limits.h>
#include <stdlib.h>
#include "empobj.h"
#include "optlist.h"
#include "nsc.h"
#include "product.h"
#include "unit.h"
+#include "version.h"
static void *nsc_ver(struct valstr *, struct natstr *, void *);
static void *nsc_ver_maxnoc(struct valstr *, struct natstr *, void *);
+static void *nsc_ver_version(struct valstr *, struct natstr *, void *);
static void *nsc_sct_terr(struct valstr *, struct natstr *, void *);
static void *nsc_sct_track(struct valstr *, struct natstr *, void *);
static void *nsc_cargo_nplane(struct valstr *, struct natstr *, void *);
nsc_init(void)
{
static struct castr version_ca0 = {
- "version", 0, NSC_STRINGY, sizeof(PACKAGE_STRING), NULL, EF_BAD, 0,
- CA_DUMP
+ "version", 0, NSC_STRING, 0, nsc_ver_version, EF_BAD, 0, CA_DUMP
};
static struct castr version_ca1 = {
"maxnoc", 0, NSC_LONG, 0, nsc_ver_maxnoc, EF_BAD, 0, CA_DUMP
return NULL;
}
+static void *
+nsc_ver_version(struct valstr *val, struct natstr *np, void *ptr)
+{
+ val->val_as.str.base = version;
+ val->val_as.str.maxsz = INT_MAX; /* really SIZE_MAX, but that's C99 */
+ return NULL;
+}
+
static void *
nsc_sct_terr(struct valstr *val, struct natstr *np, void *ptr)
{