]> git.pond.sub.org Git - empserver/commitdiff
Store uids as int to support more sectors and units
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 30 Dec 2009 13:07:51 +0000 (14:07 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2010 07:26:42 +0000 (08:26 +0100)
Before, they were stored as short.  Wider uids use more space, but the
next commit will recover it by narrowing other members.

The use of short has always limited the number of ships, planes, land
units and nukes to SHRT_MAX (commonly 32768).  Only the most extreme
games ever came close.

Commit 49780e2c (v4.3.12) added struct sctstr member sct_uid to make
struct empobj member uid work for sectors.  This made the limit apply
to sectors as well.  We've had games with more than 32768 sectors.

18 files changed:
include/commodity.h
include/empobj.h
include/file.h
include/game.h
include/land.h
include/loan.h
include/lost.h
include/nat.h
include/nsc.h
include/nuke.h
include/plane.h
include/sect.h
include/ship.h
include/trade.h
include/treaty.h
src/lib/commands/mfir.c
src/lib/common/cargo.c
src/lib/common/nsc.c

index e35457851aaee7515c5f13a044176e03767af396..a36d9b45dd8d1a161cdd71ca9d66b67330116b0d 100644 (file)
@@ -43,7 +43,7 @@
 struct comstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct comstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short com_uid;
+    int com_uid;
     unsigned com_seqno;
     time_t com_timestamp;
     natid com_owner;
     unsigned com_seqno;
     time_t com_timestamp;
     natid com_owner;
index 373ec0212ea745376a556258bee78b6ad0f7f155..5ff65486fbe369844d8d10e21394300ec12090fe 100644 (file)
@@ -56,7 +56,7 @@ struct empobj {
      * valid if EFF_TYPED is set in table's flags
      */
     short ef_type;
      * valid if EFF_TYPED is set in table's flags
      */
     short ef_type;
-    short uid;
+    int uid;
     unsigned seqno;
     time_t timestamp;
     /* end of part matching struct emptypedstr */
     unsigned seqno;
     time_t timestamp;
     /* end of part matching struct emptypedstr */
index 9aa6f38920565c961bb9dde952538e53040e668c..e0a56cadbe60e719e91e349250a56bf39e85c319 100644 (file)
@@ -86,7 +86,7 @@ struct empfile {
 
 struct emptypedstr {
     short ef_type;
 
 struct emptypedstr {
     short ef_type;
-    short uid;
+    int uid;
     unsigned seqno;
     time_t timestamp;
 };
     unsigned seqno;
     time_t timestamp;
 };
index 9f77dc0ff875a3cdbb14153c9de917151ed96928..a465d2ae19303bc30390423f138565e16f75ba8f 100644 (file)
@@ -39,7 +39,7 @@
 struct gamestr {
     /* initial part must match struct empobj */
     short ef_type;
 struct gamestr {
     /* initial part must match struct empobj */
     short ef_type;
-    short game_uid;
+    int game_uid;
     unsigned game_seqno;
     time_t game_timestamp;
     /* end of part matching struct empobj */
     unsigned game_seqno;
     time_t game_timestamp;
     /* end of part matching struct empobj */
index 2da78f6bde39a320c08b68a1b9ac4c408b9729e0..91d9f01c38e80a0892ba9f2b63e3e616c3442f48 100644 (file)
@@ -50,7 +50,7 @@
 struct lndstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct lndstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short lnd_uid;             /* unit id (land unit) */
+    int lnd_uid;               /* unit id (land #) */
     unsigned lnd_seqno;
     time_t lnd_timestamp;      /* Last time this unit was touched */
     natid lnd_own;             /* owner's country num */
     unsigned lnd_seqno;
     time_t lnd_timestamp;      /* Last time this unit was touched */
     natid lnd_own;             /* owner's country num */
@@ -66,7 +66,7 @@ struct lndstr {
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
     /* end of part matching struct empobj */
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
     /* end of part matching struct empobj */
-    short lnd_ship;            /* pointer to transporting ship */
+    int lnd_ship;              /* uid of transporting ship, or -1 */
     signed char lnd_harden;    /* fortification */
     short lnd_retreat;         /* retreat percentage */
     int lnd_rflags;            /* When do I retreat? */
     signed char lnd_harden;    /* fortification */
     short lnd_retreat;         /* retreat percentage */
     int lnd_rflags;            /* When do I retreat? */
@@ -75,7 +75,7 @@ struct lndstr {
     short lnd_item[I_MAX+1];   /* amount of items on board */
     short lnd_pstage;          /* plague stage */
     short lnd_ptime;           /* how many etus remain in this stage */
     short lnd_item[I_MAX+1];   /* amount of items on board */
     short lnd_pstage;          /* plague stage */
     short lnd_ptime;           /* how many etus remain in this stage */
-    short lnd_land;            /* pointer to transporting unit */
+    int lnd_land;              /* uid of transporting land unit, or -1 */
     short lnd_access;          /* Last tick mob was updated (MOB_ACCESS) */
 };
 
     short lnd_access;          /* Last tick mob was updated (MOB_ACCESS) */
 };
 
index f0a8416adeb1024db422c326318f474c680673c7..1015acb4bd6262e0ef0353cbc5428d5fe6b64609 100644 (file)
@@ -43,7 +43,7 @@
 struct lonstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct lonstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short l_uid;
+    int l_uid;
     unsigned l_seqno;
     time_t l_timestamp;
     /* end of part matching struct empobj */
     unsigned l_seqno;
     time_t l_timestamp;
     /* end of part matching struct empobj */
index 1f81eb78dd98faad67d6705c8e1cd9396b82ee5b..63e68d8c5f41f34f169de329cba99429cab36ae9 100644 (file)
 struct loststr {
     /* initial part must match struct empobj */
     short ef_type;
 struct loststr {
     /* initial part must match struct empobj */
     short ef_type;
-    short lost_uid;
+    int lost_uid;
     unsigned lost_seqno;
     time_t lost_timestamp;     /* When it was lost */
     natid lost_owner;          /* Who lost it */
     /* end of part matching struct empobj */
     short lost_type;           /* Type of thing (ship, plane, nuke, land, sector) */
     unsigned lost_seqno;
     time_t lost_timestamp;     /* When it was lost */
     natid lost_owner;          /* Who lost it */
     /* end of part matching struct empobj */
     short lost_type;           /* Type of thing (ship, plane, nuke, land, sector) */
-    short lost_id;             /* ID of lost thing */
+    int lost_id;               /* uid of lost thing (0 for sector)*/
     coord lost_x;
     coord lost_y;
 };
     coord lost_x;
     coord lost_y;
 };
index 5749a1bd0bdbafd7042651fd718ed138bb0387b6..ce1390151fcf144d2b803da582feafb6db767c4c 100644 (file)
@@ -71,7 +71,7 @@ enum nat_status {
 struct realmstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct realmstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short r_uid;               /* realm table index */
+    int r_uid;                 /* realm table index */
     unsigned r_seqno;
     time_t r_timestamp;                /* Last time this realm was touched */
     natid r_cnum;              /* country number */
     unsigned r_seqno;
     time_t r_timestamp;                /* Last time this realm was touched */
     natid r_cnum;              /* country number */
@@ -84,7 +84,7 @@ struct realmstr {
 struct natstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct natstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short nat_uid;             /* equals nat_cnum */
+    int nat_uid;               /* equals nat_cnum */
     unsigned nat_seqno;
     time_t nat_timestamp;
     natid nat_cnum;            /* our country number */
     unsigned nat_seqno;
     time_t nat_timestamp;
     natid nat_cnum;            /* our country number */
index 1ff8271c75ad99928b091034280235c8be4208cf..980d716db2e1ec261123da45b965c6785c70823f 100644 (file)
@@ -172,7 +172,7 @@ struct nstr_item {
     int dist;                  /* NS_DIST: distance selector */
     coord cx, cy;              /* NS_DIST: center x-y, NS_XY: xy */
     char group;                        /* NS_GROUP: fleet/wing match */
     int dist;                  /* NS_DIST: distance selector */
     coord cx, cy;              /* NS_DIST: center x-y, NS_XY: xy */
     char group;                        /* NS_GROUP: fleet/wing match */
-    short next;                        /* NS_CARGO: next item */
+    int next;                  /* NS_CARGO: next item */
     int size;                  /* NS_LIST: size of list */
     int index;                 /* NS_LIST: index */
     int list[NS_LSIZE];                /* NS_LIST: item list */
     int size;                  /* NS_LIST: size of list */
     int index;                 /* NS_LIST: index */
     int list[NS_LSIZE];                /* NS_LIST: item list */
index ccefbe23355e773f192e7e72914ca3098988fed3..d24a83edcb9d2d3bc6b884097370cc2713b57fb2 100644 (file)
@@ -43,7 +43,7 @@
 struct nukstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct nukstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short nuk_uid;
+    int nuk_uid;               /* unit id (nuke #) */
     unsigned nuk_seqno;
     time_t nuk_timestamp;      /* Last time this nuke was touched */
     natid nuk_own;
     unsigned nuk_seqno;
     time_t nuk_timestamp;      /* Last time this nuke was touched */
     natid nuk_own;
@@ -58,7 +58,7 @@ struct nukstr {
     short nuk_mission;         /* mission code, unused */
     short nuk_radius;          /* mission radius, unused */
     /* end of part matching struct empobj */
     short nuk_mission;         /* mission code, unused */
     short nuk_radius;          /* mission radius, unused */
     /* end of part matching struct empobj */
-    short nuk_plane;           /* currently aboard plane */
+    int nuk_plane;             /* uid of transporting plane, or -1 */
 };
 
 struct nchrstr {
 };
 
 struct nchrstr {
index 0079367c3f60e0948efe574a7dfcdbf643281083..fa3a3f5dbc4f2fdc6781079835e8a82538472913 100644 (file)
@@ -47,7 +47,7 @@
 struct plnstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct plnstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short pln_uid;             /* plane unit id */
+    int pln_uid;               /* unit id (plane #) */
     unsigned pln_seqno;
     time_t pln_timestamp;      /* Last time this plane was touched */
     natid pln_own;             /* owning country */
     unsigned pln_seqno;
     time_t pln_timestamp;      /* Last time this plane was touched */
     natid pln_own;             /* owning country */
@@ -65,8 +65,8 @@ struct plnstr {
     short pln_radius;          /* mission radius */
     /* end of part matching struct empobj */
     unsigned char pln_range;   /* total distance, not radius */
     short pln_radius;          /* mission radius */
     /* end of part matching struct empobj */
     unsigned char pln_range;   /* total distance, not radius */
-    short pln_ship;            /* pointer to carrier */
-    short pln_land;            /* pointer to carrier */
+    int pln_ship;              /* uid of carrier, or -1 */
+    int pln_land;              /* uid of transporting land unit, or -1 */
     signed char pln_harden;    /* for missiles */
     signed char pln_flags;     /* State of the plane */
     short pln_access;          /* Last tick mob was updated (MOB_ACCESS) */
     signed char pln_harden;    /* for missiles */
     signed char pln_flags;     /* State of the plane */
     short pln_access;          /* Last tick mob was updated (MOB_ACCESS) */
@@ -136,7 +136,7 @@ struct plist {
 extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
 
 struct shiplist {
 extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
 
 struct shiplist {
-    short uid;
+    int uid;
     struct shiplist *next;
 };
 
     struct shiplist *next;
 };
 
index 7c5f8673c9d55fa4551f374b6b803057aa0639be..01fda989dad2b496b346e91fda6281fcabe3f55a 100644 (file)
@@ -45,7 +45,7 @@
 struct sctstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct sctstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short sct_uid;             /* equals XYOFFSET(sct_x, sct_y) */
+    int sct_uid;               /* equals XYOFFSET(sct_x, sct_y) */
     unsigned sct_seqno;
     time_t sct_timestamp;      /* Last time this sector was written to */
     natid sct_own;             /* owner's country num */
     unsigned sct_seqno;
     time_t sct_timestamp;      /* Last time this sector was written to */
     natid sct_own;             /* owner's country num */
index bc92699d4c72b244d1a107d7006f349d14356357..a0b325d38e1b46805933ccf87eace31d4f9e6982 100644 (file)
@@ -64,7 +64,7 @@
 struct shpstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct shpstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short shp_uid;             /* unit id (ship #) */
+    int shp_uid;               /* unit it (ship #) */
     unsigned shp_seqno;
     time_t shp_timestamp;      /* Last time this ship was touched. */
     natid shp_own;             /* owner's country num */
     unsigned shp_seqno;
     time_t shp_timestamp;      /* Last time this ship was touched. */
     natid shp_own;             /* owner's country num */
@@ -93,7 +93,7 @@ struct shpstr {
     short shp_access;          /* Last tick mob was updated (MOB_ACCESS) */
     unsigned char shp_mobquota;        /* mobility quota */
     char shp_path[MAXSHPPATH];
     short shp_access;          /* Last tick mob was updated (MOB_ACCESS) */
     unsigned char shp_mobquota;        /* mobility quota */
     char shp_path[MAXSHPPATH];
-    short shp_follow;
+    int shp_follow;
     char shp_name[MAXSHPNAMLEN]; /* name set with the "name" command */
     coord shp_orig_x;
     coord shp_orig_y;          /* Where we were built */
     char shp_name[MAXSHPNAMLEN]; /* name set with the "name" command */
     coord shp_orig_x;
     coord shp_orig_y;          /* Where we were built */
index 6fc9919e274414e7aa20695cf7f73bce8582ad71..d40060c63a7fa49d9ee84a52979949209a5d4793 100644 (file)
 struct trdstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct trdstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short trd_uid;
+    int trd_uid;
     unsigned trd_seqno;
     time_t trd_timestamp;
     natid trd_owner;
     /* end of part matching struct empobj */
     short trd_type;
     unsigned trd_seqno;
     time_t trd_timestamp;
     natid trd_owner;
     /* end of part matching struct empobj */
     short trd_type;
-    short trd_unitid;
+    int trd_unitid;
     long trd_price;
     int trd_maxbidder;
     time_t trd_markettime;
     long trd_price;
     int trd_maxbidder;
     time_t trd_markettime;
index bef96d5998480fef6cde33b597c5b41e1f0ebe08..0c6902f67098a1a11d29e9c1aaedcafff48731d0 100644 (file)
@@ -40,7 +40,7 @@
 struct trtstr {
     /* initial part must match struct empobj */
     short ef_type;
 struct trtstr {
     /* initial part must match struct empobj */
     short ef_type;
-    short trt_uid;
+    int trt_uid;
     unsigned trt_seqno;
     time_t trt_timestamp;
     /* end of part matching struct empobj */
     unsigned trt_seqno;
     time_t trt_timestamp;
     /* end of part matching struct empobj */
index 88d110ff4c5b01fa926feef9583076b1729be545..aaf15727f88a6615d6ab07def14111152dac5a61 100644 (file)
@@ -46,7 +46,7 @@ enum targ_type {
 struct flist {
     struct emp_qelem queue;    /* list of fired things */
     short type;                        /* EF_SECTOR, EF_SHIP or EF_LAND */
 struct flist {
     struct emp_qelem queue;    /* list of fired things */
     short type;                        /* EF_SECTOR, EF_SHIP or EF_LAND */
-    short uid;
+    int uid;
     coord x, y;
     int defdam;                        /* damage defenders did */
     natid victim;
     coord x, y;
     int defdam;                        /* damage defenders did */
     natid victim;
index fd6d84a6a22920579198abcbeb4ef0373810c12e..b7774e37d1fa8c579330cf9b9be900b19f409397 100644 (file)
@@ -40,8 +40,8 @@
 #include "unit.h"
 
 struct clink {
 #include "unit.h"
 
 struct clink {
-    short next;
-    short head[EF_NUKE - EF_PLANE + 1];
+    int next;
+    int head[EF_NUKE - EF_PLANE + 1];
 };
 
 /*
 };
 
 /*
@@ -70,15 +70,15 @@ struct clink {
  * cargo lists know nothing about that.
  */
 static struct clink *clink[EF_NUKE + 1];
  * cargo lists know nothing about that.
  */
 static struct clink *clink[EF_NUKE + 1];
-static short nclink[EF_NUKE + 1];
+static int nclink[EF_NUKE + 1];
 
 /*
  * Return pointer to CL's cargo list head for file type TYPE.
  */
 
 /*
  * Return pointer to CL's cargo list head for file type TYPE.
  */
-static short *
+static int *
 clink_headp(struct clink *cl, int type)
 {
 clink_headp(struct clink *cl, int type)
 {
-    static short dummy;
+    static int dummy;
 
     if (CANT_HAPPEN(type < EF_PLANE || type > EF_NUKE)) {
        dummy = -1;
 
     if (CANT_HAPPEN(type < EF_PLANE || type > EF_NUKE)) {
        dummy = -1;
@@ -104,7 +104,7 @@ clink_init(struct clink *cl)
  * Check whether *UIDP is a valid uid for file type TYPE.
  */
 static void
  * Check whether *UIDP is a valid uid for file type TYPE.
  */
 static void
-clink_check1(short *uidp, int type)
+clink_check1(int *uidp, int type)
 {
     if (CANT_HAPPEN(*uidp >= nclink[type]))
        *uidp = -1;
 {
     if (CANT_HAPPEN(*uidp >= nclink[type]))
        *uidp = -1;
@@ -138,7 +138,7 @@ clink_check(int type)
 static void
 clink_add(struct clink *cl, int type, int uid)
 {
 static void
 clink_add(struct clink *cl, int type, int uid)
 {
-    short *head = clink_headp(cl, type);
+    int *head = clink_headp(cl, type);
 
     if (CANT_HAPPEN(type < 0 || type > EF_NUKE
                    || uid < 0 || uid >= nclink[type]))
 
     if (CANT_HAPPEN(type < 0 || type > EF_NUKE
                    || uid < 0 || uid >= nclink[type]))
@@ -157,10 +157,10 @@ clink_add(struct clink *cl, int type, int uid)
 static void
 clink_rem(struct clink *cl, int type, int uid)
 {
 static void
 clink_rem(struct clink *cl, int type, int uid)
 {
-    short *head = clink_headp(cl, type);
+    int *head = clink_headp(cl, type);
     struct clink *linkv;
     int n;
     struct clink *linkv;
     int n;
-    short *p;
+    int *p;
 
     if (CANT_HAPPEN(type < 0 || type > EF_NUKE))
        return;
 
     if (CANT_HAPPEN(type < 0 || type > EF_NUKE))
        return;
@@ -308,7 +308,7 @@ unit_onresize(int type)
 int
 unit_cargo_first(int type, int uid, int cargo_type)
 {
 int
 unit_cargo_first(int type, int uid, int cargo_type)
 {
-    short *headp;
+    int *headp;
 
     if (CANT_HAPPEN(type < EF_SHIP || type > EF_NUKE))
        return -1;
 
     if (CANT_HAPPEN(type < EF_SHIP || type > EF_NUKE))
        return -1;
index c237b5e0fd7a550773b4cee45f2bdd04c6f3372e..1281459a4cc50a315a48193fa9861ea83bd3cc83 100644 (file)
@@ -131,7 +131,7 @@ struct castr pchr_ca[] = {
 struct castr sect_ca[] = {
 #define CURSTR struct sctstr
     /* uid needs to be NSC_DEITY because it discloses true origin */
 struct castr sect_ca[] = {
 #define CURSTR struct sctstr
     /* uid needs to be NSC_DEITY because it discloses true origin */
-    {"uid", fldoff(sct_uid), NSC_SHORT, 0, NULL,
+    {"uid", fldoff(sct_uid), NSC_INT, 0, NULL,
      EF_SECTOR, NSC_DEITY | NSC_EXTRA},
     {"timestamp", fldoff(sct_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
      EF_SECTOR, NSC_DEITY | NSC_EXTRA},
     {"timestamp", fldoff(sct_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
@@ -211,7 +211,7 @@ struct castr dchr_ca[] = {
 };
 
 #define NSC_GENITEM(ef_type, ef_chr)                                   \
 };
 
 #define NSC_GENITEM(ef_type, ef_chr)                                   \
-    {"uid", empobjoff(uid),  NSC_SHORT, 0, NULL, ef_type, 0},          \
+    {"uid", empobjoff(uid),  NSC_INT, 0, NULL, ef_type, 0},            \
     {"timestamp", empobjoff(timestamp), NSC_TIME, 0, NULL, EF_BAD, NSC_EXTRA}, \
     {"owner", empobjoff(own),  NSC_NATID, 0, NULL, EF_NATION, 0},      \
     {"xloc", empobjoff(x),  NSC_XCOORD, 0, NULL, EF_BAD, 0},           \
     {"timestamp", empobjoff(timestamp), NSC_TIME, 0, NULL, EF_BAD, NSC_EXTRA}, \
     {"owner", empobjoff(own),  NSC_NATID, 0, NULL, EF_NATION, 0},      \
     {"xloc", empobjoff(x),  NSC_XCOORD, 0, NULL, EF_BAD, 0},           \
@@ -249,7 +249,7 @@ struct castr ship_ca[] = {
     {"access", fldoff(shp_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"mquota", fldoff(shp_mobquota), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     {"path", fldoff(shp_path), NSC_STRINGY, MAXSHPPATH, NULL, EF_BAD, 0},
     {"access", fldoff(shp_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"mquota", fldoff(shp_mobquota), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     {"path", fldoff(shp_path), NSC_STRINGY, MAXSHPPATH, NULL, EF_BAD, 0},
-    {"follow", fldoff(shp_follow), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"follow", fldoff(shp_follow), NSC_INT, 0, NULL, EF_BAD, 0},
     {"name", fldoff(shp_name), NSC_STRINGY, MAXSHPNAMLEN, NULL,
      EF_BAD, 0},
     /* should let builder access xbuilt, ybuilt, but can't express that: */
     {"name", fldoff(shp_name), NSC_STRINGY, MAXSHPNAMLEN, NULL,
      EF_BAD, 0},
     /* should let builder access xbuilt, ybuilt, but can't express that: */
@@ -300,8 +300,8 @@ struct castr plane_ca[] = {
     NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
     {"wing", fldoff(pln_wing), NSC_STRINGY, 1, NULL, EF_BAD, 0},
     {"range", fldoff(pln_range), NSC_UCHAR, 0, NULL, EF_BAD, 0},
     NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
     {"wing", fldoff(pln_wing), NSC_STRINGY, 1, NULL, EF_BAD, 0},
     {"range", fldoff(pln_range), NSC_UCHAR, 0, NULL, EF_BAD, 0},
-    {"ship", fldoff(pln_ship), NSC_SHORT, 0, NULL, EF_BAD, 0},
-    {"land", fldoff(pln_land), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"ship", fldoff(pln_ship), NSC_INT, 0, NULL, EF_BAD, 0},
+    {"land", fldoff(pln_land), NSC_INT, 0, NULL, EF_BAD, 0},
     {"harden", fldoff(pln_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
     {"flags", fldoff(pln_flags), NSC_CHAR, 0, NULL,
      EF_PLANE_FLAGS, NSC_BITS},
     {"harden", fldoff(pln_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
     {"flags", fldoff(pln_flags), NSC_CHAR, 0, NULL,
      EF_PLANE_FLAGS, NSC_BITS},
@@ -340,7 +340,7 @@ struct castr land_ca[] = {
 #define CURSTR struct lndstr
     NSC_GENITEM(EF_LAND, EF_LAND_CHR),
     {"army", fldoff(lnd_army), NSC_STRINGY, 1, NULL, EF_BAD, 0},
 #define CURSTR struct lndstr
     NSC_GENITEM(EF_LAND, EF_LAND_CHR),
     {"army", fldoff(lnd_army), NSC_STRINGY, 1, NULL, EF_BAD, 0},
-    {"ship", fldoff(lnd_ship), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"ship", fldoff(lnd_ship), NSC_INT, 0, NULL, EF_BAD, 0},
     {"harden", fldoff(lnd_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
     {"retreat", fldoff(lnd_retreat), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
     {"harden", fldoff(lnd_harden), NSC_CHAR, 0, NULL, EF_BAD, 0},
     {"retreat", fldoff(lnd_retreat), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"rflags", fldoff(lnd_rflags), NSC_INT, 0, NULL,
@@ -350,7 +350,7 @@ struct castr land_ca[] = {
     {"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, NULL,
      EF_PLAGUE_STAGES, NSC_DEITY},
     {"ptime", fldoff(lnd_ptime), NSC_SHORT, 0, NULL, EF_BAD, NSC_DEITY},
     {"pstage", fldoff(lnd_pstage), NSC_SHORT, 0, NULL,
      EF_PLAGUE_STAGES, NSC_DEITY},
     {"ptime", fldoff(lnd_ptime), NSC_SHORT, 0, NULL, EF_BAD, NSC_DEITY},
-    {"land", fldoff(lnd_land), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"land", fldoff(lnd_land), NSC_INT, 0, NULL, EF_BAD, 0},
     {"access", fldoff(lnd_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"att", 0, NSC_DOUBLE, 0, nsc_lnd_att, EF_BAD, NSC_EXTRA},
     {"def", 0, NSC_DOUBLE, 0, nsc_lnd_def, EF_BAD, NSC_EXTRA},
     {"access", fldoff(lnd_access), NSC_SHORT, 0, NULL, EF_BAD, 0},
     {"att", 0, NSC_DOUBLE, 0, nsc_lnd_att, EF_BAD, NSC_EXTRA},
     {"def", 0, NSC_DOUBLE, 0, nsc_lnd_def, EF_BAD, NSC_EXTRA},
@@ -406,7 +406,7 @@ struct castr lchr_ca[] = {
 struct castr nuke_ca[] = {
 #define CURSTR struct nukstr
     NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
 struct castr nuke_ca[] = {
 #define CURSTR struct nukstr
     NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
-    {"plane", fldoff(nuk_plane), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"plane", fldoff(nuk_plane), NSC_INT, 0, NULL, EF_BAD, 0},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
 #undef CURSTR
 };
@@ -432,7 +432,7 @@ struct castr nchr_ca[] = {
 
 struct castr treaty_ca[] = {
 #define CURSTR struct trtstr
 
 struct castr treaty_ca[] = {
 #define CURSTR struct trtstr
-    {"uid", fldoff(trt_uid), NSC_SHORT, 0, NULL, EF_TREATY, 0},
+    {"uid", fldoff(trt_uid), NSC_INT, 0, NULL, EF_TREATY, 0},
     {"timestamp", fldoff(trt_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"cna", fldoff(trt_cna), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"timestamp", fldoff(trt_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"cna", fldoff(trt_cna), NSC_NATID, 0, NULL, EF_NATION, 0},
@@ -450,7 +450,7 @@ struct castr treaty_ca[] = {
 
 struct castr loan_ca[] = {
 #define CURSTR struct lonstr
 
 struct castr loan_ca[] = {
 #define CURSTR struct lonstr
-    {"uid", fldoff(l_uid), NSC_SHORT, 0, NULL, EF_LOAN, 0},
+    {"uid", fldoff(l_uid), NSC_INT, 0, NULL, EF_LOAN, 0},
     {"timestamp", fldoff(l_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"loaner", fldoff(l_loner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"timestamp", fldoff(l_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"loaner", fldoff(l_loner), NSC_NATID, 0, NULL, EF_NATION, 0},
@@ -487,7 +487,7 @@ struct castr lost_ca[] = {
      EF_BAD, 0},
     {"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"type", fldoff(lost_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
      EF_BAD, 0},
     {"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"type", fldoff(lost_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
-    {"id", fldoff(lost_id), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"id", fldoff(lost_id), NSC_INT, 0, NULL, EF_BAD, 0},
     {"x", fldoff(lost_x), NSC_XCOORD, 0, NULL, EF_BAD, 0},
     {"y", fldoff(lost_y), NSC_YCOORD, 0, NULL, EF_BAD, 0},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
     {"x", fldoff(lost_x), NSC_XCOORD, 0, NULL, EF_BAD, 0},
     {"y", fldoff(lost_y), NSC_YCOORD, 0, NULL, EF_BAD, 0},
     {NULL, 0, NSC_NOTYPE, 0, NULL, EF_BAD, 0}
@@ -496,7 +496,7 @@ struct castr lost_ca[] = {
 
 struct castr commodity_ca[] = {
 #define CURSTR struct comstr
 
 struct castr commodity_ca[] = {
 #define CURSTR struct comstr
-    {"uid", fldoff(com_uid), NSC_SHORT, 0, NULL, EF_COMM, 0},
+    {"uid", fldoff(com_uid), NSC_INT, 0, NULL, EF_COMM, 0},
     {"timestamp", fldoff(com_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"owner", fldoff(com_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"timestamp", fldoff(com_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"owner", fldoff(com_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
@@ -517,12 +517,12 @@ struct castr commodity_ca[] = {
 
 struct castr trade_ca[] = {
 #define CURSTR struct trdstr
 
 struct castr trade_ca[] = {
 #define CURSTR struct trdstr
-    {"uid", fldoff(trd_uid), NSC_SHORT, 0, NULL, EF_TRADE, 0},
+    {"uid", fldoff(trd_uid), NSC_INT, 0, NULL, EF_TRADE, 0},
     {"timestamp", fldoff(trd_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"owner", fldoff(trd_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"type", fldoff(trd_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
     {"timestamp", fldoff(trd_timestamp), NSC_TIME, 0, NULL,
      EF_BAD, NSC_EXTRA},
     {"owner", fldoff(trd_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
     {"type", fldoff(trd_type), NSC_CHAR, 0, NULL, EF_TABLE, 0},
-    {"unitid", fldoff(trd_unitid), NSC_SHORT, 0, NULL, EF_BAD, 0},
+    {"unitid", fldoff(trd_unitid), NSC_INT, 0, NULL, EF_BAD, 0},
     {"price", fldoff(trd_price), NSC_LONG, 0, NULL, EF_BAD, 0},
     {"maxbidder", fldoff(trd_maxbidder), NSC_INT, 0, NULL, EF_NATION, 0},
     {"markettime", fldoff(trd_markettime), NSC_TIME, 0, NULL, EF_BAD, 0},
     {"price", fldoff(trd_price), NSC_LONG, 0, NULL, EF_BAD, 0},
     {"maxbidder", fldoff(trd_maxbidder), NSC_INT, 0, NULL, EF_NATION, 0},
     {"markettime", fldoff(trd_markettime), NSC_TIME, 0, NULL, EF_BAD, 0},