(multifire): When an argument is bad, do not loop prompting, just

fail.  That's what the vast majority of commands do.
This commit is contained in:
Markus Armbruster 2005-11-19 15:38:53 +00:00
parent 1c703efa96
commit fe1a3e57c6

View file

@ -126,27 +126,25 @@ multifire(void)
emp_initque(&fired); emp_initque(&fired);
emp_initque(&defended); emp_initque(&defended);
type = -1; if (!(p = getstarg(player->argp[1],
while ((type != EF_SECTOR) && (type != EF_SHIP) && (type != EF_LAND)) { "Firing from ship(s), sect(s), or land unit(s)? ",
if (!(p = getstarg(player->argp[1], buf)))
"Firing from ship(s), sect(s), or land unit(s)? ", return RET_SYN;
buf))) type = ef_byname_from(p, ef_with_guns);
return RET_SYN; if (type == EF_SECTOR) {
player->argp[1] = 0; if (opt_NO_FORT_FIRE) {
type = ef_byname_from(p, ef_with_guns); pr("Fort firing is disabled.\n");
if (type == EF_SECTOR) { return RET_FAIL;
if (opt_NO_FORT_FIRE) { }
pr("Fort firing is disabled.\n"); orig_attacker = attacker = targ_land;
return RET_FAIL; shots = 1;
} } else if (type == EF_SHIP) {
orig_attacker = attacker = targ_land; orig_attacker = attacker = targ_ship;
shots = 1; } else if (type == EF_LAND) {
} else if (type == EF_SHIP) { orig_attacker = attacker = targ_unit;
orig_attacker = attacker = targ_ship; } else {
} else if (type == EF_LAND) { pr("Ships, land units or sectors only!\n");
orig_attacker = attacker = targ_unit; return RET_SYN;
} else
pr("Please type 'sh', 'l', or 'se'!\n");
} }
if ((ptr = getstarg(player->argp[2], "Firing from? ", buf)) == 0 if ((ptr = getstarg(player->argp[2], "Firing from? ", buf)) == 0
|| *ptr == '\0') || *ptr == '\0')