]> git.pond.sub.org Git - empserver/commitdiff
(lnd_maxno): Variable's value is well-known constant N_MAXLAND + 1.
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Nov 2005 20:59:38 +0000 (20:59 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Nov 2005 20:59:38 +0000 (20:59 +0000)
Useless, remove.  Users changed to check lchr's sentinel, because
that's clearer than comparing the index to N_MAXLAND or sizeof(lchr) /
sizeof(*lchr).

(lchr): Change sentinel's l_name to NULL.

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

index 6bb8da41a4c2709e51c851445c77f8db83881719..62533403dd240155be106a37915bb05da972c754 100644 (file)
@@ -182,7 +182,6 @@ struct lchrstr {
        (struct lndstr *) ef_ptr(EF_LAND, n)
 
 extern struct lchrstr lchr[N_MAXLAND + 1];
-extern int lnd_maxno;
 
 struct llist {
     struct emp_qelem queue;    /* list of units */
index 8ed37ab6a60c21ab009be09ab4424f0791a7474c..0b855d43ce00dcdfde144f39b4a16c756b7e94c6 100644 (file)
@@ -207,11 +207,9 @@ struct lchrstr lchr[] = {
 */
 
     {{0},
-     "",
+     NULL,
      0, 0, 0, 0, 0, 0, 0,
      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
      0,
      }
 };
-
-int lnd_maxno = (sizeof(lchr) / sizeof(struct lchrstr)) - 1;
index 77559666a261a9de5c853d01bdd366e1cd5d355c..10a90553cc6c8e1c0ab0221af67ff00417cce1b9 100644 (file)
@@ -117,11 +117,9 @@ make_new_list(int tlev, int type)
            lookup_list_cnt++;
        }
     } else if (type == EF_LAND) {
-       for (lp = lchr, count = 0; count < lnd_maxno; count++, lp++) {
+       for (lp = lchr; lp->l_name; lp++) {
            if (lp->l_tech > tlev)
                continue;
-           if (lp->l_name == 0 || lp->l_name[0] == '\0')
-               continue;
            lookup_list[lookup_list_cnt].l_u.lp = lp;
            lookup_list[lookup_list_cnt].tech = lp->l_tech;
            lookup_list_cnt++;
index 7e040f1fb0ac44c722df4973e8994f44940dde28..9f6258d2c6e4c166dad566df7e9c5aa15eabc02e 100644 (file)
@@ -503,7 +503,7 @@ nullify_objects(void)
        if (opt_NO_OIL)
            plchr[i].pl_fuel = 0;
     }
-    for (i = 0; i < lnd_maxno; i++) {
+    for (i = 0; i < lchr[i].l_name; i++) {
        if (opt_NO_HCMS)
            lchr[i].l_hcm = 0;
        if (opt_NO_LCMS)