]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/miss.c
Update copyright notice
[empserver] / src / lib / commands / miss.c
index ab403878bbac942b69bd39789349cee71f16e04b..7140ae2610ca35e9ed539ca478e245d1baa8941c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, 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
@@ -30,6 +30,7 @@
  *  Known contributors to this file:
  *     Thomas Ruschak, 1992
  *     Steve McClure, 2000
+ *     Markus Armbruster, 2005-2009
  */
 
 #include <config.h>
@@ -61,9 +62,9 @@ mission(void)
     struct nstr_item ni;
     char buf[1024];
 
-    if ((p =
-        getstarg(player->argp[1], "Ship, plane or land unit (p,sh,la)? ",
-                 buf)) == 0)
+    p = getstarg(player->argp[1], "Ship, plane or land unit (p,sh,la)? ",
+                buf);
+    if (!p)
        return RET_SYN;
     type = ef_byname_from(p, ef_with_missions);
     if (type < 0) {
@@ -73,10 +74,10 @@ mission(void)
     if (!snxtitem(&ni, type, player->argp[2], NULL))
        return RET_SYN;
 
-    if ((p =
-        getstarg(player->argp[3],
-                 "Mission (int, sup, osup, dsup, esc, res, air, query, clear)? ",
-                 buf)) == 0)
+    p = getstarg(player->argp[3],
+                "Mission (int, sup, osup, dsup, esc, res, air, query, clear)? ",
+                buf);
+    if (!p)
        return RET_SYN;
 
 /*
@@ -148,8 +149,8 @@ mission(void)
        return RET_FAIL;
     }
 
-    if ((p = getstarg(player->argp[4], "operations point? ", buf)) == 0
-       || *p == 0)
+    p = getstarg(player->argp[4], "operations point? ", buf);
+    if (!p || !*p)
        return RET_SYN;
 
     if (*p != '.') {
@@ -172,10 +173,16 @@ mission(void)
        if (!player->owner || gp->own == 0)
            continue;
 
-       if (mission == MI_RESERVE && !lnd_can_attack((struct lndstr *)gp)) {
-           pr("%s is not designed to fight ground troops\n",
-              obj_nameof(gp));
-           continue;
+       if (mission == MI_RESERVE) {
+           if (!lnd_can_attack((struct lndstr *)gp)) {
+               pr("%s is not designed to fight ground troops\n",
+                  obj_nameof(gp));
+               continue;
+           }
+           if (!lchr[gp->type].l_rad) {
+               pr("%s cannot react anywhere!\n", obj_nameof(gp));
+               continue;
+           }
        }
 
        if ((mission == MI_INTERDICT) && (type == EF_SHIP))
@@ -239,6 +246,12 @@ mission(void)
            }
        }
 
+       if (type == EF_PLANE && nuk_on_plane((struct plnstr *)gp) >= 0) {
+           pr("%s can't perform a mission while it carries a nuclear weapon",
+              obj_nameof(gp));
+           continue;
+       }
+
        if (*p == '.') {
            x = gp->x;
            y = gp->y;