From aebcc536e40c4d3bb8f6357b7a0200d8e77a5947 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 23 Mar 2006 07:58:03 +0000 Subject: [PATCH] (do_conv, enli, explore, move, shoo, s_commod): sct_mobil was changed from u_char to short in 3.0.0, but many assignments still cast to u_char. Remove casts. --- src/lib/commands/conv.c | 2 +- src/lib/commands/enli.c | 6 ++---- src/lib/commands/expl.c | 6 +++--- src/lib/commands/move.c | 6 +++--- src/lib/commands/shoo.c | 4 +--- src/lib/subs/supply.c | 8 ++++---- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/lib/commands/conv.c b/src/lib/commands/conv.c index 5d5e71afe..89e511799 100644 --- a/src/lib/commands/conv.c +++ b/src/lib/commands/conv.c @@ -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) { diff --git a/src/lib/commands/enli.c b/src/lib/commands/enli.c index 34ce7cd03..df89f2899 100644 --- a/src/lib/commands/enli.c +++ b/src/lib/commands/enli.c @@ -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(§); if (totalmil >= 10000) { pr("Rioting in induction center interrupts enlistment\n"); diff --git a/src/lib/commands/expl.c b/src/lib/commands/expl.c index cae8cc79b..7127186f0 100644 --- a/src/lib/commands/expl.c +++ b/src/lib/commands/expl.c @@ -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.sct_mobil = (u_char)mob; + sect.sct_mobil = mob; } else { /* Charge mobility */ getsect(sect.sct_x, sect.sct_y, §); 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(§); diff --git a/src/lib/commands/move.c b/src/lib/commands/move.c index b231c1ae0..dcd386dac 100644 --- a/src/lib/commands/move.c +++ b/src/lib/commands/move.c @@ -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.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); } diff --git a/src/lib/commands/shoo.c b/src/lib/commands/shoo.c index eaef97d7e..44fd9fd13 100644 --- a/src/lib/commands/shoo.c +++ b/src/lib/commands/shoo.c @@ -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)); diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index a417f3a99..7f0e805a6 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -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(§); @@ -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(§); @@ -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(§); @@ -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); -- 2.43.0