(buil): When an argument is bad, do not offer to list types, just

print how to list them.

(buil): 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:15:49 +00:00
parent 3fd64ccb48
commit 011fa326d7

View file

@ -104,7 +104,6 @@ buil(void)
pr("Bad sector specification.\n"); pr("Bad sector specification.\n");
return RET_SYN; return RET_SYN;
} }
ask_again:
tlev = (int)natp->nat_level[NAT_TLEV]; tlev = (int)natp->nat_level[NAT_TLEV];
rlev = (int)natp->nat_level[NAT_RLEV]; rlev = (int)natp->nat_level[NAT_RLEV];
@ -121,11 +120,9 @@ buil(void)
type = -1; type = -1;
} }
if (type < 0) { if (type < 0) {
pr("Illegal plane type: \"%s\"\n", p); pr("You can't build that!\n");
if (confirm("List plane types? ")) pr("Use `show plane build %d' to show types you can build.\n", tlev);
show_plane_build(tlev); return RET_FAIL;
player->argp[3] = 0;
goto ask_again;
} }
break; break;
case 's': case 's':
@ -142,11 +139,9 @@ buil(void)
type = -1; type = -1;
} }
if (type < 0) { if (type < 0) {
pr("Illegal ship type: \"%s\"\n", p); pr("You can't build that!\n");
if (confirm("List ship types? ")) pr("Use `show ship build %d' to show types you can build.\n", tlev);
show_ship_build(tlev); return RET_FAIL;
player->argp[3] = 0;
goto ask_again;
} }
break; break;
case 'l': case 'l':
@ -163,11 +158,9 @@ buil(void)
type = -1; type = -1;
} }
if (type < 0) { if (type < 0) {
pr("Illegal land unit type: \"%s\"\n", p); pr("You can't build that!\n");
if (confirm("List unit types? ")) pr("Use `show land build %d' to show types you can build.\n", tlev);
show_land_build(tlev); return RET_FAIL;
player->argp[3] = 0;
goto ask_again;
} }
break; break;
case 'b': case 'b':
@ -205,14 +198,12 @@ buil(void)
} }
if (type < 0) { if (type < 0) {
int tt = tlev; int tt = tlev;
pr("Possible nuke types are:\n");
if (opt_DRNUKE) if (opt_DRNUKE)
tt = (tlev < (rlev / drnuke_const) ? (int)tlev : tt = (tlev < (rlev / drnuke_const) ? (int)tlev :
(int)(rlev / drnuke_const)); (int)(rlev / drnuke_const));
pr("You can't build that!\n");
show_nuke_build(tt); pr("Use `show nuke build %d' to show types you can build.\n", tlev);
player->argp[3] = 0; return RET_FAIL;
goto ask_again;
} }
break; break;
default: default: