]> git.pond.sub.org Git - empserver/commitdiff
Oops on unexpected mission in pln_equip() and mission_pln_equip()
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 24 Mar 2008 08:30:37 +0000 (09:30 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 26 Mar 2008 21:10:28 +0000 (22:10 +0100)
src/lib/subs/mission.c
src/lib/subs/plnsub.c

index 7ce44e0e5ada9bc2846af71c1316e0c947a564c1..a80e8cf618b958ab176727dd23cbf2a2ebe50502 100644 (file)
@@ -1010,21 +1010,21 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
        itype = I_NONE;
        needed = 0;
        switch (mission) {
-       case 's':
-       case 'p':
+       case 's':               /* strategic bomb */
+       case 'p':               /* pinpoint bomb */
            if (pp->pln_nuketype == -1) {
                itype = I_SHELL;
                needed = load;
            }
            break;
-       case 't':
-       case 'd':
+       case 't':               /* transport */
+       case 'd':               /* drop */
            if ((pcp->pl_flags & P_C) == 0 || ip == 0)
                break;
            itype = ip->i_uid;
            needed = (load * 2) / ip->i_lbs;
            break;
-       case 'a':
+       case 'a':               /* paradrop */
            if ((pcp->pl_flags & (P_V | P_C)) == 0)
                break;
            itype = I_MILIT;
@@ -1036,7 +1036,10 @@ mission_pln_equip(struct plist *plp, struct ichrstr *ip, int flags,
                needed = load;
            }
            break;
+       case 0:                 /* plane interception */
+           break;
        default:
+           CANT_REACH();
            break;
        }
        if (itype != I_NONE && needed <= 0)
index 24b01006d52058b136370ca6e525e3d25b6868dd..e6f9768f4a6f3c0632b80332ead07b01cbb3500a 100644 (file)
@@ -643,34 +643,36 @@ pln_equip(struct plist *plp, struct ichrstr *ip, int flags, char mission)
        itype = I_NONE;
        needed = 0;
        switch (mission) {
-       case 's':
-       case 'p':
+       case 's':               /* strategic bomb */
+       case 'p':               /* pinpoint bomb */
            if (pp->pln_nuketype == -1) {
                itype = I_SHELL;
                needed = load;
            }
            break;
-       case 't':
-       case 'd':
+       case 't':               /* transport */
+       case 'd':               /* drop */
            if ((pcp->pl_flags & P_C) == 0 || ip == 0)
                break;
            itype = ip->i_uid;
            needed = (load * 2) / ip->i_lbs;
            break;
-       case 'm':
+       case 'm':               /* mine */
            if ((pcp->pl_flags & P_MINE) == 0)
                break;
            itype = I_SHELL;
            needed = (load * 2) / ip->i_lbs;
            break;
-       case 'a':
+       case 'a':               /* paradrop */
            if ((pcp->pl_flags & (P_V | P_C)) == 0)
                break;
            itype = I_MILIT;
            needed = load / ip->i_lbs;
            break;
-       default:
+       case 'r':               /* reconnaissance */
            break;
+       default:
+           CANT_REACH();
        }
        if (itype != I_NONE && needed <= 0) {
            pr("%s can't contribute to mission\n", prplane(pp));