(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.
This commit is contained in:
Markus Armbruster 2006-03-23 07:58:03 +00:00
parent 5c423d1e42
commit aebcc536e4
6 changed files with 14 additions and 18 deletions

View file

@ -159,7 +159,7 @@ do_conv(struct nstr_sect nstr, int uwtoconvert, int for_real)
mob = roundavg(mob * 0.2); mob = roundavg(mob * 0.2);
if (mob > sect.sct_mobil) if (mob > sect.sct_mobil)
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", pr("%3d conquered civilians converted in %s (%d)\n",
newuw, xyas(sect.sct_x, sect.sct_y, player->cnum), uw + newuw); newuw, xyas(sect.sct_x, sect.sct_y, player->cnum), uw + newuw);
if (civ == 0) { if (civ == 0) {

View file

@ -117,10 +117,8 @@ enli(void)
sect.sct_item[I_CIVIL] = civ - newmil; sect.sct_item[I_CIVIL] = civ - newmil;
pr("%3d enlisted in %s (%d)\n", newmil, pr("%3d enlisted in %s (%d)\n", newmil,
xyas(sect.sct_x, sect.sct_y, player->cnum), mil + newmil); xyas(sect.sct_x, sect.sct_y, player->cnum), mil + newmil);
if (sect.sct_mobil > 0) { if (sect.sct_mobil > 0)
sect.sct_mobil = (u_char)((float)sect.sct_mobil * sect.sct_mobil *= 1.0 - (double)newmil / (double)civ;
(1.0 - (float)newmil / (float)civ));
}
putsect(&sect); putsect(&sect);
if (totalmil >= 10000) { if (totalmil >= 10000) {
pr("Rioting in induction center interrupts enlistment\n"); pr("Rioting in induction center interrupts enlistment\n");

View file

@ -95,7 +95,7 @@ explore(void)
return RET_SYN; return RET_SYN;
} }
own = sect.sct_own; own = sect.sct_own;
mob = (int)sect.sct_mobil; mob = sect.sct_mobil;
if (vtype == I_CIVIL && sect.sct_oldown != own) { if (vtype == I_CIVIL && sect.sct_oldown != own) {
pr("You can't explore with conquered populace!\n"); pr("You can't explore with conquered populace!\n");
return RET_SYN; return RET_SYN;
@ -172,14 +172,14 @@ explore(void)
if (mcost < 0) { if (mcost < 0) {
pr("\nExplore aborted"); pr("\nExplore aborted");
getsect(start.sct_x, start.sct_y, &sect); getsect(start.sct_x, start.sct_y, &sect);
sect.sct_mobil = (u_char)mob; sect.sct_mobil = mob;
} else { } else {
/* Charge mobility */ /* Charge mobility */
getsect(sect.sct_x, sect.sct_y, &sect); getsect(sect.sct_x, sect.sct_y, &sect);
n = sect.sct_mobil - mcost; n = sect.sct_mobil - mcost;
if (n < 0) if (n < 0)
n = 0; n = 0;
sect.sct_mobil = (u_char)n; sect.sct_mobil = n;
pr(", %d mob left in %s", sect.sct_mobil, pr(", %d mob left in %s", sect.sct_mobil,
xyas(sect.sct_x, sect.sct_y, player->cnum)); xyas(sect.sct_x, sect.sct_y, player->cnum));
putsect(&sect); putsect(&sect);

View file

@ -107,7 +107,7 @@ move(void)
return RET_FAIL; return RET_FAIL;
} }
own = sect.sct_own; own = sect.sct_own;
mob = (int)sect.sct_mobil; mob = sect.sct_mobil;
if (!istest && vtype == I_CIVIL && sect.sct_oldown != own) { if (!istest && vtype == I_CIVIL && sect.sct_oldown != own) {
pr("You can't move conquered populace!\n"); pr("You can't move conquered populace!\n");
return RET_FAIL; return RET_FAIL;
@ -217,7 +217,7 @@ move(void)
if (mcost < 0) { if (mcost < 0) {
pr("Move aborted\n"); pr("Move aborted\n");
getsect(x, y, &sect); getsect(x, y, &sect);
sect.sct_mobil = (u_char)mob; sect.sct_mobil = mob;
left = mob; left = mob;
} else { } else {
if (!istest) { if (!istest) {
@ -231,7 +231,7 @@ move(void)
mob = 0; mob = 0;
} else } else
mob -= mcost; mob -= mcost;
start.sct_mobil = (u_char)mob; start.sct_mobil = mob;
left = start.sct_mobil; left = start.sct_mobil;
putsect(&start); putsect(&start);
} }

View file

@ -53,7 +53,6 @@ shoo(void)
struct nstr_sect nstr; struct nstr_sect nstr;
struct nstr_item ni; struct nstr_item ni;
int nshot; int nshot;
int mob_cost;
double m; double m;
i_type item; i_type item;
struct ichrstr *ip; struct ichrstr *ip;
@ -109,8 +108,7 @@ shoo(void)
m = 0; m = 0;
if (m > sect.sct_mobil) if (m > sect.sct_mobil)
m = sect.sct_mobil; m = sect.sct_mobil;
mob_cost = roundavg(m); sect.sct_mobil -= roundavg(m);
sect.sct_mobil -= (u_char)mob_cost;
sect.sct_item[item] -= nshot; sect.sct_item[item] -= nshot;
pr("BANG!! (thump) %d %s shot in %s!\n", pr("BANG!! (thump) %d %s shot in %s!\n",
nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum)); nshot, ip->i_name, xyas(sect.sct_x, sect.sct_y, player->cnum));

View file

@ -236,7 +236,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
n = 0; n = 0;
if (n > sect.sct_mobil) if (n > sect.sct_mobil)
n = sect.sct_mobil; n = sect.sct_mobil;
sect.sct_mobil -= (u_char)n; sect.sct_mobil -= n;
if (actually_doit) if (actually_doit)
putsect(&sect); putsect(&sect);
@ -254,7 +254,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
n = 0; n = 0;
if (n > sect.sct_mobil) if (n > sect.sct_mobil)
n = sect.sct_mobil; n = sect.sct_mobil;
sect.sct_mobil -= (u_char)n; sect.sct_mobil -= n;
if (actually_doit) if (actually_doit)
putsect(&sect); putsect(&sect);
@ -308,7 +308,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
n = 0; n = 0;
if (n > sect.sct_mobil) if (n > sect.sct_mobil)
n = sect.sct_mobil; n = sect.sct_mobil;
sect.sct_mobil -= (u_char)n; sect.sct_mobil -= n;
if (actually_doit) { if (actually_doit) {
putship(ship.shp_uid, &ship); putship(ship.shp_uid, &ship);
putsect(&sect); putsect(&sect);
@ -325,7 +325,7 @@ s_commod(int own, int x, int y, i_type type, int total_wanted,
n = 0; n = 0;
if (n > sect.sct_mobil) if (n > sect.sct_mobil)
n = sect.sct_mobil; n = sect.sct_mobil;
sect.sct_mobil -= (u_char)n; sect.sct_mobil -= n;
if (actually_doit) { if (actually_doit) {
putship(ship.shp_uid, &ship); putship(ship.shp_uid, &ship);