]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/mslsub.c
Update known contributors comments
[empserver] / src / lib / subs / mslsub.c
index 6836be98e2131a742e350583f9974513f8024503..db7afb5a81871a118417c9999d0333575134bd0b 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
@@ -30,7 +29,7 @@
  *  Known contributors to this file:
  *     Ken Stevens, 1995
  *     Steve McClure, 1996-2000
- *     Markus Armbruster, 2004-2009
+ *     Markus Armbruster, 2004-2010
  */
 
 #include <config.h>
@@ -62,7 +61,7 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
     struct nukstr nuke;
     struct sctstr sect;
     int sublaunch = 0;
-    char *from;
+    char *base, *in_or_at, *from;
     int dam;
 
     mpr(pp->pln_own, "Preparing to launch %s at %s %s %s%s\n",
@@ -71,31 +70,37 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
        what,
        type != EF_SECTOR ? "in " : "",
        xyas(x, y, pp->pln_own));
-    mpr(pp->pln_own, "\tLaunching from ");
     if (pp->pln_ship >= 0) {
        getship(pp->pln_ship, &ship);
-       mpr(pp->pln_own, "%s in ", prship(&ship));
+       base = prship(&ship);
+       in_or_at = " in ";
        if (mchr[(int)ship.shp_type].m_flags & M_SUB) {
            sublaunch = 1;
            from = "in hatch";
        } else
            from = "on deck";
-       mpr(pp->pln_own, "%s\n",
-           xyas(ship.shp_x, ship.shp_y, pp->pln_own));
     } else {
        if (pp->pln_harden > 0) {
-           mpr(pp->pln_own, "missile silo at ");
+           base = "missile silo";
+           in_or_at = " at ";
            from = "in silo";
-       } else
+       } else {
+           base = in_or_at = "";
            from = "on launch pad";
-       mpr(pp->pln_own, "%s\n", xyas(pp->pln_x, pp->pln_y, pp->pln_own));
+       }
     }
+    mpr(pp->pln_own, "\tLaunching from %s%s%s\n",
+       base, in_or_at, xyas(pp->pln_x, pp->pln_y, pp->pln_own));
+
+    CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
+    pp->pln_flags |= PLN_LAUNCHED;
+    putplane(pp->pln_uid, pp);
 
     if (chance((0.05 + (100 - pp->pln_effic) / 100.0)
               * (1 - techfact(pp->pln_tech, 1.0)))) {
        mpr(pp->pln_own, "KABOOOOM!  Missile explodes %s!\n", from);
        if (getnuke(nuk_on_plane(pp), &nuke)) {
-           pr("%s lost!\n", prnuke(&nuke));
+           mpr(pp->pln_own, "%s lost!\n", prnuke(&nuke));
            nuke.nuk_effic = 0;
            putnuke(nuke.nuk_uid, &nuke);
        }
@@ -105,8 +110,8 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
                shipdamage(&ship, dam);
                putship(ship.shp_uid, &ship);
            } else {
-               pr("Explosion damages %s %d%%\n",
-                  xyas(pp->pln_x, pp->pln_y, pp->pln_own), dam);
+               mpr(pp->pln_own, "Explosion damages %s %d%%\n",
+                   xyas(pp->pln_x, pp->pln_y, pp->pln_own), dam);
                getsect(pp->pln_x, pp->pln_y, &sect);
                sectdamage(&sect, dam);
                putsect(&sect);
@@ -115,9 +120,6 @@ msl_launch(struct plnstr *pp, int type, char *what, coord x, coord y,
        return -1;
     }
 
-    CANT_HAPPEN(pp->pln_flags & PLN_LAUNCHED);
-    pp->pln_flags |= PLN_LAUNCHED;
-    putplane(pp->pln_uid, pp);
     mpr(pp->pln_own, "\tSHWOOOOOSH!  Missile launched!\n");
 
     if (type != EF_PLANE)
@@ -196,7 +198,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
        if (mission &&
            plane.pln_radius < mapdist(x, y, plane.pln_opx, plane.pln_opy))
            continue;
-       if (getrel(getnatp(plane.pln_own), victim) >= NEUTRAL)
+       if (relations_with(plane.pln_own, victim) >= NEUTRAL)
            continue;
        /* missiles go one way, so we can use all the range */
        if (plane.pln_range < mapdist(x, y, plane.pln_x, plane.pln_y))