diff --git a/include/commodity.h b/include/commodity.h index a36d9b45..1f03fa78 100644 --- a/include/commodity.h +++ b/include/commodity.h @@ -42,9 +42,9 @@ struct comstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned com_seqno: 12; int com_uid; - unsigned com_seqno; time_t com_timestamp; natid com_owner; /* end of part matching struct empobj */ diff --git a/include/empobj.h b/include/empobj.h index 5ff65486..9574073d 100644 --- a/include/empobj.h +++ b/include/empobj.h @@ -55,9 +55,9 @@ struct empobj { * initial part must match struct emptypedstr * valid if EFF_TYPED is set in table's flags */ - short ef_type; + signed ef_type: 8; + unsigned seqno: 12; int uid; - unsigned seqno; time_t timestamp; /* end of part matching struct emptypedstr */ natid own; /* valid if EFF_OWNER is in table's flags */ @@ -76,7 +76,6 @@ struct empobj { }; union empobj_storage { - short ef_type; struct empobj gen; struct comstr comm; struct gamestr game; diff --git a/include/file.h b/include/file.h index e0a56cad..4c0424b4 100644 --- a/include/file.h +++ b/include/file.h @@ -85,9 +85,9 @@ struct empfile { }; struct emptypedstr { - short ef_type; + signed ef_type: 8; + unsigned seqno: 12; int uid; - unsigned seqno; time_t timestamp; }; diff --git a/include/game.h b/include/game.h index a465d2ae..a58d1bdb 100644 --- a/include/game.h +++ b/include/game.h @@ -38,9 +38,9 @@ struct gamestr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned game_seqno: 12; int game_uid; - unsigned game_seqno; time_t game_timestamp; /* end of part matching struct empobj */ char game_upd_disable; /* updates disabled? */ diff --git a/include/land.h b/include/land.h index 91d9f01c..5b1fb707 100644 --- a/include/land.h +++ b/include/land.h @@ -49,9 +49,9 @@ struct lndstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned lnd_seqno: 12; 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 */ coord lnd_x; /* x location in abs coords */ diff --git a/include/loan.h b/include/loan.h index 1015acb4..d4fae4c7 100644 --- a/include/loan.h +++ b/include/loan.h @@ -42,9 +42,9 @@ struct lonstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned l_seqno: 12; int l_uid; - unsigned l_seqno; time_t l_timestamp; /* end of part matching struct empobj */ natid l_loner; /* loan shark */ diff --git a/include/lost.h b/include/lost.h index 63e68d8c..0e40470c 100644 --- a/include/lost.h +++ b/include/lost.h @@ -39,9 +39,9 @@ struct loststr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned lost_seqno: 12; 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 */ diff --git a/include/nat.h b/include/nat.h index ce139015..5b658bdb 100644 --- a/include/nat.h +++ b/include/nat.h @@ -70,9 +70,9 @@ enum nat_status { */ struct realmstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned r_seqno: 12; int r_uid; /* realm table index */ - unsigned r_seqno; time_t r_timestamp; /* Last time this realm was touched */ natid r_cnum; /* country number */ /* end of part matching struct empobj */ @@ -83,9 +83,9 @@ struct realmstr { struct natstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned nat_seqno: 12; int nat_uid; /* equals nat_cnum */ - unsigned nat_seqno; time_t nat_timestamp; natid nat_cnum; /* our country number */ /* end of part matching struct empobj */ diff --git a/include/nuke.h b/include/nuke.h index d24a83ed..6a0db83f 100644 --- a/include/nuke.h +++ b/include/nuke.h @@ -42,9 +42,9 @@ struct nukstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned nuk_seqno: 12; int nuk_uid; /* unit id (nuke #) */ - unsigned nuk_seqno; time_t nuk_timestamp; /* Last time this nuke was touched */ natid nuk_own; coord nuk_x, nuk_y; /* current loc of device */ diff --git a/include/plane.h b/include/plane.h index fa3a3f5d..e77ee93a 100644 --- a/include/plane.h +++ b/include/plane.h @@ -46,9 +46,9 @@ struct plnstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned pln_seqno: 12; int pln_uid; /* unit id (plane #) */ - unsigned pln_seqno; time_t pln_timestamp; /* Last time this plane was touched */ natid pln_own; /* owning country */ coord pln_x; /* plane x-y */ diff --git a/include/sect.h b/include/sect.h index 01fda989..9b6fe8d8 100644 --- a/include/sect.h +++ b/include/sect.h @@ -44,9 +44,9 @@ struct sctstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned sct_seqno: 12; 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 */ coord sct_x; /* x coord of sector */ diff --git a/include/ship.h b/include/ship.h index a0b325d3..23cefa1f 100644 --- a/include/ship.h +++ b/include/ship.h @@ -63,9 +63,9 @@ struct shpstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned shp_seqno: 12; 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 */ coord shp_x; /* x location in abs coords */ diff --git a/include/trade.h b/include/trade.h index d40060c6..72ebdbbb 100644 --- a/include/trade.h +++ b/include/trade.h @@ -42,9 +42,9 @@ struct trdstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned trd_seqno: 12; int trd_uid; - unsigned trd_seqno; time_t trd_timestamp; natid trd_owner; /* end of part matching struct empobj */ diff --git a/include/treaty.h b/include/treaty.h index 0c6902f6..440d7f53 100644 --- a/include/treaty.h +++ b/include/treaty.h @@ -39,9 +39,9 @@ struct trtstr { /* initial part must match struct empobj */ - short ef_type; + signed ef_type: 8; + unsigned trt_seqno: 12; int trt_uid; - unsigned trt_seqno; time_t trt_timestamp; /* end of part matching struct empobj */ natid trt_cna; /* proposer */ diff --git a/src/lib/subs/unitsub.c b/src/lib/subs/unitsub.c index d91aae4b..f907ff7b 100644 --- a/src/lib/subs/unitsub.c +++ b/src/lib/subs/unitsub.c @@ -56,7 +56,7 @@ unit_list(struct emp_qelem *unit_list) return; qp = unit_list->q_back; ulp = (struct ulist *)qp; - type = ulp->unit.ef_type; + type = ulp->unit.gen.ef_type; if (CANT_HAPPEN(type != EF_LAND && type != EF_SHIP)) return; @@ -191,10 +191,10 @@ unit_view(struct emp_qelem *list) for (qp = list->q_back; qp != list; qp = next) { next = qp->q_back; ulp = (struct ulist *)qp; - if (CANT_HAPPEN(!(ef_flags(ulp->unit.ef_type) & EFF_XY))) + if (CANT_HAPPEN(!(ef_flags(ulp->unit.gen.ef_type) & EFF_XY))) continue; getsect(ulp->unit.gen.x, ulp->unit.gen.y, §); - if (ulp->unit.ef_type == EF_SHIP) { + if (ulp->unit.gen.ef_type == EF_SHIP) { if (((struct mchrstr *)ulp->chrp)->m_flags & M_FOOD) pr("[fert:%d] ", sect.sct_fertil); if (((struct mchrstr *)ulp->chrp)->m_flags & M_OIL)