]> git.pond.sub.org Git - empserver/commitdiff
Don't let POGO (#0) navigate and march ghosts
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 16 Jul 2011 11:06:17 +0000 (13:06 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 16 Jul 2011 11:47:48 +0000 (13:47 +0200)
POGO can navigate dead ships, and march dead land units.  The ghosts
even get sighted and interdicted, and can hit mines (landmines only
until commit fe372539, v4.3.27).  Noted for ships in commit 9100af0b.
Has always been broken.  Fix by making shp_sel() and lnd_sel()
explicitly reject ghosts.

Same code pattern also exists in pln_sel, but dead plains fail the
efficiency test, so it's harmless there.  Apply the same fix anyway.

src/lib/subs/lndsub.c
src/lib/subs/plnsub.c
src/lib/subs/shpsub.c

index b3483b79bf5f2222ad2286ff3567623f75d04c97..30630a708c0e6945647fcab12439e2ba0680a0b5 100644 (file)
@@ -412,7 +412,7 @@ lnd_sel(struct nstr_item *ni, struct emp_qelem *list)
         * but much of the code assumes that only the land unit's
         * owner can march it.
         */
         * but much of the code assumes that only the land unit's
         * owner can march it.
         */
-       if (land.lnd_own != player->cnum)
+       if (!land.lnd_own || land.lnd_own != player->cnum)
            continue;
        if (opt_MARKET) {
            if (ontradingblock(EF_LAND, &land)) {
            continue;
        if (opt_MARKET) {
            if (ontradingblock(EF_LAND, &land)) {
index c0e0816eeca84de3508837e929debc4638902f09..a167f636f0bf4677baaf0bdb9811a89584ca190f 100644 (file)
@@ -538,7 +538,7 @@ pln_sel(struct nstr_item *ni, struct emp_qelem *list, struct sctstr *ap,
         * much of the code assumes that only the plane's owner can
         * fly it.
         */
         * much of the code assumes that only the plane's owner can
         * fly it.
         */
-       if (plane.pln_own != player->cnum)
+       if (!plane.pln_own || plane.pln_own != player->cnum)
            continue;
        if (plane.pln_mobil <= 0)
            continue;
            continue;
        if (plane.pln_mobil <= 0)
            continue;
index 05d2112d09b024a8c0e0674cc968ae10f3bb7d0b..3a45c72545e1e6dae9f51cf350b8da5cc3b86e3f 100644 (file)
@@ -70,7 +70,7 @@ shp_sel(struct nstr_item *ni, struct emp_qelem *list)
         * much of the code assumes that only the ship's owner can
         * navigate it.
         */
         * much of the code assumes that only the ship's owner can
         * navigate it.
         */
-       if (ship.shp_own != player->cnum)
+       if (!ship.shp_own || ship.shp_own != player->cnum)
            continue;
        mcp = &mchr[(int)ship.shp_type];
        if (opt_MARKET) {
            continue;
        mcp = &mchr[(int)ship.shp_type];
        if (opt_MARKET) {