]> git.pond.sub.org Git - empserver/commitdiff
(do_conv, enli, explore, move, shoo, s_commod): sct_mobil was changed
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 23 Mar 2006 07:58:03 +0000 (07:58 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 23 Mar 2006 07:58:03 +0000 (07:58 +0000)
from u_char to short in 3.0.0, but many assignments still cast to
u_char.  Remove casts.

src/lib/commands/conv.c
src/lib/commands/enli.c
src/lib/commands/expl.c
src/lib/commands/move.c
src/lib/commands/shoo.c
src/lib/subs/supply.c

index 5d5e71afe7b9b404285383e196b60dc07ad91613..89e5117996b8684945aa56c6586ce1f71b702aa1 100644 (file)
@@ -159,7 +159,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
        mob = roundavg(mob * 0.2);
        if (mob > sect.sct_mobil)
            mob = sect.sct_mobil;
-       sect.sct_mobil -= (u_char)mob;
+       sect.sct_mobil -= mob;
        pr("%3d conquered civilians converted in %s (%d)\n",
           newuw, xyas(sect.sct_x, sect.sct_y, player->cnum), uw + newuw);
        if (civ == 0) {
index 34ce7cd03171683ca5262752376bfa938f3dc848..df89f2899b22642b80abe578468af698a32e829e 100644 (file)
@@ -117,10 +117,8 @@ enli(void)
        sect.sct_item[I_CIVIL] = civ - newmil;
        pr("%3d enlisted in %s (%d)\n", newmil,
           xyas(sect.sct_x, sect.sct_y, player->cnum), mil + newmil);
-       if (sect.sct_mobil > 0) {
-           sect.sct_mobil = (u_char)((float)sect.sct_mobil *
-                                     (1.0 - (float)newmil / (float)civ));
-       }
+       if (sect.sct_mobil > 0)
+           sect.sct_mobil *= 1.0 - (double)newmil / (double)civ;
        putsect(&sect);
        if (totalmil >= 10000) {
            pr("Rioting in induction center interrupts enlistment\n");
index cae8cc79b32b3428fff3413d3d2b8488e45a8e5e..7127186f00a9d60ddd98a2be2528a0238b66ee79 100644 (file)
@@ -95,7 +95,7 @@ explore(void)
        return RET_SYN;
     }
     own = sect.sct_own;
-    mob = (int)sect.sct_mobil;
+    mob = sect.sct_mobil;
     if (vtype == I_CIVIL && sect.sct_oldown != own) {
        pr("You can't explore with conquered populace!\n");
        return RET_SYN;
@@ -172,14 +172,14 @@ explore(void)
     if (mcost < 0) {
        pr("\nExplore aborted");
        getsect(start.sct_x, start.sct_y, &sect);
-       sect.sct_mobil = (u_char)mob;
+       sect.sct_mobil = mob;
     } else {
        /* Charge mobility */
        getsect(sect.sct_x, sect.sct_y, &sect);
        n = sect.sct_mobil - mcost;
        if (n < 0)
            n = 0;
-       sect.sct_mobil = (u_char)n;
+       sect.sct_mobil = n;
        pr(", %d mob left in %s", sect.sct_mobil,
           xyas(sect.sct_x, sect.sct_y, player->cnum));
        putsect(&sect);
index b231c1ae02f28bcc0b4d2da8d04f2c0b0130b9df..dcd386daca41d77dcb58df8fb68f47b9c28e7803 100644 (file)
@@ -107,7 +107,7 @@ move(void)
        return RET_FAIL;
     }
     own = sect.sct_own;
-    mob = (int)sect.sct_mobil;
+    mob = sect.sct_mobil;
     if (!istest && vtype == I_CIVIL && sect.sct_oldown != own) {
        pr("You can't move conquered populace!\n");
        return RET_FAIL;
@@ -217,7 +217,7 @@ move(void)
     if (mcost < 0) {
        pr("Move aborted\n");
        getsect(x, y, &sect);
-       sect.sct_mobil = (u_char)mob;
+       sect.sct_mobil = mob;
        left = mob;
     } else {
        if (!istest) {
@@ -231,7 +231,7 @@ move(void)
                    mob = 0;
            } else
                mob -= mcost;
-           start.sct_mobil = (u_char)mob;
+           start.sct_mobil = mob;
            left = start.sct_mobil;
            putsect(&start);
        }
index eaef97d7ed37d564291805ee4323fc540d611cda..44fd9fd134d6c3d69713b56d674350d7376598e4 100644 (file)
@@ -53,7 +53,6 @@ shoo(void)
     struct nstr_sect nstr;
     struct nstr_item ni;
     int nshot;
-    int mob_cost;
     double m;
     i_type item;
     struct ichrstr *ip;
@@ -109,8 +108,7 @@ shoo(void)
            m = 0;
        if (m > sect.sct_mobil)
            m = sect.sct_mobil;
-       mob_cost = roundavg(m);
-       sect.sct_mobil -= (u_char)mob_cost;
+       sect.sct_mobil -= roundavg(m);
        sect.sct_item[item] -= nshot;
        pr("BANG!! (thump) %d %s shot in %s!\n",
           nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum));
index a417f3a99a4af8e5d4692a81d9f6d380742a7305..7f0e805a64cf46b8d00bcddfaa35abf8fc429a3d 100644 (file)
@@ -236,7 +236,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
                n = 0;
            if (n > sect.sct_mobil)
                n = sect.sct_mobil;
-           sect.sct_mobil -= (u_char)n;
+           sect.sct_mobil -= n;
 
            if (actually_doit)
                putsect(&sect);
@@ -254,7 +254,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
                n = 0;
            if (n > sect.sct_mobil)
                n = sect.sct_mobil;
-           sect.sct_mobil -= (u_char)n;
+           sect.sct_mobil -= n;
 
            if (actually_doit)
                putsect(&sect);
@@ -308,7 +308,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
                n = 0;
            if (n > sect.sct_mobil)
                n = sect.sct_mobil;
-           sect.sct_mobil -= (u_char)n;
+           sect.sct_mobil -= n;
            if (actually_doit) {
                putship(ship.shp_uid, &ship);
                putsect(&sect);
@@ -325,7 +325,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
                n = 0;
            if (n > sect.sct_mobil)
                n = sect.sct_mobil;
-           sect.sct_mobil -= (u_char)n;
+           sect.sct_mobil -= n;
 
            if (actually_doit) {
                putship(ship.shp_uid, &ship);