]> git.pond.sub.org Git - empserver/commitdiff
(pln_airbase_ok, mission_pln_airbase_ok): Simplify conditional. Don't
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 3 Nov 2007 07:52:50 +0000 (07:52 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 3 Nov 2007 07:52:50 +0000 (07:52 +0000)
check a land carrier when the plane is already on a ship.

src/lib/subs/mission.c
src/lib/subs/plnsub.c

index 9d091dbbaac8854644250f18cc3fdf262051a378..dd6b30c41ea9f49fffc599c82cdb080ae05b7a8b 100644 (file)
@@ -929,8 +929,8 @@ mission_pln_airbase_ok(struct plnstr *pp)
             (getrel(getnatp(ship.shp_own), pp->pln_own) != ALLIED))) {
            return 0;
        }
-    }
-    if (pp->pln_land >= 0) {
+
+    } else if (pp->pln_land >= 0) {
        if (!getland(pp->pln_land, &land)) {
        landdead:
            pp->pln_effic = 0;
@@ -953,9 +953,8 @@ mission_pln_airbase_ok(struct plnstr *pp)
        if ((land.lnd_ship >= 0) || (land.lnd_land >= 0)) {
            return 0;
        }
-    }
-    /* Now, check the sector status if not on a plane or unit */
-    if ((pp->pln_ship < 0) && (pp->pln_land < 0)) {
+
+    } else {
        /* If we can't get the sector, we can't check it, and can't fly */
        if (!getsect(pp->pln_x, pp->pln_y, &sect)) {
            return 0;
@@ -973,6 +972,7 @@ mission_pln_airbase_ok(struct plnstr *pp)
            }
        }
     }
+
     return 1;
 }
 
index 6f60d94587e1e1b6b2fb652cb1ce4fb5c7c1f9dd..9e1daa93f64b88bf14c98619eefd8519865fa397 100644 (file)
@@ -384,6 +384,7 @@ pln_capable(struct plnstr *pp, int wantflags, int nowantflags)
 
     return 1;
 }
+
 static int
 pln_airbase_ok(struct plnstr *pp, int oneway)
 {
@@ -414,8 +415,8 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
               prplane(pp));
            return 0;
        }
-    }
-    if (pp->pln_land >= 0) {
+
+    } else if (pp->pln_land >= 0) {
        if (!getland(pp->pln_land, &land) ||
            (pp->pln_own != player->cnum)) {
        landdead:
@@ -440,9 +441,8 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
               prplane(pp));
            return 0;
        }
-    }
-    /* Now, check the sector status if not on a plane or unit */
-    if ((pp->pln_ship < 0) && (pp->pln_land < 0)) {
+
+    } else {
        if (!getsect(pp->pln_x, pp->pln_y, &sect))
            return 0;
        /* First, check allied status */
@@ -471,6 +471,7 @@ pln_airbase_ok(struct plnstr *pp, int oneway)
            }
        }
     }
+
     return 1;
 }