]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/spy.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / spy.c
index a0f298318a98646715f456ab0d8f33df9faec1f2..8cc46ebbb22971597dd787042aa471fea573fe59 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *     Steve McClure, 1998-2000
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "player.h"
-#include "var.h"
 #include "sect.h"
 #include "item.h"
 #include "nat.h"
 #include "xy.h"
 #include "nsc.h"
-#include "nuke.h"
 #include "news.h"
 #include "path.h"
 #include "file.h"
@@ -101,7 +101,7 @@ spy(void)
      * set up all the goodies we need later
      * 6 = neighbors, 2 = x,y
      */
-    table = (coord *)malloc((nsects + 1) * 6 * 2 * sizeof(coord));
+    table = malloc((nsects + 1) * 6 * 2 * sizeof(coord));
     memset(table, 0, (nsects + 1) * 6 * 2 * sizeof(coord));
     pr("SPY report\n");
     prdate();
@@ -113,7 +113,7 @@ spy(void)
        nrecon = 0;
        nunits = 0;
        snxtitem_xy(&ni, EF_LAND, from.sct_x, from.sct_y);
-       while (nxtitem(&ni, (s_char *)&land)) {
+       while (nxtitem(&ni, &land)) {
            nunits++;
            if (lchr[(int)land.lnd_type].l_flags & L_RECON)
                nrecon++;
@@ -163,8 +163,10 @@ spy(void)
                    wu(0, own, "%s (#%d) spy deported from %s\n",
                       cname(player->cnum), player->cnum,
                       xyas(nx, ny, own));
+               if (opt_HIDDEN)
+                   setcont(own, player->cnum, FOUND_SPY);
            } else if (relat < NEUTRAL && caught) {
-               /* at-war with spy-ee */
+               /* hostile spy-ee */
                pr("BANG!! A spy was shot in %s\n",
                   xyas(nx, ny, player->cnum));
                military--;
@@ -173,6 +175,8 @@ spy(void)
                       cname(player->cnum), player->cnum,
                       xyas(nx, ny, own));
                nreport(player->cnum, N_SPY_SHOT, own, 1);
+               if (opt_HIDDEN)
+                   setcont(own, player->cnum, FOUND_SPY);
            } else {
                insert(table, &t_len, nx, ny);
                spyline(&dsect);
@@ -181,9 +185,8 @@ spy(void)
                                   dchr[dsect.sct_type].d_mnem, 0);
                prunits(dsect.sct_x, dsect.sct_y);
                prplanes(dsect.sct_x, dsect.sct_y);
-               if (opt_HIDDEN) {
+               if (opt_HIDDEN)
                    setcont(player->cnum, own, FOUND_SPY);
-               }
            }
            /*
             * If you have a recon unit, it'll
@@ -210,7 +213,7 @@ spy(void)
     if (changed)
        writemap(player->cnum);
     player->btused += btucost;
-    free((s_char *)table);
+    free(table);
     return RET_OK;
 }
 
@@ -277,7 +280,7 @@ num_units(int x, int y)
     int n = 0;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if ((land.lnd_own == player->cnum) || (land.lnd_own == 0))
            continue;
        if (land.lnd_ship >= 0 || land.lnd_land >= 0)
@@ -296,7 +299,7 @@ prunits(int x, int y)
     s_char report[128];
 
     snxtitem_xy(&ni, EF_LAND, x, y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (land.lnd_own == player->cnum || land.lnd_own == 0)
            continue;
        if (land.lnd_ship >= 0 || land.lnd_land >= 0)
@@ -332,7 +335,7 @@ prplanes(int x, int y)
     s_char report[128];
 
     snxtitem_xy(&ni, EF_PLANE, x, y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (plane.pln_own == player->cnum || plane.pln_own == 0)
            continue;
        if (plane.pln_ship >= 0 || plane.pln_land >= 0)