/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* nsc.c: Empire selection global structures
*
* Known contributors to this file:
- * Markus Armbruster, 2004-2006
+ * Markus Armbruster, 2004-2007
*/
/*
struct castr sect_ca[] = {
/* uid is encoded in x, y */
{NSC_NATID, 0, 0, fldoff(sctstr, sct_own), "owner", EF_NATION},
+ {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_elev), "elev", EF_BAD},
{NSC_XCOORD, NSC_CONST, 0, fldoff(sctstr, sct_x), "xloc", EF_BAD},
{NSC_YCOORD, NSC_CONST, 0, fldoff(sctstr, sct_y), "yloc", EF_BAD},
{NSC_UCHAR, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
"contacts", EF_BAD},
{NSC_UCHAR, NSC_EXTRA | NSC_BITS, MAXNOC, fldoff(natstr, nat_rejects),
"rejects", EF_NATION_REJECTS},
- /* FIXME nat_priorities[] */
{NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
EF_NATION_FLAGS},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
-/* initialized in ef_init_srv() */
+/* initialized by nsc_init() */
struct castr realm_ca[] = {
/* uid is encoded in cnum, realm */
};
struct castr game_ca[] = {
+ /* no need for uid */
+ {NSC_CHAR, 0, 0, offsetof(struct gamestr, game_upd_disable),
+ "upd_disable", EF_BAD},
{NSC_SHORT, 0, 0, offsetof(struct gamestr, game_turn), "turn", EF_BAD},
{NSC_SHORT, NSC_DEITY, 0, offsetof(struct gamestr, game_tick), "tick",
EF_BAD},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
+struct castr update_ca[] = {
+ {NSC_TIME, 0, 0, 0, "time", EF_BAD},
+ {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
+};
+
struct castr empfile_ca[] = {
{NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
{NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
{NSC_STRING, NSC_CONST, 0, offsetof(struct symbol, name), "name", EF_BAD},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
+
struct castr mdchr_ca[] = {
/* no need for uid */
/* name must come first, clients may rely on it */
EF_BAD},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
+
+void
+nsc_init(void)
+{
+ int i;
+ unsigned flags;
+
+ for (i = 0; cou_ca[i].ca_name; i++) {
+ nat_ca[i] = cou_ca[i];
+ flags = nat_ca[i].ca_flags;
+ if (flags & NSC_EXTRA)
+ flags &= ~NSC_EXTRA;
+ else if (i != 0)
+ flags |= NSC_DEITY;
+ nat_ca[i].ca_flags = flags;
+ }
+ nat_ca[i] = cou_ca[i];
+}