(improve): Fix confusing diagnostics when refusing to improve defense

because option DEFENSE_INFRA is off.

(improve): Simplify use of `value' to avoid compiler warning.
This commit is contained in:
Markus Armbruster 2004-08-24 08:23:09 +00:00
parent 01e7ea7916
commit b74f48fcc9

View file

@ -76,9 +76,13 @@ improve(void)
type = INT_ROAD; type = INT_ROAD;
else if (!strncmp(p, "ra", 2)) else if (!strncmp(p, "ra", 2))
type = INT_RAIL; type = INT_RAIL;
else if (!strncmp(p, "de", 2) && opt_DEFENSE_INFRA) else if (!strncmp(p, "de", 2)) {
if (!opt_DEFENSE_INFRA) {
pr("Defense infrastructure is disabled.\n");
return RET_FAIL;
}
type = INT_DEF; type = INT_DEF;
else } else
return RET_SYN; return RET_SYN;
if (!snxtsct(&nstr, player->argp[2])) if (!snxtsct(&nstr, player->argp[2]))
return RET_SYN; return RET_SYN;
@ -91,7 +95,7 @@ improve(void)
value = sect.sct_road; value = sect.sct_road;
else if (type == INT_RAIL) else if (type == INT_RAIL)
value = sect.sct_rail; value = sect.sct_rail;
else if (type == INT_DEF) else /* type == INT_DEF */
value = sect.sct_defense; value = sect.sct_defense;
sprintf(inbuf, "Sector %s has a %s of %d%%. Improve how much? ", sprintf(inbuf, "Sector %s has a %s of %d%%. Improve how much? ",
xyas(sect.sct_x, sect.sct_y, player->cnum), xyas(sect.sct_x, sect.sct_y, player->cnum),
@ -172,7 +176,7 @@ improve(void)
sect.sct_mobil -= mneeded; sect.sct_mobil -= mneeded;
ovalue = value; ovalue = value;
value += maxup; value += maxup;
if (value > 100) if (CANT_HAPPEN(value > 100))
value = 100; value = 100;
pr("Sector %s %s increased from %d%% to %d%%\n", pr("Sector %s %s increased from %d%% to %d%%\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), xyas(sect.sct_x, sect.sct_y, player->cnum),