]> git.pond.sub.org Git - empserver/commitdiff
(pln_maxno): Variable's value is well-known constant N_MAXPLANE + 1.
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Nov 2005 21:12:24 +0000 (21:12 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Nov 2005 21:12:24 +0000 (21:12 +0000)
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.

include/plane.h
src/lib/global/init.c
src/lib/global/plane.c
src/lib/subs/show.c
src/server/main.c

index bb32aac24acff7e78f6e50a46c527d7de2661181..2428f7dd85770968d2e809c2baf41dc4939a494f 100644 (file)
@@ -144,7 +144,6 @@ struct plist {
        (struct plnstr *) ef_ptr(EF_PLANE, n)
 
 extern struct plchrstr plchr[N_MAXPLANE + 1];
-extern int pln_maxno;
 
 struct shiplist {
     short uid;
index beb14f349a043d3f53b2260dc3294383734e3f92..dc523542919406191e7586f215e07c616a1aa54d 100644 (file)
@@ -76,7 +76,7 @@ init_plchr(void)
     struct plchrstr *pp;
     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)
            pp->pl_flags |= P_V;
     }
index 17f9a1c7266e7a98894cdf3e3c570e871e60b208..d3fea99748402d155e9819847190dc4c23f49d58 100644 (file)
@@ -301,9 +301,8 @@ struct plchrstr plchr[] = {
      0,
      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}
 };
-
-int pln_maxno = (sizeof(plchr) / sizeof(struct plchrstr)) - 1;
index 10a90553cc6c8e1c0ab0221af67ff00417cce1b9..842143bc33acf99defae6b7edc2e4413fc0ef752 100644 (file)
@@ -97,7 +97,7 @@ make_new_list(int tlev, int type)
 
     lookup_list_cnt = 0;
     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)
                continue;
            if (pp->pl_name == 0 || pp->pl_name[0] == '\0')
index 9f6258d2c6e4c166dad566df7e9c5aa15eabc02e..aa53e27e71a5cdce6a80039f173c34fc2ef8ce32 100644 (file)
@@ -495,7 +495,7 @@ nullify_objects(void)
        dchr[SCT_OIL].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)
            plchr[i].pl_hcm = 0;
        if (opt_NO_LCMS)