]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/nsc.c
New macro ARRAY_SIZE()
[empserver] / src / lib / common / nsc.c
index 0a37460bb0adda43d36d673bd3f65ef6671f4f19..d66493e64518f82ff000a0f2a3241341b9072a3e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2016, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
@@ -27,7 +27,7 @@
  *  nsc.c: Empire selection global structures
  *
  *  Known contributors to this file:
- *     Markus Armbruster, 2004-2016
+ *     Markus Armbruster, 2004-2020
  */
 
 /*
@@ -636,17 +636,24 @@ struct castr cou_ca[] = {
      EF_BAD, 0, CA_DUMP},
     {"happiness", fldoff(nat_level[NAT_HLEV]), NSC_FLOAT, 0, NULL,
      EF_BAD, 0, CA_DUMP},
-    {"relations", fldoff(nat_relate), NSC_UCHAR, MAXNOC, NULL,
-     EF_NATION_RELATIONS, NSC_HIDDEN, CA_DUMP_NONE},
-    {"rejects", fldoff(nat_rejects), NSC_UCHAR, MAXNOC, NULL,
-     EF_NATION_REJECTS, NSC_BITS, CA_DUMP_NONE},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0, CA_DUMP}
 #undef CURSTR
 };
 
-struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
+struct castr nat_ca[ARRAY_SIZE(cou_ca)];
 /* initialized by nsc_init() */
 
+struct castr relat_ca[] = {
+#define CURSTR struct relatstr
+    {"uid", fldoff(rel_uid), NSC_INT, 0, NULL, EF_RELAT, 0, CA_DUMP},
+    {"timestamp", fldoff(rel_timestamp), NSC_TIME, 0, NULL,
+     EF_BAD, 0, CA_DUMP_NONE},
+    {"relations", fldoff(rel_relate), NSC_UCHAR, MAXNOC, NULL,
+     EF_NATION_RELATIONS, NSC_HIDDEN, CA_DUMP},
+    {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0, CA_DUMP}
+#undef CURSTR
+};
+
 struct castr contact_ca[] = {
 #define CURSTR struct contactstr
     {"uid", fldoff(con_uid), NSC_INT, 0, NULL, EF_CONTACT, 0, CA_DUMP},
@@ -659,6 +666,17 @@ struct castr contact_ca[] = {
 #undef CURSTR
 };
 
+struct castr reject_ca[] = {
+#define CURSTR struct rejectstr
+    {"uid", fldoff(rej_uid), NSC_INT, 0, NULL, EF_REJECT, 0, CA_DUMP},
+    {"timestamp", fldoff(rej_timestamp), NSC_TIME, 0, NULL,
+     EF_BAD, 0, CA_DUMP_NONE},
+    {"rejects", fldoff(rej_rejects), NSC_UCHAR, MAXNOC, NULL,
+     EF_NATION_REJECTS, NSC_BITS, CA_DUMP},
+    {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0, CA_DUMP}
+#undef CURSTR
+};
+
 struct castr realm_ca[] = {
 #define CURSTR struct realmstr
     /* uid is encoded in cnum, realm */
@@ -734,7 +752,7 @@ struct castr empfile_ca[] = {
 struct castr symbol_ca[] = {
 #define CURSTR struct symbol
     /*
-     * value is is const because it has to match what is compiled into
+     * value is const because it has to match what is compiled into
      * the server.  name is const because clients key on it.
      */
     {"value", fldoff(value), NSC_INT, 0, NULL, EF_BAD, 0, CA_DUMP_CONST},