From 9100af0b82227fb3d5f5c07743567142f857dd94 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 30 Jan 2011 18:32:19 +0100 Subject: [PATCH] Use relations_with() in owned_and_navigable() This removes a special case for POGO (#0). Before, unoccupied sectors were treated as "own or allied" for POGO, but not for other deities. Impact on callers: * BestAirPath() is not affected, because the change is only reachable with a non-null bigmap argument. * sorde() and nav_ship() pass a non-zero ship owner. sorde() ensures that itself, and prod_ship() does it for nav_ship(). * unit_path() passes the player number when called with a ship argument, i.e. in the navigate command. Player number is zero for POGO. Since deities can't navigate foreign ships, this can happen only when POGO navigates dead ships. Yes, that's possible, needs fixing. * getpath() passes the player number (zero for POGO) when called with argument P_SAILING, i.e. by the sail command. Thus, the change makes navigate's and sail's path finding work for POGO exactly like it does for other deities. That's fine. --- src/lib/common/bestpath.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/common/bestpath.c b/src/lib/common/bestpath.c index bb42ad61e..efc0d6f3b 100644 --- a/src/lib/common/bestpath.c +++ b/src/lib/common/bestpath.c @@ -201,8 +201,7 @@ owned_and_navigable(char *bigmap, int x, int y, int own) /* Owned or allied sector? Check the real sector. */ getsect(x, y, §); - if (sect.sct_own == own - || (sect.sct_own && getrel(getnatp(sect.sct_own), own) == ALLIED)) { + if (sect.sct_own && relations_with(sect.sct_own, own) == ALLIED) { /* FIXME duplicates shp_check_nav() logic */ switch (dchr[sect.sct_type].d_nav) { case NAVOK: -- 2.43.0