Validate explore's third argument earlier

The old code checked a bunch of other things first, which made it hard
to see that the value of onearg() was checked properly.
This commit is contained in:
Markus Armbruster 2008-07-18 18:15:46 -04:00
parent 03937d6c58
commit da59e02706

View file

@ -110,6 +110,8 @@ explore(void)
sprintf(prompt, "Number of %s to explore with? (max %d) ", sprintf(prompt, "Number of %s to explore with? (max %d) ",
ip->i_name, amt_src); ip->i_name, amt_src);
amount = onearg(player->argp[3], prompt); amount = onearg(player->argp[3], prompt);
if (amount <= 0)
return RET_SYN;
if (!check_sect_ok(&sect)) if (!check_sect_ok(&sect))
return RET_FAIL; return RET_FAIL;
if (amount > amt_src) { if (amount > amt_src) {
@ -125,8 +127,6 @@ explore(void)
if (!check_sect_ok(&sect)) if (!check_sect_ok(&sect))
return RET_FAIL; return RET_FAIL;
if (amount <= 0)
return RET_SYN;
weight = (double)amount * ip->i_lbs; weight = (double)amount * ip->i_lbs;
/* remove commodities from source sector */ /* remove commodities from source sector */
getsect(x, y, &start); getsect(x, y, &start);