]> git.pond.sub.org Git - empserver/commitdiff
Use relations_with() in owned_and_navigable()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 30 Jan 2011 17:32:19 +0000 (18:32 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 18 Feb 2011 17:44:49 +0000 (18:44 +0100)
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

index bb42ad61eec58804d07e10b6acc28ef8ed4d1d3c..efc0d6f3b97c2560ea9ce4f0c269fda7dd6bfa00 100644 (file)
@@ -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, &sect);
-    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: