]> git.pond.sub.org Git - empserver/commitdiff
(sct_pstage, sct_ptime, shp_pstage, shp_ptime, lnd_pstage, lnd_ptime):
authorRon Koenderink <rkoenderink@yahoo.ca>
Sun, 12 Dec 2004 19:39:35 +0000 (19:39 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Sun, 12 Dec 2004 19:39:35 +0000 (19:39 +0000)
Use `short' instead of `unsigned short'.  With variables, plague stage
and time were stored unsigned and used signed, which worked.  Removal
of variables dropped the conversion to signed, which broke
plague_people() (plague.c rev. 1.6): stage didn't progress correctly
due to catastrophic underflow of time.

include/land.h
include/prototypes.h
include/sect.h
include/ship.h
src/lib/global/nsc.c
src/lib/update/land.c
src/lib/update/plague.c
src/lib/update/ship.c

index a63a6cb226db074437735bfd2c8d29807d815432..9e46e61b2ecedbfd881c44726c458349fe41c91b 100644 (file)
@@ -71,8 +71,8 @@ struct lndstr {
     u_char lnd_rad_max;                /* max radius for this unit */
     u_char lnd_scar;           /* how experienced the unit is (not used) */
     short lnd_item[I_MAX+1];   /* amount of items on board */
-    u_short lnd_pstage;                /* plague stage */
-    u_short lnd_ptime;         /* how many etus remain in this stage */
+    short lnd_pstage;          /* plague stage */
+    short lnd_ptime;           /* how many etus remain in this stage */
     short lnd_land;            /* pointer to transporting unit */
     u_char lnd_nland;
     time_t lnd_access;         /* Last time mob was updated (MOB_ACCESS) */
index 4162a766f88398d15519d8e48f30fbef61e83f1d..2d93ad01be4b8e9d9240f717617792eee8423fe7 100644 (file)
@@ -589,7 +589,7 @@ extern s_char *nxtitemp(struct nstr_item *, int);
 extern struct sctstr *nxtsctp(register struct nstr_sect *);
 /* plague.c */
 extern void do_plague(struct sctstr *, struct natstr *, int);
-extern int plague_people(struct natstr *, short *, u_short *, u_short *, int);
+extern int plague_people(struct natstr *, short *, int *, int *, int);
 /* plane.c */
 extern int prod_plane(int, int, int *, int);
 /* populace.c */
index 437bea90d25f6a2fbfc9c722c7cf534e0407a748..7cd4fa1ee934abfa6e8f4ff833decc890bc2f692 100644 (file)
@@ -75,8 +75,8 @@ struct sctstr {
     short sct_del[I_MAX+1];    /* delivieries */
     short sct_dist[I_MAX+1];   /* distribution thresholds */
     short sct_mines;           /* number of mines */
-    u_short sct_pstage;                /* plague stage */
-    u_short sct_ptime;         /* how many etus remain in this stage */
+    short sct_pstage;          /* plague stage */
+    short sct_ptime;           /* how many etus remain in this stage */
     u_char sct_che;            /* number of guerrillas */
     natid sct_che_target;      /* nation targeted by che */
     u_short sct_fallout;
index a66848daacbc709b1f3e102f7ef1714fc3fc9d08..7c4c0e62a066d066a490c70b62f79466abf64f7f 100644 (file)
@@ -87,8 +87,8 @@ struct shpstr {
     short shp_lend[TMAX];      /* How much do we pick up at the end    */
     u_char shp_autonav;                /* autonavigation flags */
     short shp_item[I_MAX+1];   /* amount of items on board */
-    u_short shp_pstage;                /* plague stage */
-    u_short shp_ptime;         /* how many etus remain in this stage */
+    short shp_pstage;          /* plague stage */
+    short shp_ptime;           /* how many etus remain in this stage */
     time_t shp_access;         /* Last time mob was updated (MOB_ACCESS) */
     time_t shp_timestamp;      /* Last time this ship was touched. */
     u_char shp_mobquota;       /* mobility quota */
index 4d28940a973f93b2612484ce832118b51e57ead3..f31bf228efeb17ecce19d0af7eb05fc8cd17c46d 100644 (file)
@@ -103,8 +103,8 @@ struct castr sect_ca[] = {
     NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
     NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines"},
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage"},
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime"},
     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che"},
     {NSC_NATID, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target"},
     {NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout"},
@@ -146,8 +146,8 @@ struct castr ship_ca[] = {
     {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lend), "amtend"},
     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav"},
     NSC_IVEC(fldoff(shpstr, shp_item), ""),
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage"},
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime"},
     {NSC_TIME, 0, 0, fldoff(shpstr, shp_access), "access"},
     {NSC_TIME, NSC_EXTRA, 0, fldoff(shpstr, shp_timestamp), "timestamp"},
     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_mobquota), "mobquota"},
@@ -195,8 +195,8 @@ struct castr land_ca[] = {
     {NSC_STRINGY, 0, RET_LEN, fldoff(lndstr, lnd_rpath), "rpath"},
     {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_rad_max), "react"},
     NSC_IVEC(fldoff(lndstr, lnd_item), ""),
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage"},
-    {NSC_USHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage"},
+    {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime"},
     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land"},
     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nland), "nland"},
     {NSC_TIME, 0, 0, fldoff(lndstr, lnd_access), "access"},
index b653ef8bd21bfeb1abefecee33164bd1ac9d122d..8c0ff5787898d6b88df20b6fe7e4d5532ca7384d 100644 (file)
@@ -115,7 +115,7 @@ upd_land(struct lndstr *lp, int etus,
               /* build = 1, maintain = 0 */
 {
     struct lchrstr *lcp;
-    u_short pstage, ptime;
+    int pstage, ptime;\r
     int n;
     int min = morale_base - (int)np->nat_level[NAT_HLEV];
     int mult;
index 7165e04bc9a49eeca5ba6db2a7ec284eb1374187..4fd782c557b940dc15239ee5d398844381ccabce 100644 (file)
@@ -52,7 +52,7 @@ static int infect_people(struct natstr *, struct sctstr *);
 void
 do_plague(struct sctstr *sp, struct natstr *np, int etu)
 {
-    u_short pstage, ptime;
+    int pstage, ptime;\r
     int n;
 
     if (opt_NO_PLAGUE)         /* no plague nothing to do */
@@ -152,7 +152,7 @@ infect_people(struct natstr *np, struct sctstr *sp)
  */
 int
 plague_people(struct natstr *np, short *vec,
-             u_short *pstage, u_short *ptime,
+             int *pstage, int *ptime,
              int etus)
 {
     int stage;
index c5c090efa48f55cde7dcb3132938e8eac555f932..02328a3bd192c4c4dfdfa0cb3335bcee06b87018 100644 (file)
@@ -115,7 +115,7 @@ upd_ship(struct shpstr *sp, int etus,
 {
     struct sctstr *sectp;
     struct mchrstr *mp;
-    u_short pstage, ptime;
+    int pstage, ptime;\r
     int oil_gained;
     int max_oil;
     int max_food;