/* 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);
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;
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;
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;
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;
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