]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/satmap.c
Update copyright notice.
[empserver] / src / lib / subs / satmap.c
index 95325bcd312b3a453a4d072ca234e3531ccbe961..ad472e92ebc2d8d5ea5fe0ecd8c33579060aaa44 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -46,8 +46,6 @@
 #include "prototypes.h"
 #include "optlist.h"
 
-void satdisp(struct sctstr *sp, int acc, int showstuff);
-
 static s_char **rad;
 static s_char *radbuf;
 
@@ -122,7 +120,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
            if (noise[crackle])
                continue;
            if (flags & P_S) {
-               if (sect.sct_type > SCT_RURAL) {
+               if (sect.sct_own && sect.sct_own != player->cnum) {
                    satdisp(&sect, acc, 0);
                    ++count;
                }
@@ -161,7 +159,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
                pr(" own  shp# ship type         sector   eff\n");
            }
        }
-       while (nxtitem(&ni, (caddr_t)&ship)) {
+       while (nxtitem(&ni, &ship)) {
            if (ship.shp_own == 0)
                continue;
            if ((mchr[(int)ship.shp_type].m_flags & M_SUB) &&
@@ -216,7 +214,7 @@ satmap(int x, int y, int eff, int range, int flags, int type)
            prdate();
            pr(" own  lnd# unit type         sector   eff\n");
        }
-       while (nxtitem(&ni, (caddr_t)&land)) {
+       while (nxtitem(&ni, &land)) {
            if (land.lnd_own == 0)
                continue;
            if (!chance((double)land.lnd_effic / 20.0))
@@ -285,31 +283,32 @@ sathead(void)
 void
 satdisp(struct sctstr *sp, int acc, int showstuff)
 {
-    int vec[I_MAX + 1], first;
+    int first;
     struct nstr_item ni;
     struct shpstr ship;
     struct lndstr land;
 
-    if (getvec(VT_ITEM, vec, (caddr_t)sp, EF_SECTOR) < 0)
-       return;
-    prxy("%4d,%-4d   ", sp->sct_x, sp->sct_y, player->cnum),
-       pr("%c  %3d  %3d %3d %3d %3d %4d %4d %4d %4d %4d %4d %5d\n",
-          dchr[sp->sct_type].d_mnem,
-          sp->sct_own, roundintby((int)sp->sct_effic, acc / 2),
-          roundintby((int)sp->sct_road, acc / 2),
-          roundintby((int)sp->sct_rail, acc / 2),
-          roundintby((int)sp->sct_defense, acc / 2),
-          roundintby(vec[I_CIVIL], acc), roundintby(vec[I_MILIT], acc),
-          roundintby(vec[I_SHELL], acc), roundintby(vec[I_GUN], acc),
-          roundintby(vec[I_IRON], acc), roundintby(vec[I_PETROL], acc),
-          roundintby(vec[I_FOOD], acc));
+    prxy("%4d,%-4d   ", sp->sct_x, sp->sct_y, player->cnum);
+    pr("%c  %3d  %3d %3d %3d %3d %4d %4d %4d %4d %4d %4d %5d\n",
+       dchr[sp->sct_type].d_mnem,
+       sp->sct_own, roundintby((int)sp->sct_effic, acc / 2),
+       roundintby((int)sp->sct_road, acc / 2),
+       roundintby((int)sp->sct_rail, acc / 2),
+       roundintby((int)sp->sct_defense, acc / 2),
+       roundintby(sp->sct_item[I_CIVIL], acc),
+       roundintby(sp->sct_item[I_MILIT], acc),
+       roundintby(sp->sct_item[I_SHELL], acc),
+       roundintby(sp->sct_item[I_GUN], acc),
+       roundintby(sp->sct_item[I_IRON], acc),
+       roundintby(sp->sct_item[I_PETROL], acc),
+       roundintby(sp->sct_item[I_FOOD], acc));
     map_set(player->cnum, sp->sct_x, sp->sct_y, dchr[sp->sct_type].d_mnem,
            0);
     if (!showstuff)
        return;
     snxtitem_xy(&ni, EF_SHIP, sp->sct_x, sp->sct_y);
     first = 1;
-    while (nxtitem(&ni, (caddr_t)&ship)) {
+    while (nxtitem(&ni, &ship)) {
        if (ship.shp_own == 0)
            continue;
        if (mchr[(int)ship.shp_type].m_flags & M_SUB)
@@ -336,7 +335,7 @@ satdisp(struct sctstr *sp, int acc, int showstuff)
     snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
     first = 1;
 
-    while (nxtitem(&ni, (caddr_t)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == 0)
            continue;
        if (!chance((double)land.lnd_effic / 20.0))