]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/mslsub.c
Improve launch diagnostic messages, switch off supply
[empserver] / src / lib / subs / mslsub.c
index f5decdd09a177b2087a184687b335d3272c2e458..34a91b6708ba7cfc3350d9a85597589646d29b4b 100644 (file)
@@ -61,7 +61,7 @@ msl_equip(struct plnstr *pp, char mission)
     memset(&pl, 0, sizeof(struct plist));
     pl.pcp = plchr + pp->pln_type;
     pl.plane = *pp;
-    return mission_pln_equip(&pl, 0, 0, mission);
+    return pln_equip(&pl, NULL, mission);
 }
 
 int
@@ -73,7 +73,7 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
     struct sctstr sect;
     int sublaunch = 0;
     struct plchrstr *pcp = plchr + pp->pln_type;
-    int hitchance = pln_hitchance(pp, hardtarget, type);
+    int hitchance;
     char *from;
     int dam, dummyi;
 
@@ -130,18 +130,12 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
     putplane(pp->pln_uid, pp);
     mpr(pp->pln_own, "\tSHWOOOOOSH!  Missile launched!\n");
 
-    if (nuk_on_plane(pp) >= 0) {
-       mpr(pp->pln_own, "\tArming nuclear warheads...\n");
-       hitchance = 100;
-    }
-
     if (pcp->pl_flags & P_T)
        mpr(victim, "Incoming %s missile sighted at %s...\n",
            sublaunch ? "sub-launched" : cname(pp->pln_own),
            xyas(x, y, victim));
 
-    if (opt_PINPOINTMISSILE == 0 ||
-       (pcp->pl_flags & P_T && !(pcp->pl_flags & P_MAR))) {
+    if ((pcp->pl_flags & P_T && !(pcp->pl_flags & P_MAR))) {
        if (msl_intercept(x, y, pp->pln_own, pcp->pl_def,
                          sublaunch, P_N, P_O)) {
            return 0;
@@ -153,10 +147,16 @@ msl_hit(struct plnstr *pp, int hardtarget, int type, int news_item,
        }
     }
 
-    mpr(pp->pln_own, "\t%d%% hitchance...", hitchance);
-    hit = (roll(100) <= hitchance);
+    if (nuk_on_plane(pp) >= 0) {
+       mpr(pp->pln_own, "\tArming nuclear warheads...\n");
+       hit = 1;
+    } else {
+       hitchance = pln_hitchance(pp, hardtarget, type);
+       hit = (roll(100) <= hitchance);
+       mpr(pp->pln_own, "\t%d%% hitchance...%s\n", hitchance,
+           hit ? "HIT!" : "miss");
+    }
 
-    mpr(pp->pln_own, hit ? "HIT!\n" : "miss\n");
     if (pcp->pl_flags & P_T)
        mpr(victim, "...Incoming %s missile %s\n",
            sublaunch ? "" : cname(pp->pln_own),
@@ -210,8 +210,7 @@ msl_sel(struct emp_qelem *list, coord x, coord y, natid victim,
            continue;
        /* got a valid interceptor */
        irv = malloc(sizeof(*irv));
-       irv->bombs = 0;
-       irv->misc = 0;
+       irv->load = 0;
        irv->pcp = &plchr[(int)plane.pln_type];
        irv->plane = plane;
        emp_insque(&irv->queue, list);
@@ -271,7 +270,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        if (pp->pln_own != sect.sct_own)
            continue;
        pcp = ip->pcp;
-       if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
+       if (mission_pln_equip(ip, NULL, 'i') < 0) {
            emp_remque(qp);
            free(qp);
            continue;
@@ -290,7 +289,7 @@ msl_intercept(coord x, coord y, natid bombown, int hardtarget,
        ip = (struct plist *)qp;
        pp = &ip->plane;
        pcp = ip->pcp;
-       if (mission_pln_equip(ip, 0, 0, 'i') < 0) {
+       if (mission_pln_equip(ip, NULL, 'i') < 0) {
            emp_remque(qp);
            free(qp);
            continue;
@@ -401,7 +400,7 @@ msl_launch_mindam(struct emp_qelem *list, coord x, coord y, int hardtarget,
        next = qp->q_back;
        plp = (struct plist *)qp;
 
-       if (mission_pln_equip(plp, 0, 0, 'p') >= 0) {
+       if (mission_pln_equip(plp, NULL, 'p') >= 0) {
            if (msl_hit(&plp->plane,
                        hardtarget, type, news_item, snews_item,
                        whatp, x, y, victim)) {