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:
parent
03937d6c58
commit
da59e02706
1 changed files with 2 additions and 2 deletions
|
@ -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(§))
|
if (!check_sect_ok(§))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (amount > amt_src) {
|
if (amount > amt_src) {
|
||||||
|
@ -125,8 +127,6 @@ explore(void)
|
||||||
if (!check_sect_ok(§))
|
if (!check_sect_ok(§))
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue