]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/wu.c
Update copyright notice.
[empserver] / src / lib / subs / wu.c
index b92e74c3b981172159e1309bc24ae959997ec9b8..722e47c8258a79f45bbab942e0c944bdd3188fcf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2007, 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.
  *
  *  ---
  *
  * 
  *  Known contributors to this file:
  *     Steve McClure, 2000
- *     
  */
 
-#include <stdarg.h>
-#include "misc.h"
+#include <config.h>
+
+#if defined(_WIN32) && !defined(__GNUC__)
+#include <io.h>
+#endif
 #include <fcntl.h>
+#include <stdarg.h>
+#include <stdlib.h>
 #if !defined(_WIN32)
+#include <unistd.h>
 #include <sys/uio.h>
 #endif
-#include "nat.h"
-#include "tel.h"
 #include "file.h"
-#include "player.h"
-#include "server.h"
+#include "misc.h"
+#include "nat.h"
 #include "optlist.h"
+#include "player.h"
 #include "prototypes.h"
+#include "server.h"
+#include "tel.h"
 
 static struct telstr last_tel[MAXNOC];
 
@@ -100,7 +106,7 @@ wu(natid from, natid to, char *format, ...)
     np = getnatp(from);
     if (update_pending)
        return typed_wu(from, to, buf, TEL_UPDATE);
-    else if (np->nat_stat & STAT_GOD)
+    else if (np->nat_stat == STAT_GOD)
        return typed_wu(from, to, buf, TEL_BULLETIN);
     else
        return typed_wu(from, to, buf, TEL_NORM);
@@ -134,11 +140,8 @@ typed_wu(natid from, natid to, char *message, int type)
        mailbox(box, to);
 
     if (type != TEL_ANNOUNCE)
-       if ((np = getnatp(to)) == 0 ||
-           ((np->nat_stat & STAT_NORM) == 0 &&
-            (np->nat_stat & STAT_SANCT) == 0)) {
+       if ((np = getnatp(to)) == 0 || np->nat_stat < STAT_SANCT)
            return -1;
-       }
 #if !defined(_WIN32)
     if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
 #else
@@ -174,8 +177,7 @@ typed_wu(natid from, natid to, char *message, int type)
        logerror("telegram 'write' to #%d failed to close.", to);
     } else if (write_ok && type == TEL_ANNOUNCE) {
        for (to = 0; NULL != (np = getnatp(to)); to++) {
-           if (!(np->nat_stat & STAT_NORM) &&
-               !(np->nat_stat & STAT_SANCT))
+           if (np->nat_stat < STAT_SANCT)
                continue;
            if (!player->god && (getrejects(from, np) & REJ_ANNO))
                continue;