From 11d6e8ce80d39379625f785465d541554e75dfa2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 26 Oct 2011 19:42:37 +0200 Subject: [PATCH] Remove unreachable code in sell() sell used to search multiple sectors for sellable commodities, keeping tally in totalcom. It failed with message "No eligible" when none could be found. sell's second argument got changed to a single sector in Empire 3. If the sector can't sell, we return early. Else, totalcom is positive. Thus, the "No eligible" code is unreachable. Remove it. --- src/lib/commands/sell.c | 42 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/lib/commands/sell.c b/src/lib/commands/sell.c index 861762c8d..cf838335f 100644 --- a/src/lib/commands/sell.c +++ b/src/lib/commands/sell.c @@ -136,29 +136,25 @@ sell(void) xyas(sect.sct_x, sect.sct_y, player->cnum), amt); sect.sct_item[ip->i_uid] = amt; putsect(§); - if (totalcom > 0) { - for (ii = 0; getcomm(ii, &comm); ii++) { - if (comm.com_owner == 0) - break; - } - (void)time(&now); - ef_blank(EF_COMM, ii, &comm); - comm.com_type = ip->i_uid; - comm.com_owner = player->cnum; - comm.com_price = price; - comm.com_maxbidder = player->cnum; - comm.com_markettime = now; - comm.com_amount = totalcom; - comm.com_x = 0; - comm.com_y = 0; - comm.sell_x = sect.sct_x; - comm.sell_y = sect.sct_y; - if (!putcomm(ii, &comm)) { - pr("Problems with the commodities file, call the Deity\n"); - return RET_FAIL; - } - } else { - pr("No eligible %s for sale\n", ip->i_name); + + for (ii = 0; getcomm(ii, &comm); ii++) { + if (comm.com_owner == 0) + break; + } + (void)time(&now); + ef_blank(EF_COMM, ii, &comm); + comm.com_type = ip->i_uid; + comm.com_owner = player->cnum; + comm.com_price = price; + comm.com_maxbidder = player->cnum; + comm.com_markettime = now; + comm.com_amount = totalcom; + comm.com_x = 0; + comm.com_y = 0; + comm.sell_x = sect.sct_x; + comm.sell_y = sect.sct_y; + if (!putcomm(ii, &comm)) { + pr("Problems with the commodities file, call the Deity\n"); return RET_FAIL; } return RET_OK; -- 2.43.0