]> git.pond.sub.org Git - empserver/commitdiff
(march, navi): Switch to struct empobj * for leader and rename to leader.
authorRon Koenderink <rkoenderink@yahoo.ca>
Tue, 2 Jan 2007 12:50:56 +0000 (12:50 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Tue, 2 Jan 2007 12:50:56 +0000 (12:50 +0000)
No functional changes.

src/lib/commands/marc.c
src/lib/commands/navi.c

index a6b91d19be37d7dbb795d9b266f187d26ca175f0..88d8f1cfa98d58bd1d7064996e6561ced93dbf61 100644 (file)
@@ -51,7 +51,7 @@ march(void)
     int together;
     char *cp = NULL;
     int leader_uid;
-    struct lndstr *lnd;        /* leader */
+    struct empobj *leader;
     int dir;
     int stopping = 0;
     int skip = 0;
@@ -69,12 +69,12 @@ march(void)
        pr("No lands\n");
        return RET_FAIL;
     }
-    lnd = (struct lndstr *)get_leader(&land_list);
-    leader_uid = lnd->lnd_uid;
-    pr("Leader is %s\n", prland(lnd));
+    leader = get_leader(&land_list);
+    leader_uid = leader->uid;
+    pr("Leader is %s\n", obj_nameof(leader));
     if (player->argp[2]) {
        strcpy(buf, player->argp[2]);
-       if (!(cp = lnd_path(together, lnd, buf)))
+       if (!(cp = lnd_path(together, (struct lndstr *)leader, buf)))
            cp = player->argp[2];
     }
 
@@ -88,19 +88,19 @@ march(void)
                pr("No lands left\n");
                return RET_OK;
            }
-           lnd = (struct lndstr *)get_leader(&land_list);
-           if (lnd->lnd_uid != leader_uid) {
-               leader_uid = lnd->lnd_uid;
-               pr_leader_change((struct empobj *)lnd);
+           leader = get_leader(&land_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
                stopping = 1;
                continue;
            }
            if (!skip)
-               nav_map(lnd->lnd_x, lnd->lnd_y, 1);
+               nav_map(leader->x, leader->y, 1);
            else
                skip = 0;
            sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
-                   minmob, xyas(lnd->lnd_x, lnd->lnd_y, player->cnum));
+                   minmob, xyas(leader->x, leader->y, player->cnum));
            cp = getstring(prompt, buf);
 /* Just in case any of our lands were shelled while we were at the
  * prompt, we call lnd_mar() again.
@@ -110,14 +110,14 @@ march(void)
                pr("No lands left\n");
                return RET_OK;
            }
-           lnd = (struct lndstr *)get_leader(&land_list);
-           if (lnd->lnd_uid != leader_uid) {
-               leader_uid = lnd->lnd_uid;
-               pr_leader_change((struct empobj *)lnd);
+           leader = get_leader(&land_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
                stopping = 1;
                continue;
            }
-           if (cp && !(cp = lnd_path(together, lnd, buf)))
+           if (cp && !(cp = lnd_path(together, (struct lndstr *)leader, buf)))
                cp = buf;
        }
        if (cp == NULL || *cp == '\0')
@@ -131,7 +131,7 @@ march(void)
        }
        ac = parse(cp, player->argp, NULL, scanspace, NULL);
        if (ac <= 1) {
-           sprintf(dp, "%d", lnd->lnd_uid);
+           sprintf(dp, "%d", leader->uid);
            player->argp[1] = dp;
            cp++;
        } else
@@ -152,10 +152,10 @@ march(void)
                switch_leader(&land_list, -1);
            else
                switch_leader(&land_list, atoi(player->argp[1]));
-           lnd = (struct lndstr *)get_leader(&land_list);
-           if (lnd->lnd_uid != leader_uid) {
-               leader_uid = lnd->lnd_uid;
-               pr_leader_change((struct empobj *)lnd);
+           leader = get_leader(&land_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
            }
            break;
        case 'i':
@@ -177,7 +177,7 @@ march(void)
        case 'd':
            if (ac == 2) {
                player->argp[2] = player->argp[1];
-               sprintf(dp, "%d", lnd->lnd_uid);
+               sprintf(dp, "%d", leader->uid);
                player->argp[1] = dp;
            }
            landmine();
index a83b21a67ced2819538e6af82c10b2031b998941..32171030f15a5129dbf259b6341470ca06deb84d 100644 (file)
@@ -50,7 +50,7 @@ navi(void)
     int together;
     char *cp = NULL;
     int leader_uid;
-    struct shpstr *shp;        /* flagship */
+    struct empobj *leader;
     int dir;
     int stopping = 0;
     int skip = 0;
@@ -70,12 +70,12 @@ navi(void)
        pr("No ships\n");
        return RET_FAIL;
     }
-    shp = (struct shpstr *)get_leader(&ship_list);
-    leader_uid = shp->shp_uid;
-    pr("Flagship is %s\n", prship(shp));
+    leader = get_leader(&ship_list);
+    leader_uid = leader->uid;
+    pr("Flagship is %s\n", obj_nameof(leader));
     if (player->argp[2]) {
        strcpy(buf, player->argp[2]);
-       if (!(cp = shp_path(together, shp, buf)))
+       if (!(cp = shp_path(together, (struct shpstr *)leader, buf)))
            cp = player->argp[2];
     }
 
@@ -95,20 +95,20 @@ navi(void)
                }
                return RET_OK;
            }
-           shp = (struct shpstr *)get_leader(&ship_list);
-           if (shp->shp_uid != leader_uid) {
-               leader_uid = shp->shp_uid;
-               pr_leader_change((struct empobj *)shp);
+           leader = get_leader(&ship_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
                stopping = 1;
                continue;
            }
            if (!skip)
-               nav_map(shp->shp_x, shp->shp_y,
-                       !(mchr[(int)shp->shp_type].m_flags & M_SUB));
+               nav_map(leader->x, leader->y,
+                       !(mchr[(int)leader->type].m_flags & M_SUB));
            else
                skip = 0;
            sprintf(prompt, "<%.1f:%.1f: %s> ", maxmob,
-                   minmob, xyas(shp->shp_x, shp->shp_y, player->cnum));
+                   minmob, xyas(leader->x, leader->y, player->cnum));
            cp = getstring(prompt, buf);
            /* Just in case any of our ships were shelled while we were
             * at the prompt, we call shp_nav() again.
@@ -123,21 +123,21 @@ navi(void)
                }
                return RET_OK;
            }
-           shp = (struct shpstr *)get_leader(&ship_list);
-           if (shp->shp_uid != leader_uid) {
-               leader_uid = shp->shp_uid;
-               pr_leader_change((struct empobj *)shp);
+           leader = get_leader(&ship_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
                stopping = 1;
                continue;
            }
-           if (cp && !(cp = shp_path(together, shp, buf)))
+           if (cp && !(cp = shp_path(together, (struct shpstr *)leader, buf)))
                cp = buf;
        }
-       radmapnopr(shp->shp_x, shp->shp_y, (int)shp->shp_effic,
-                  (int)techfact(shp->shp_tech,
-                                mchr[(int)shp->shp_type].m_vrnge),
-                  (mchr[(int)shp->shp_type].m_flags & M_SONAR)
-                  ? techfact(shp->shp_tech, 1.0) : 0.0);
+       radmapnopr(leader->x, leader->y, (int)leader->effic,
+                  (int)techfact(leader->tech,
+                                mchr[(int)leader->type].m_vrnge),
+                  (mchr[(int)leader->type].m_flags & M_SONAR)
+                  ? techfact(leader->tech, 1.0) : 0.0);
        if (cp == NULL || *cp == '\0')
            cp = &dirch[DIR_STOP];
        dir = chkdir(*cp, DIR_STOP, DIR_VIEW);
@@ -156,7 +156,7 @@ navi(void)
        }
        ac = parse(cp, player->argp, NULL, scanspace, NULL);
        if (ac <= 1) {
-           sprintf(dp, "%d", shp->shp_uid);
+           sprintf(dp, "%d", leader->uid);
            player->argp[1] = dp;
            cp++;
        } else
@@ -177,10 +177,10 @@ navi(void)
                switch_leader(&ship_list, -1);
            else
                switch_leader(&ship_list, atoi(player->argp[1]));
-           shp = (struct shpstr *)get_leader(&ship_list);
-           if (shp->shp_uid != leader_uid) {
-               leader_uid = shp->shp_uid;
-               pr_leader_change((struct empobj *)shp);
+           leader = get_leader(&ship_list);
+           if (leader->uid != leader_uid) {
+               leader_uid = leader->uid;
+               pr_leader_change(leader);
            }
            break;
        case 'i':
@@ -206,7 +206,7 @@ navi(void)
        case 'd':
            if (ac == 2) {
                player->argp[2] = player->argp[1];
-               sprintf(dp, "%d", shp->shp_uid);
+               sprintf(dp, "%d", leader->uid);
                player->argp[1] = dp;
            }
            mine();