Check build's first argument before asking for the second
This commit is contained in:
parent
4c1f8ead27
commit
d7e0a7088c
1 changed files with 34 additions and 20 deletions
|
@ -91,6 +91,38 @@ buil(void)
|
||||||
if (!p)
|
if (!p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
what = *p;
|
what = *p;
|
||||||
|
switch (what) {
|
||||||
|
case 'b':
|
||||||
|
if (natp->nat_level[NAT_TLEV] + 0.005 < buil_bt) {
|
||||||
|
pr("Building a span requires a tech of %.0f\n", buil_bt);
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
if (!opt_BRIDGETOWERS) {
|
||||||
|
pr("Bridge tower building is disabled.\n");
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
if (natp->nat_level[NAT_TLEV] + 0.005 < buil_tower_bt) {
|
||||||
|
pr("Building a tower requires a tech of %.0f\n",
|
||||||
|
buil_tower_bt);
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
case 'p':
|
||||||
|
case 'l':
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
if (!ef_nelem(EF_NUKE_CHR)) {
|
||||||
|
pr("There are no nukes in this game.\n");
|
||||||
|
return RET_FAIL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pr("You can't build that!\n");
|
||||||
|
return RET_SYN;
|
||||||
|
}
|
||||||
|
|
||||||
if (!snxtsct(&nstr, player->argp[2]))
|
if (!snxtsct(&nstr, player->argp[2]))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -157,27 +189,9 @@ buil(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if (natp->nat_level[NAT_TLEV] + 0.005 < buil_bt) {
|
|
||||||
pr("Building a span requires a tech of %.0f\n", buil_bt);
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 't':
|
case 't':
|
||||||
if (!opt_BRIDGETOWERS) {
|
|
||||||
pr("Bridge tower building is disabled.\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
if (natp->nat_level[NAT_TLEV] + 0.005 < buil_tower_bt) {
|
|
||||||
pr("Building a tower requires a tech of %.0f\n",
|
|
||||||
buil_tower_bt);
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
if (!ef_nelem(EF_NUKE_CHR)) {
|
|
||||||
pr("There are no nukes in this game.\n");
|
|
||||||
return RET_FAIL;
|
|
||||||
}
|
|
||||||
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
||||||
if (!p || !*p)
|
if (!p || !*p)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
|
@ -202,8 +216,8 @@ buil(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr("You can't build that!\n");
|
CANT_REACH();
|
||||||
return RET_SYN;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
number = 1;
|
number = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue