]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/orde.c
Update copyright notice
[empserver] / src / lib / commands / orde.c
index f3ae6a36696f1324fb17df313db8f58dd8e67a76..4515fb17f1981cc3fc2ac1d63bcfe5ff61c931c5 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-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *  ---
  *
  *  orde.c: Turn on/off autonavigation
- * 
+ *
  *  Known contributors to this file:
  *     Chad Zabel, 1994
  *     Steve McClure, 2000
@@ -34,7 +34,6 @@
 
 #include <config.h>
 
-#include <ctype.h>
 #include "commands.h"
 #include "item.h"
 #include "optlist.h"
@@ -53,8 +52,8 @@
  *  ORDER <ship> l[evel]   <field> <start/end> <comm> <level>
  *
  * New syntax:
- *  qorder <ship>    display cargo levels     
- *  sorder <ship>    display statistical info 
+ *  qorder <ship>    display cargo levels
+ *  sorder <ship>    display statistical info
  */
 
 int
@@ -74,7 +73,7 @@ orde(void)
     char buf[1024];
     char prompt[128];
 
-    if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
+    if (!snxtitem(&nb, EF_SHIP, player->argp[1], NULL))
        return RET_SYN;
     while (!player->aborted && nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)
@@ -137,7 +136,9 @@ orde(void)
 
            if (!orders) {
                p = getstarg(player->argp[4], "Second dest? ", buf);
-               if (!p || !*p || !strcmp(p, "-")) {
+               if (!p)
+                   return RET_FAIL;
+               if (!*p || !strcmp(p, "-")) {
                    orders = 1;
                    pr("A one-way order has been accepted.\n");
                } else if (!strncmp(p, "s", 1)) {
@@ -193,7 +194,7 @@ orde(void)
                break;
            }
 
-           /* to keep sub in range of our arrays 
+           /* to keep sub in range of our arrays
               subtract 1 so the new range is 0-(TMAX-1)
             */
            sub = sub - 1;;
@@ -278,7 +279,7 @@ orde(void)
 
            ship.shp_autonav |= AN_LOADING;
 
-           /*  swap variables, this keeps 
+           /*  swap variables, this keeps
               the load_it() procedure happy. CZ
             */
            tcord = ship.shp_destx[0];
@@ -356,7 +357,7 @@ qorde(void)
     struct nstr_item nb;
     struct shpstr ship;
 
-    if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
+    if (!snxtitem(&nb, EF_SHIP, player->argp[1], NULL))
        return RET_SYN;
     while (nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)
@@ -418,7 +419,7 @@ sorde(void)
     struct shpstr ship;
     char buf[1024];
 
-    if (!snxtitem(&nb, EF_SHIP, player->argp[1]))
+    if (!snxtitem(&nb, EF_SHIP, player->argp[1], NULL))
        return RET_SYN;
     while (nxtitem(&nb, (&ship))) {
        if (!player->owner || ship.shp_own == 0)