]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/news.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / commands / news.c
index 191c1b9b7d3856cb7a6e001b8cbf6c69eae29cf9..eb356fcc7d37f5c88d1cf7770c2c1611379a1948 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-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.
  *
  *  ---
  *
@@ -31,6 +31,8 @@
  *     
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "player.h"
 #include "nat.h"
@@ -65,30 +67,30 @@ news(void)
     s_char num[128];
     s_char *verb;
 
+    if (!snxtitem(&nstr, EF_NEWS, "*"))
+       return RET_SYN;
     memset(page_has_news, 0, sizeof(page_has_news));
     memset(sectors_taken, 0, sizeof(sectors_taken));
     (void)head();
     (void)time(&now);
     natp = getnatp(player->cnum);
     then = natp->nat_newstim;
-    /*
-     * Don't disclose events before contact.  Proper solution would be
-     * to timestamp the contact.  Cheesy approximatation: disable old
-     * news.
-     */
-    if (!opt_HIDDEN) {
-       if (player->argp[1] != 0 && isdigit(*player->argp[1])) {
-           delta = days(atoi(player->argp[1]));
-           then = now - delta;
+    if (player->argp[1]) {
+       /*
+        * We want to hide events before contact.  Proper solution
+        * would be to timestamp the contact.  Cheesy approximation:
+        * disable old news.
+        */
+       if (opt_HIDDEN && !player->god) {
+           pr("Sorry, argument doesn't work with HIDDEN enabled\n");
+           return RET_FAIL;
        }
+       delta = days(atoi(player->argp[1]));
+       then = now - delta;
     }
     natp->nat_newstim = now;
-/*     if (then < now - days(3))
-               then = now - days(3);
-*/
-    snxtitem(&nstr, EF_NEWS, "*");
     pr("\nThe details of Empire news since %s", ctime(&then));
-    while (nxtitem(&nstr, (s_char *)&nws)) {
+    while (nxtitem(&nstr, &nws)) {
        if (nws.nws_when < then)
            continue;
        if (opt_HIDDEN) {
@@ -105,7 +107,7 @@ news(void)
            continue;
        pr("\n\t ===  %s  ===\n", page_headings[page]);
        snxtitem_rewind(&nstr);
-       while (nxtitem(&nstr, (s_char *)&nws)) {
+       while (nxtitem(&nstr, &nws)) {
            if (rpt[(int)nws.nws_vrb].r_newspage != page)
                continue;
            if (nws.nws_when < then)