From 470cd370560c120d0db6d1c27e31b9e32dbf7dc2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 30 Apr 2006 13:10:34 +0000 Subject: [PATCH] (sate): Use ef_byname_from() for second argument. --- src/lib/commands/sate.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/lib/commands/sate.c b/src/lib/commands/sate.c index 6ece7ee3..6e5530f6 100644 --- a/src/lib/commands/sate.c +++ b/src/lib/commands/sate.c @@ -48,6 +48,7 @@ int sate(void) { + static int sct_shp_or_lnd[] = { EF_SECTOR, EF_SHIP, EF_LAND, EF_BAD }; double tech; int pln_uid; struct plnstr plane; @@ -79,17 +80,8 @@ sate(void) return RET_FAIL; } if (player->argp[2]) { - switch (*player->argp[2]) { - case 'l': - type = EF_LAND; - break; - case 's': - if (*(player->argp[2] + 1) == 'e') - type = EF_SECTOR; - else - type = EF_SHIP; - break; - default: + type = ef_byname_from(player->argp[2], sct_shp_or_lnd); + if (type < 0) { return RET_SYN; } }