]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/snxtitem.c
Update copyright notice.
[empserver] / src / lib / subs / snxtitem.c
index d3ba6bcc74a4a5320f042d86c0aeb8054b36f099..4cac3a71566eaacb5357e07a9bfa4d80992e61f2 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.
  *
  *  ---
  *
@@ -31,6 +31,9 @@
  *     Dave Pare, 1989
  */
 
+#include <config.h>
+
+#include <ctype.h>
 #include "misc.h"
 #include "player.h"
 #include "xy.h"
  * can select on NS_ALL, NS_AREA, NS_DIST, and NS_LIST.
  * iterate thru the "condarg" string looking
  * for arguments to compile into the nstr.
+ * Using this function for anything but command arguments is usually
+ * incorrect, because it respects conditionals.  Use the snxtitem_FOO()
+ * instead.
  */
 int
-snxtitem(struct nstr_item *np, int type, s_char *str)
+snxtitem(struct nstr_item *np, int type, char *str)
 {
     struct range range;
     int list[NS_LSIZE];
@@ -53,9 +59,9 @@ snxtitem(struct nstr_item *np, int type, s_char *str)
     coord cx, cy;
     int dist;
     int flags;
-    s_char natnumber[16];
-    s_char prompt[128];
-    s_char buf[1024];
+    char natnumber[16];
+    char prompt[128];
+    char buf[1024];
 
     np->type = EF_BAD;
     np->sel = NS_UNDEF;
@@ -70,7 +76,7 @@ snxtitem(struct nstr_item *np, int type, s_char *str)
        return 0;
     }
     if (type == EF_NATION && isalpha(*str)) {
-       sprintf(natnumber, "%d", natarg(str, ""));
+       sprintf(natnumber, "%d", natarg(str, NULL));
        str = natnumber;
     }
     flags = ef_flags(type);
@@ -134,7 +140,6 @@ snxtitem_area(struct nstr_item *np, int type, struct range *range)
     np->read = ef_read;
     np->flags = ef_flags(type);
     xysize_range(&np->range);
-    ef_zapcache(type);
 }
 
 void
@@ -160,7 +165,6 @@ snxtitem_dist(struct nstr_item *np, int type, int cx, int cy,
     /* It did the wrong thing for small, hitech worlds. */
     xysize_range(&np->range);
 #endif
-    ef_zapcache(type);
 }
 
 void
@@ -176,7 +180,6 @@ snxtitem_xy(struct nstr_item *np, int type, coord x, coord y)
     np->dist = 0;
     np->read = ef_read;
     np->flags = ef_flags(type);
-    ef_zapcache(type);
 }
 
 void
@@ -190,14 +193,13 @@ snxtitem_all(struct nstr_item *np, int type)
     np->read = ef_read;
     np->flags = ef_flags(type);
     xysize_range(&np->range);
-    ef_zapcache(type);
 }
 
 void
-snxtitem_group(struct nstr_item *np, int type, s_char group)
+snxtitem_group(struct nstr_item *np, int type, char group)
 {
     if (group == '~')
-       group = ' ';
+       group = 0;
     memset(np, 0, sizeof(*np));
     np->cur = -1;
     np->sel = NS_GROUP;
@@ -207,7 +209,6 @@ snxtitem_group(struct nstr_item *np, int type, s_char group)
     np->read = ef_read;
     np->flags = ef_flags(type);
     xysize_range(&np->range);
-    ef_zapcache(type);
 }
 
 void
@@ -215,7 +216,6 @@ snxtitem_rewind(struct nstr_item *np)
 {
     np->cur = -1;
     np->index = -1;
-    ef_zapcache(np->type);
 }
 
 int
@@ -235,6 +235,5 @@ snxtitem_list(struct nstr_item *np, int type, int *list, int len)
     for (i = 0; i < len; i++)
        np->list[i] = list[i];
     np->size = len;
-    ef_zapcache(type);
     return 1;
 }