(buil): Use ef_elt_byname() instead of typematch().
(typematch): Unused, remove.
This commit is contained in:
parent
c432e3107d
commit
6fadcf6e8e
3 changed files with 4 additions and 43 deletions
|
@ -336,7 +336,6 @@ extern int sectdamage(struct sctstr *, int, struct emp_qelem *);
|
||||||
/* in match.h */
|
/* in match.h */
|
||||||
/* type.c */
|
/* type.c */
|
||||||
extern int sct_typematch(char *);
|
extern int sct_typematch(char *);
|
||||||
extern int typematch(char *, int);
|
|
||||||
/* wantupd.c */
|
/* wantupd.c */
|
||||||
extern void update_policy_check(void);
|
extern void update_policy_check(void);
|
||||||
extern int demand_update_want(int *, int *, int);
|
extern int demand_update_want(int *, int *, int);
|
||||||
|
|
|
@ -109,7 +109,7 @@ buil(void)
|
||||||
p = getstarg(player->argp[3], "Plane type? ", buf);
|
p = getstarg(player->argp[3], "Plane type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (p == 0 || *p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = typematch(p, EF_PLANE);
|
type = ef_elt_byname(EF_PLANE_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
pp = &plchr[type];
|
pp = &plchr[type];
|
||||||
rqtech = pp->pl_tech;
|
rqtech = pp->pl_tech;
|
||||||
|
@ -127,7 +127,7 @@ buil(void)
|
||||||
p = getstarg(player->argp[3], "Ship type? ", buf);
|
p = getstarg(player->argp[3], "Ship type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (p == 0 || *p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = typematch(p, EF_SHIP);
|
type = ef_elt_byname(EF_SHIP_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
mp = &mchr[type];
|
mp = &mchr[type];
|
||||||
rqtech = mp->m_tech;
|
rqtech = mp->m_tech;
|
||||||
|
@ -147,7 +147,7 @@ buil(void)
|
||||||
p = getstarg(player->argp[3], "Land unit type? ", buf);
|
p = getstarg(player->argp[3], "Land unit type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (p == 0 || *p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = typematch(p, EF_LAND);
|
type = ef_elt_byname(EF_LAND_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
lp = &lchr[type];
|
lp = &lchr[type];
|
||||||
rqtech = lp->l_tech;
|
rqtech = lp->l_tech;
|
||||||
|
@ -188,7 +188,7 @@ buil(void)
|
||||||
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
p = getstarg(player->argp[3], "Nuke type? ", buf);
|
||||||
if (p == 0 || *p == 0)
|
if (p == 0 || *p == 0)
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
type = typematch(p, EF_NUKE);
|
type = ef_elt_byname(EF_NUKE_CHR, p);
|
||||||
if (type >= 0) {
|
if (type >= 0) {
|
||||||
np = &nchr[type];
|
np = &nchr[type];
|
||||||
rqtech = np->n_tech;
|
rqtech = np->n_tech;
|
||||||
|
|
|
@ -61,44 +61,6 @@ sct_typematch(char *name)
|
||||||
return M_NOTFOUND;
|
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.
|
* Search table TYPE for an element matching NAME, return its index.
|
||||||
* Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are
|
* Return M_NOTFOUND if there are no matches, M_NOTUNIQUE if there are
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue