diff --git a/include/prototypes.h b/include/prototypes.h index 1b3e0fc5..40fe6a34 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -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); diff --git a/src/lib/commands/buil.c b/src/lib/commands/buil.c index 6093abf1..9d1c0ede 100644 --- a/src/lib/commands/buil.c +++ b/src/lib/commands/buil.c @@ -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; diff --git a/src/lib/common/type.c b/src/lib/common/type.c index 44f977d9..29c6efb6 100644 --- a/src/lib/common/type.c +++ b/src/lib/common/type.c @@ -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