]> git.pond.sub.org Git - empserver/commitdiff
Don't permit bombing of embarked planes and land units
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 2 Aug 2008 21:28:05 +0000 (17:28 -0400)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 2 Aug 2008 21:28:05 +0000 (17:28 -0400)
Change planesatxy() not to list embarked planes, plane_bomb() not to
bomb them, and land_bomb() not to bomb embarked land units.

Curiously, embarked land units were not listed as targets before, but
could be bombed all the same.

src/lib/commands/bomb.c
src/lib/subs/list.c

index 8713356764771ffd9fd5a08dc8ebbd6c48c06bc9..880f387a58615a67cb46543b3388ea418ed25c76 100644 (file)
@@ -638,6 +638,7 @@ plane_bomb(struct emp_qelem *list, struct sctstr *target)
            if (getplane(n, &plane) &&
                plane.pln_x == target->sct_x &&
                plane.pln_y == target->sct_y &&
+               plane.pln_ship < 0 && plane.pln_land < 0 &&
                !(plane.pln_flags & PLN_LAUNCHED))
                planeno = n;
            else
@@ -741,6 +742,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
            if (n < 0)
                continue;
            if (getland(n, &land) && land.lnd_own &&
+               land.lnd_ship < 0 && land.lnd_land < 0 &&
                land.lnd_x == target->sct_x && land.lnd_y == target->sct_y)
                unitno = n;
            else
index 567381e8bda29002c62ec885dcc87c535d31d619..13a35f5c6848c6f729e3828c3e50e41a3939f5d9 100644 (file)
@@ -178,6 +178,8 @@ planesatxy(coord x, coord y, int wantflags, int nowantflags)
     while (nxtitem(&ni, &plane)) {
        if (plane.pln_effic < PLANE_MINEFF || plane.pln_own == 0)
            continue;
+       if (plane.pln_ship >= 0 || plane.pln_land >= 0)
+           continue;
        if (plane.pln_flags & PLN_LAUNCHED)
            continue;
        plp = &plchr[(int)plane.pln_type];