]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/news.c
Update copyright notice
[empserver] / src / lib / commands / news.c
index cb4fc065f10c0b4761b434486d966e26891e864e..8b9dcb2cc7767e4220a38a7136d5109351487c1a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,9 +26,9 @@
  *  ---
  *
  *  news.c: Show current Empire news
- * 
+ *
  *  Known contributors to this file:
- *     
+ *
  */
 
 #include <config.h>
@@ -61,8 +61,8 @@ news(void)
     char num[128];
     char *verb;
 
-    if (!snxtitem(&nstr, EF_NEWS, "*"))
-       return RET_SYN;
+    if (!snxtitem(&nstr, EF_NEWS, "*", NULL))
+       return RET_SYN;
     memset(page_has_news, 0, sizeof(page_has_news));
     memset(sectors_taken, 0, sizeof(sectors_taken));
     (void)time(&now);
@@ -85,6 +85,8 @@ news(void)
     head();
     pr("\nThe details of Empire news since %s", ctime(&then));
     while (nxtitem(&nstr, &nws)) {
+       if (!nws.nws_vrb || CANT_HAPPEN(nws.nws_vrb > N_MAX_VERB))
+           continue;
        if (nws.nws_when < then)
            continue;
        if (opt_HIDDEN) {
@@ -102,6 +104,8 @@ news(void)
        pr("\n\t ===  %s  ===\n", page_headings[page].name);
        snxtitem_rewind(&nstr);
        while (nxtitem(&nstr, &nws)) {
+           if (CANT_HAPPEN(nws.nws_vrb > N_MAX_VERB))
+               continue;
            if (rpt[(int)nws.nws_vrb].r_newspage != page)
                continue;
            if (nws.nws_when < then)
@@ -191,8 +195,6 @@ preport(struct nwsstr *np)
     strcpy(cp, cname(np->nws_ano));
     cp += strlen(cp);
     *cp++ = ' ';
-    if (np->nws_vrb < 1 || np->nws_vrb > N_MAX_VERB)
-       np->nws_vrb = 0;
     sprintf(cp, rpt[(int)np->nws_vrb].r_newstory[random() % NUM_RPTS],
            cname(np->nws_vno));
     cp += strlen(cp);
@@ -200,8 +202,6 @@ preport(struct nwsstr *np)
        sprintf(cp, " %s times", ptr);
        cp += strlen(cp);
     }
-    if (*buf >= 'a' && *buf <= 'z')
-       *buf += 'A' - 'a';
     if (cp - buf > 80) {
        for (i = 80; --i > 60;)
            if (buf[i] == ' ')