]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/snxtsct.c
New macro ARRAY_SIZE()
[empserver] / src / lib / subs / snxtsct.c
index 7657c4560c9866ab944235b314467b4f8a007219..2a29d369c971049a65cca12f5819633364b4a872 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
  *
  *  Known contributors to this file:
  *     Dave Pare, 1989
- *     Markus Armbruster, 2006-2011
+ *     Markus Armbruster, 2006-2020
  */
 
 #include <config.h>
 
-#include "file.h"
 #include "misc.h"
 #include "nat.h"
 #include "nsc.h"
@@ -44,7 +43,7 @@
 
 /*
  * setup the nstr_sect structure for sector selection.
- * can select on either NS_ALL, NS_AREA, or NS_RANGE
+ * can select on either NS_ALL, NS_AREA, or NS_DIST
  * iterate thru the "condarg" string looking
  * for arguments to compile into the nstr.
  * Using this function for anything but command arguments is usually
@@ -63,7 +62,8 @@ snxtsct(struct nstr_sect *np, char *str)
     if (!str || !*str) {
        if (!(str = getstring("(sects)? ", buf)))
            return 0;
-    }
+    } else
+       make_stale_if_command_arg(str);
     switch (sarg_type(str)) {
     case NS_AREA:
        if (!sarg_area(str, &range))
@@ -127,7 +127,7 @@ snxtsct_use_condarg(struct nstr_sect *np)
 
     if (!player->condarg)
        return 1;
-    n = nstr_comp(np->cond, sizeof(np->cond) / sizeof(*np->cond),
+    n = nstr_comp(np->cond, ARRAY_SIZE(np->cond),
                  EF_SECTOR, player->condarg);
     if (n < 0)
        return 0;