Clean up dead stores
Does not change optimized code (gcc -O). Spotted by the Clang Static Analyzer.
This commit is contained in:
parent
3650587dab
commit
b8f5eaff0b
25 changed files with 66 additions and 116 deletions
|
@ -520,7 +520,6 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
continue;
|
||||
}
|
||||
|
||||
dam = 0;
|
||||
if (nuk_on_plane(&plp->plane) >= 0)
|
||||
hitchance = 100;
|
||||
else {
|
||||
|
@ -624,7 +623,6 @@ plane_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
continue;
|
||||
if (changed_plane_aborts(plp))
|
||||
continue;
|
||||
dam = 0;
|
||||
if (nuk_on_plane(&plp->plane) >= 0)
|
||||
hitchance = 100;
|
||||
else {
|
||||
|
@ -735,7 +733,6 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
continue;
|
||||
}
|
||||
|
||||
dam = 0;
|
||||
if (nuk_on_plane(&plp->plane) >= 0)
|
||||
hitchance = 100;
|
||||
else {
|
||||
|
|
|
@ -51,7 +51,6 @@ comm(void)
|
|||
return RET_SYN;
|
||||
prdate();
|
||||
(void)strcpy(dirstr, ". $");
|
||||
n = 1;
|
||||
for (n = 1; n <= 6; n++)
|
||||
dirstr[n] = dirch[n];
|
||||
nsect = 0;
|
||||
|
|
|
@ -49,7 +49,6 @@ cuto(void)
|
|||
return RET_SYN;
|
||||
prdate();
|
||||
(void)strcpy(dirstr, ". $");
|
||||
n = 1;
|
||||
for (n = 1; n <= 6; n++)
|
||||
dirstr[n] = dirch[n];
|
||||
nsect = 0;
|
||||
|
|
|
@ -54,7 +54,6 @@ dump(void)
|
|||
return RET_SYN;
|
||||
prdate();
|
||||
(void)strcpy(dirstr, ". $");
|
||||
n = 1;
|
||||
for (n = 1; n <= 6; n++)
|
||||
dirstr[n] = dirch[n];
|
||||
nsect = 0;
|
||||
|
|
|
@ -105,7 +105,7 @@ head(void)
|
|||
for (n = 0; n < 5; n++) {
|
||||
if ((scoop = head_findscoop(hist, maxcnum, &actor, &victim)) < 10)
|
||||
break;
|
||||
severity = head_printscoop(hist, actor, victim);
|
||||
head_printscoop(hist, actor, victim);
|
||||
hp = &hist[actor][victim];
|
||||
severity = hp->h_recent - hp->h_past;
|
||||
if (severity <= -scoop / 2 || severity >= scoop / 2) {
|
||||
|
|
|
@ -72,7 +72,6 @@ multifire(void)
|
|||
coord fy;
|
||||
coord x;
|
||||
coord y;
|
||||
int mil;
|
||||
int dam;
|
||||
int totaldefdam = 0;
|
||||
int vshipno;
|
||||
|
@ -265,7 +264,7 @@ multifire(void)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if ((mil = fship.shp_item[I_MILIT]) < 1) {
|
||||
if (fship.shp_item[I_MILIT] < 1) {
|
||||
pr("Not enough military for firing crew.\n");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ newe(void)
|
|||
if (twork > bwork) {
|
||||
twork = bwork;
|
||||
}
|
||||
work -= twork;
|
||||
bwork -= twork;
|
||||
eff -= twork * 4;
|
||||
if (eff <= 0) {
|
||||
|
@ -103,7 +102,6 @@ newe(void)
|
|||
if (twork > hcms)
|
||||
twork = hcms;
|
||||
}
|
||||
work -= twork;
|
||||
eff += twork;
|
||||
} else if (eff < 100) {
|
||||
twork = 100 - eff;
|
||||
|
@ -122,7 +120,6 @@ newe(void)
|
|||
if (twork > hcms)
|
||||
twork = hcms;
|
||||
}
|
||||
work -= twork;
|
||||
eff += twork;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -60,7 +60,7 @@ int
|
|||
orde(void)
|
||||
{
|
||||
int diffeachship = 0;
|
||||
int orders, sub, level;
|
||||
int sub, level;
|
||||
int scuttling = 0;
|
||||
struct nstr_item nb;
|
||||
struct shpstr ship;
|
||||
|
@ -121,7 +121,6 @@ orde(void)
|
|||
ship.shp_autonav &= ~AN_STANDBY;
|
||||
break;
|
||||
case 'd': /* declare path */
|
||||
orders = 0;
|
||||
scuttling = 0;
|
||||
/* Need location */
|
||||
p = getstarg(player->argp[3], "Destination? ", buf);
|
||||
|
@ -132,32 +131,27 @@ orde(void)
|
|||
p1x = p0x;
|
||||
p1y = p0y;
|
||||
|
||||
|
||||
|
||||
if (!orders) {
|
||||
p = getstarg(player->argp[4], "Second dest? ", buf);
|
||||
if (!p)
|
||||
return RET_FAIL;
|
||||
if (!*p || !strcmp(p, "-")) {
|
||||
orders = 1;
|
||||
pr("A one-way order has been accepted.\n");
|
||||
} else if (!strncmp(p, "s", 1)) {
|
||||
if (opt_TRADESHIPS) {
|
||||
if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
|
||||
pr("You can't auto-scuttle that ship!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
} else {
|
||||
p = getstarg(player->argp[4], "Second dest? ", buf);
|
||||
if (!p)
|
||||
return RET_FAIL;
|
||||
if (!*p || !strcmp(p, "-")) {
|
||||
pr("A one-way order has been accepted.\n");
|
||||
} else if (!strncmp(p, "s", 1)) {
|
||||
if (opt_TRADESHIPS) {
|
||||
if (!(mchr[(int)ship.shp_type].m_flags & M_TRADE)) {
|
||||
pr("You can't auto-scuttle that ship!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
pr("A scuttle order has been accepted.\n");
|
||||
scuttling = 1;
|
||||
} else {
|
||||
if (!sarg_xy(p, &p1x, &p1y))
|
||||
return RET_SYN;
|
||||
pr("A circular order has been accepted.\n");
|
||||
pr("You can't auto-scuttle that ship!\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
pr("A scuttle order has been accepted.\n");
|
||||
scuttling = 1;
|
||||
} else {
|
||||
if (!sarg_xy(p, &p1x, &p1y))
|
||||
return RET_SYN;
|
||||
pr("A circular order has been accepted.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -200,56 +194,53 @@ orde(void)
|
|||
sub = sub - 1;;
|
||||
|
||||
if (ship.shp_autonav & AN_AUTONAV) {
|
||||
orders = 1;
|
||||
dest = getstarg(player->argp[4], "Start or End? ", buf);
|
||||
if (orders) { /* before dest check */
|
||||
if (!dest)
|
||||
break;
|
||||
switch (*dest) {
|
||||
default:
|
||||
pr("You must enter 'start' or 'end'\n");
|
||||
return RET_SYN;
|
||||
case 'e':
|
||||
case 'E':
|
||||
i1 = whatitem(player->argp[5], "Commodity? ");
|
||||
if (!i1)
|
||||
break;
|
||||
else {
|
||||
p1 = getstarg(player->argp[6], "Amount? ",
|
||||
buf);
|
||||
if (!p1)
|
||||
return RET_SYN;
|
||||
level = atoi(p1);
|
||||
}
|
||||
if (level < 0) {
|
||||
level = 0; /* prevent negatives. */
|
||||
pr("You must use positive number! Level set to 0.\n");
|
||||
}
|
||||
ship.shp_tstart[sub] = i1->i_uid;
|
||||
ship.shp_lstart[sub] = level;
|
||||
pr("Order Set \n");
|
||||
break;
|
||||
case 's':
|
||||
case 'S':
|
||||
i1 = whatitem(player->argp[5], "Commodity? ");
|
||||
if (!i1)
|
||||
break;
|
||||
else {
|
||||
p1 = getstarg(player->argp[6], "Amount? ",
|
||||
buf);
|
||||
if (!p1)
|
||||
return RET_SYN;
|
||||
level = atoi(p1);
|
||||
}
|
||||
if (level < 0) {
|
||||
level = 0;
|
||||
pr("You must use positive number! Level set to 0.\n");
|
||||
}
|
||||
ship.shp_tend[sub] = i1->i_uid;
|
||||
ship.shp_lend[sub] = level;
|
||||
pr("Order Set \n");
|
||||
if (!dest)
|
||||
break;
|
||||
switch (*dest) {
|
||||
default:
|
||||
pr("You must enter 'start' or 'end'\n");
|
||||
return RET_SYN;
|
||||
case 'e':
|
||||
case 'E':
|
||||
i1 = whatitem(player->argp[5], "Commodity? ");
|
||||
if (!i1)
|
||||
break;
|
||||
else {
|
||||
p1 = getstarg(player->argp[6], "Amount? ",
|
||||
buf);
|
||||
if (!p1)
|
||||
return RET_SYN;
|
||||
level = atoi(p1);
|
||||
}
|
||||
if (level < 0) {
|
||||
level = 0; /* prevent negatives. */
|
||||
pr("You must use positive number! Level set to 0.\n");
|
||||
}
|
||||
ship.shp_tstart[sub] = i1->i_uid;
|
||||
ship.shp_lstart[sub] = level;
|
||||
pr("Order Set \n");
|
||||
break;
|
||||
case 's':
|
||||
case 'S':
|
||||
i1 = whatitem(player->argp[5], "Commodity? ");
|
||||
if (!i1)
|
||||
break;
|
||||
else {
|
||||
p1 = getstarg(player->argp[6], "Amount? ",
|
||||
buf);
|
||||
if (!p1)
|
||||
return RET_SYN;
|
||||
level = atoi(p1);
|
||||
}
|
||||
if (level < 0) {
|
||||
level = 0;
|
||||
pr("You must use positive number! Level set to 0.\n");
|
||||
}
|
||||
ship.shp_tend[sub] = i1->i_uid;
|
||||
ship.shp_lend[sub] = level;
|
||||
pr("Order Set \n");
|
||||
break;
|
||||
}
|
||||
} else
|
||||
pr("You need to 'declare' a ship path first, see 'info order'\n");
|
||||
|
|
|
@ -57,7 +57,6 @@ sell(void)
|
|||
struct ichrstr *ip;
|
||||
struct comstr comm;
|
||||
int number_set;
|
||||
int number_sub;
|
||||
int totalcom;
|
||||
int amt;
|
||||
int com;
|
||||
|
@ -99,7 +98,6 @@ sell(void)
|
|||
pr("Sectors need at least 1 mobility to sell goods.\n");
|
||||
return RET_FAIL;
|
||||
}
|
||||
number_sub = 0;
|
||||
p = getstarg(player->argp[3], "Quantity: ", buf);
|
||||
if (!p || !*p)
|
||||
return RET_SYN;
|
||||
|
|
|
@ -127,7 +127,6 @@ buildeff(struct sctstr *sp, int work, double *money)
|
|||
int n, hcms, lcms;
|
||||
int effdone = 0;
|
||||
|
||||
work_cost = 0;
|
||||
if (sp->sct_type != sp->sct_newtype) {
|
||||
/*
|
||||
* Tear down existing sector.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue