From 7d529769de819afd36315ddf16a5853c4b82ff6c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 20 Jul 2008 16:45:38 -0400 Subject: [PATCH] Simplify best() and torp() Use snxtsct_rewind() instead of snxtsct(), and snxtitem_rewind() instead of snxtitem(). --- src/lib/commands/best.c | 2 +- src/lib/commands/torp.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/commands/best.c b/src/lib/commands/best.c index 8bd3c9082..34be9053f 100644 --- a/src/lib/commands/best.c +++ b/src/lib/commands/best.c @@ -54,7 +54,7 @@ best(void) while (!player->aborted && nxtsct(&nstr, &s1)) { if (s1.sct_own != player->cnum) continue; - snxtsct(&nstr2, player->argp[2]); + snxtsct_rewind(&nstr2); while (!player->aborted && nxtsct(&nstr2, &s2)) { if (s2.sct_own != player->cnum) continue; diff --git a/src/lib/commands/torp.c b/src/lib/commands/torp.c index 91ab882f7..91034f549 100644 --- a/src/lib/commands/torp.c +++ b/src/lib/commands/torp.c @@ -62,13 +62,13 @@ torp(void) char *ptr; struct nstr_item nbst; char buf[1024]; - char *sav; + char *p; int ntorping = 0; char prompt[128]; - if (!(sav = getstarg(player->argp[1], "From ship(s)? ", buf))) + if (!(p = getstarg(player->argp[1], "From ship(s)? ", buf))) return RET_SYN; - if (!snxtitem(&nbst, EF_SHIP, sav)) + if (!snxtitem(&nbst, EF_SHIP, p)) return RET_SYN; while (nxtitem(&nbst, &sub)) { if (sub.shp_own != player->cnum) @@ -87,7 +87,7 @@ torp(void) ntorping++; } pr("%d ships are eligible to torp\n", ntorping); - snxtitem(&nbst, EF_SHIP, sav); + snxtitem_rewind(&nbst); while (nxtitem(&nbst, &sub)) { if (!sub.shp_own) continue; -- 2.43.0