From b54bc83e260ac00da43dd41a028e85e04244e6b2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 26 Jan 2010 22:02:34 +0100 Subject: [PATCH] Normalize order's reaction to bad input Consistently fail the command on bad or missing argument. Before, it merely skipped to the next ship in some cases. --- src/lib/commands/orde.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/commands/orde.c b/src/lib/commands/orde.c index 7520a77e3..a310e6c1a 100644 --- a/src/lib/commands/orde.c +++ b/src/lib/commands/orde.c @@ -173,7 +173,7 @@ orde(void) /* check to make sure value in within range. */ if (sub > TMAX || sub < 1) { pr("Value must range from 1 to %d\n", TMAX); - break; + return RET_FAIL; } /* to keep sub in range of our arrays @@ -184,7 +184,7 @@ orde(void) if (ship.shp_autonav & AN_AUTONAV) { dest = getstarg(player->argp[4], "Start or End? ", buf); if (!dest) - break; + return RET_FAIL; switch (*dest) { default: pr("You must enter 'start' or 'end'\n"); @@ -193,7 +193,7 @@ orde(void) case 'E': i1 = whatitem(player->argp[5], "Commodity? "); if (!i1) - break; + return RET_FAIL; p1 = getstarg(player->argp[6], "Amount? ", buf); if (!p1) @@ -211,7 +211,7 @@ orde(void) case 'S': i1 = whatitem(player->argp[5], "Commodity? "); if (!i1) - break; + return RET_FAIL; p1 = getstarg(player->argp[6], "Amount? ", buf); if (!p1) -- 2.43.0