]> git.pond.sub.org Git - empserver/commitdiff
(buil): Use ef_elt_byname() instead of typematch().
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 1 Jun 2006 18:57:03 +0000 (18:57 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 1 Jun 2006 18:57:03 +0000 (18:57 +0000)
(typematch): Unused, remove.

include/prototypes.h
src/lib/commands/buil.c
src/lib/common/type.c

index 1b3e0fc528e1c38f167952c7b8d07b70cbbeee77..40fe6a3493fce5b2121ba2a1903938a1aad55f6d 100644 (file)
@@ -336,7 +336,6 @@ extern int sectdamage(struct sctstr *, int, struct emp_qelem *);
 /* in match.h */
 /* type.c */
 extern int sct_typematch(char *);
-extern int typematch(char *, int);
 /* wantupd.c */
 extern void update_policy_check(void);
 extern int demand_update_want(int *, int *, int);
index 6093abf17f5d8e56eb1793197a317576c006e8df..9d1c0ede60cc9b641e55b735f441f936fe655e04 100644 (file)
@@ -109,7 +109,7 @@ buil(void)
        p = getstarg(player->argp[3], "Plane type? ", buf);
        if (p == 0 || *p == 0)
            return RET_SYN;
-       type = typematch(p, EF_PLANE);
+       type = ef_elt_byname(EF_PLANE_CHR, p);
        if (type >= 0) {
            pp = &plchr[type];
            rqtech = pp->pl_tech;
@@ -127,7 +127,7 @@ buil(void)
        p = getstarg(player->argp[3], "Ship type? ", buf);
        if (p == 0 || *p == 0)
            return RET_SYN;
-       type = typematch(p, EF_SHIP);
+       type = ef_elt_byname(EF_SHIP_CHR, p);
        if (type >= 0) {
            mp = &mchr[type];
            rqtech = mp->m_tech;
@@ -147,7 +147,7 @@ buil(void)
        p = getstarg(player->argp[3], "Land unit type? ", buf);
        if (p == 0 || *p == 0)
            return RET_SYN;
-       type = typematch(p, EF_LAND);
+       type = ef_elt_byname(EF_LAND_CHR, p);
        if (type >= 0) {
            lp = &lchr[type];
            rqtech = lp->l_tech;
@@ -188,7 +188,7 @@ buil(void)
        p = getstarg(player->argp[3], "Nuke type? ", buf);
        if (p == 0 || *p == 0)
            return RET_SYN;
-       type = typematch(p, EF_NUKE);
+       type = ef_elt_byname(EF_NUKE_CHR, p);
        if (type >= 0) {
            np = &nchr[type];
            rqtech = np->n_tech;
index 44f977d95cf72b634a8a77ac5d14de8a4d70a2b1..29c6efb6de4989eab8f07d86d7069165950345ab 100644 (file)
@@ -61,44 +61,6 @@ sct_typematch(char *name)
     return M_NOTFOUND;
 }
 
-/*
- * Search for NAME in the characteristics table for TYPE, return index.
- * Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are
- * several.
- * If TYPE is EF_SECTOR, search dchr[]
- * If TYPE is EF_SHIP, search mchr[].
- * If TYPE is EF_PLANE, search plchr[].
- * If TYPE is EF_LAND, search lchr[].
- * If TYPE is EF_NUKE, search nchr[].
- */
-int
-typematch(char *name, int type)
-{
-    switch (type) {
-    case EF_SECTOR:
-       return sct_typematch(name);
-    case EF_SHIP:
-       return stmtch(name, mchr,
-                     offsetof(struct mchrstr, m_name),
-                     sizeof(mchr[0]));
-    case EF_LAND:
-       return stmtch(name, lchr,
-                     offsetof(struct lchrstr, l_name),
-                     sizeof(lchr[0]));
-    case EF_PLANE:
-       return stmtch(name, plchr,
-                     offsetof(struct plchrstr, pl_name),
-                     sizeof(plchr[0]));
-    case EF_NUKE:
-       return stmtch(name, nchr,
-                     offsetof(struct nchrstr, n_name),
-                     sizeof(nchr[0]));
-    default:
-       break;
-    }
-    return M_NOTFOUND;
-}
-
 /*
  * Search table TYPE for an element matching NAME, return its index.
  * Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are