]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/plnsub.c
bomb launch interdiction: Fix crash on bombs missing target
[empserver] / src / lib / subs / plnsub.c
index f8eeaa613775fd93837324dc2f144af5537c8d4c..29c1f9af095599e7c13e31f891e90516bcb80167 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2016, 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
  *     Dave Pare, 1986
  *     Ken Stevens, 1995
  *     Steve McClure, 1998-2000
- *     Markus Armbruster, 2004-2016
+ *     Markus Armbruster, 2004-2020
  */
 
 #include <config.h>
 
 #include "chance.h"
 #include "empobj.h"
-#include "file.h"
 #include "item.h"
 #include "land.h"
 #include "map.h"
@@ -110,7 +109,7 @@ get_assembly_point(char *input, struct sctstr *ap_sect, char *buf)
     /* over own or allied ship is fine */
     snxtitem_xy(&ni, EF_SHIP, x, y);
     while (nxtitem(&ni, &ship)) {
-       if (ship.shp_effic < SHIP_MINEFF || ship.shp_own == 0)
+       if (!ship.shp_own)
            continue;
        if (relations_with(ship.shp_own, player->cnum) == ALLIED)
            return ap_sect;
@@ -239,7 +238,7 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno)
                       cname(player->cnum), prplane(&plp->plane),
                       prship(&ship));
                }
-               if (plp->pcp->pl_mat[I_MILIT] && plp->pstage == PLG_INFECT
+               if (plp->pstage == PLG_INFECT
                    && ship.shp_pstage == PLG_HEALTHY)
                    ship.shp_pstage = PLG_EXPOSED;
            }
@@ -253,7 +252,7 @@ pln_newlanding(struct emp_qelem *list, coord tx, coord ty, int cno)
                   cname(player->cnum),
                   prplane(&plp->plane), xyas(tx, ty, sect.sct_own));
            }
-           if (plp->pcp->pl_mat[I_MILIT] && plp->pstage == PLG_INFECT
+           if (plp->pstage == PLG_INFECT
                && sect.sct_pstage == PLG_HEALTHY)
                sect.sct_pstage = PLG_EXPOSED;
            plp->plane.pln_ship = cno;
@@ -358,7 +357,7 @@ pln_mine(struct emp_qelem *list, coord tx, coord ty)
     if (amt > 0) {
        getsect(tx, ty, &sect);
        if (sect.sct_type != SCT_WATER) {
-           pr("Your seamines have no effect here.\n");
+           pr("Your sea mines have no effect here.\n");
            return;
        }
        sect.sct_mines = MIN(sect.sct_mines + amt, MINES_MAX);
@@ -582,7 +581,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
            continue;
        if (opt_MARKET) {
            if (ontradingblock(EF_PLANE, &plane)) {
-               pr("plane #%d inelligible - it's for sale.\n",
+               pr("plane #%d ineligible - it's for sale.\n",
                   plane.pln_uid);
                continue;
            }
@@ -827,7 +826,7 @@ pln_put1(struct plist *plp)
        /* We should do more, like make sure it's really
           a carrier, etc. but for now just make sure it's
           not sunk. */
-       if (ship.shp_effic < SHIP_MINEFF) {
+       if (!ship.shp_own) {
            mpr(pp->pln_own,
                "Ship #%d has been sunk, plane #%d has nowhere to land, and\n"
                "splashes into the sea.\n",
@@ -1053,7 +1052,7 @@ pln_damage(struct plnstr *pp, char type, char *noisy)
        aim = 100 - aim;
     }
 
-    len = snprintf(buf, sizeof(buf), "%s", noisy);
+    len = noisy ? snprintf(buf, sizeof(buf), "%s", noisy) : 0;
     while (i--) {
        if (noisy) {
            if (len > 75) {