Store uids as int to support more sectors and units
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.
This commit is contained in:
parent
18148f03fa
commit
ba2044be18
18 changed files with 50 additions and 50 deletions
|
@ -43,7 +43,7 @@
|
|||
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;
|
||||
|
|
|
@ -56,7 +56,7 @@ struct empobj {
|
|||
* 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 */
|
||||
|
|
|
@ -86,7 +86,7 @@ struct empfile {
|
|||
|
||||
struct emptypedstr {
|
||||
short ef_type;
|
||||
short uid;
|
||||
int uid;
|
||||
unsigned seqno;
|
||||
time_t timestamp;
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
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 */
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
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 */
|
||||
|
@ -66,7 +66,7 @@ struct lndstr {
|
|||
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? */
|
||||
|
@ -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_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) */
|
||||
};
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
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 */
|
||||
|
|
|
@ -40,13 +40,13 @@
|
|||
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) */
|
||||
short lost_id; /* ID of lost thing */
|
||||
int lost_id; /* uid of lost thing (0 for sector)*/
|
||||
coord lost_x;
|
||||
coord lost_y;
|
||||
};
|
||||
|
|
|
@ -71,7 +71,7 @@ enum nat_status {
|
|||
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 */
|
||||
|
@ -84,7 +84,7 @@ struct realmstr {
|
|||
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 */
|
||||
|
|
|
@ -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 */
|
||||
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 */
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
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;
|
||||
|
@ -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_plane; /* currently aboard plane */
|
||||
int nuk_plane; /* uid of transporting plane, or -1 */
|
||||
};
|
||||
|
||||
struct nchrstr {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
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 */
|
||||
|
@ -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_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) */
|
||||
|
@ -136,7 +136,7 @@ struct plist {
|
|||
extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
|
||||
|
||||
struct shiplist {
|
||||
short uid;
|
||||
int uid;
|
||||
struct shiplist *next;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
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 */
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
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 */
|
||||
|
@ -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_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 */
|
||||
|
|
|
@ -43,13 +43,13 @@
|
|||
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;
|
||||
short trd_unitid;
|
||||
int trd_unitid;
|
||||
long trd_price;
|
||||
int trd_maxbidder;
|
||||
time_t trd_markettime;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue