(shp_maxno): Variable's value is well-known constant N_MAXSHIPS + 1.
Useless, remove. Users changed to check mchr's sentinel, because that's clearer than comparing the index to N_MAXSHIPS or sizeof(mchr) / sizeof(*mchr). (mchr): Change sentinel's m_name to NULL.
This commit is contained in:
parent
47192c9079
commit
e23d8a8fac
5 changed files with 4 additions and 15 deletions
|
@ -186,7 +186,6 @@ struct mchrstr {
|
|||
(struct shpstr *) ef_ptr(EF_SHIP, n)
|
||||
|
||||
extern struct mchrstr mchr[N_MAXSHIPS + 1];
|
||||
extern int shp_maxno;
|
||||
|
||||
struct mlist {
|
||||
struct emp_qelem queue; /* list of ships */
|
||||
|
|
|
@ -49,16 +49,14 @@ global_init(void)
|
|||
init_pchr();
|
||||
init_mchr();
|
||||
init_plchr();
|
||||
/* the same thing should be done for units... */
|
||||
}
|
||||
|
||||
static void
|
||||
init_mchr(void)
|
||||
{
|
||||
struct mchrstr *mp;
|
||||
int n;
|
||||
|
||||
for (mp = mchr, n = 0; n < shp_maxno; n++, mp++) {
|
||||
for (mp = mchr; mp->m_name; mp++) {
|
||||
if (mp->m_nxlight)
|
||||
mp->m_flags |= M_XLIGHT;
|
||||
if (mp->m_nchoppers)
|
||||
|
@ -74,7 +72,6 @@ static void
|
|||
init_plchr(void)
|
||||
{
|
||||
struct plchrstr *pp;
|
||||
int pcount;
|
||||
|
||||
for (pp = plchr; pp->pl_name; pp++) {
|
||||
if (pp->pl_flags & P_M)
|
||||
|
|
|
@ -205,8 +205,6 @@ struct mchrstr mchr[] = {
|
|||
360, 1500, M_SUPPLY, 0, 2},
|
||||
|
||||
{{0},
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "",
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
|
||||
0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
int shp_maxno = (sizeof(mchr) / sizeof(struct mchrstr)) - 1;
|
||||
|
|
|
@ -93,25 +93,20 @@ make_new_list(int tlev, int type)
|
|||
struct plchrstr *pp;
|
||||
struct lchrstr *lp;
|
||||
struct mchrstr *mp;
|
||||
int count;
|
||||
|
||||
lookup_list_cnt = 0;
|
||||
if (type == EF_PLANE) {
|
||||
for (pp = plchr; pp->pl_name; pp++) {
|
||||
if (pp->pl_tech > tlev)
|
||||
continue;
|
||||
if (pp->pl_name == 0 || pp->pl_name[0] == '\0')
|
||||
continue;
|
||||
lookup_list[lookup_list_cnt].l_u.pp = pp;
|
||||
lookup_list[lookup_list_cnt].tech = pp->pl_tech;
|
||||
lookup_list_cnt++;
|
||||
}
|
||||
} else if (type == EF_SHIP) {
|
||||
for (mp = mchr, count = 0; count < shp_maxno; count++, mp++) {
|
||||
for (mp = mchr; mp->m_name; mp++) {
|
||||
if (mp->m_tech > tlev)
|
||||
continue;
|
||||
if (mp->m_name == 0 || mp->m_name[0] == '\0')
|
||||
continue;
|
||||
lookup_list[lookup_list_cnt].l_u.mp = mp;
|
||||
lookup_list[lookup_list_cnt].tech = mp->m_tech;
|
||||
lookup_list_cnt++;
|
||||
|
|
|
@ -511,7 +511,7 @@ nullify_objects(void)
|
|||
/* Fix up the military values */
|
||||
lchr[i].l_mil = lchr[i].l_item[I_MILIT];
|
||||
}
|
||||
for (i = 0; i < shp_maxno; i++) {
|
||||
for (i = 0; i < mchr[i].m_name; i++) {
|
||||
if (opt_NO_HCMS)
|
||||
mchr[i].m_hcm = 0;
|
||||
if (opt_NO_LCMS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue