(pln_maxno): Variable's value is well-known constant N_MAXPLANE + 1.

Useless, remove.  Users changed to check plchr's sentinel, because
that's clearer than comparing the index to N_MAXPLANE or sizeof(plchr)
/ sizeof(*plchr).

(plchr): Change sentinel's pl_name to NULL.
This commit is contained in:
Markus Armbruster 2005-11-06 21:12:24 +00:00
parent 6f1df90b69
commit 47192c9079
5 changed files with 5 additions and 7 deletions

View file

@ -144,7 +144,6 @@ struct plist {
(struct plnstr *) ef_ptr(EF_PLANE, n) (struct plnstr *) ef_ptr(EF_PLANE, n)
extern struct plchrstr plchr[N_MAXPLANE + 1]; extern struct plchrstr plchr[N_MAXPLANE + 1];
extern int pln_maxno;
struct shiplist { struct shiplist {
short uid; short uid;

View file

@ -76,7 +76,7 @@ init_plchr(void)
struct plchrstr *pp; struct plchrstr *pp;
int pcount; int pcount;
for (pp = plchr, pcount = 0; pcount < pln_maxno; pcount++, pp++) { for (pp = plchr; pp->pl_name; pp++) {
if (pp->pl_flags & P_M) if (pp->pl_flags & P_M)
pp->pl_flags |= P_V; pp->pl_flags |= P_V;
} }

View file

@ -301,9 +301,8 @@ struct plchrstr plchr[] = {
0, 0,
P_N | P_M}, P_N | P_M},
{ {
"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0,
0} 0}
}; };
int pln_maxno = (sizeof(plchr) / sizeof(struct plchrstr)) - 1;

View file

@ -97,7 +97,7 @@ make_new_list(int tlev, int type)
lookup_list_cnt = 0; lookup_list_cnt = 0;
if (type == EF_PLANE) { if (type == EF_PLANE) {
for (pp = plchr, count = 0; count < pln_maxno; count++, pp++) { for (pp = plchr; pp->pl_name; pp++) {
if (pp->pl_tech > tlev) if (pp->pl_tech > tlev)
continue; continue;
if (pp->pl_name == 0 || pp->pl_name[0] == '\0') if (pp->pl_name == 0 || pp->pl_name[0] == '\0')

View file

@ -495,7 +495,7 @@ nullify_objects(void)
dchr[SCT_OIL].d_cost = -1; dchr[SCT_OIL].d_cost = -1;
dchr[SCT_REFINE].d_cost = -1; dchr[SCT_REFINE].d_cost = -1;
} }
for (i = 0; i < pln_maxno; i++) { for (i = 0; i < plchr[i].pl_name; i++) {
if (opt_NO_HCMS) if (opt_NO_HCMS)
plchr[i].pl_hcm = 0; plchr[i].pl_hcm = 0;
if (opt_NO_LCMS) if (opt_NO_LCMS)