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.
This commit is contained in:
Markus Armbruster 2011-01-30 18:32:19 +01:00
parent 5245cde582
commit 9100af0b82

View file

@ -201,8 +201,7 @@ owned_and_navigable(char *bigmap, int x, int y, int own)
/* Owned or allied sector? Check the real sector. */ /* Owned or allied sector? Check the real sector. */
getsect(x, y, &sect); getsect(x, y, &sect);
if (sect.sct_own == own if (sect.sct_own && relations_with(sect.sct_own, own) == ALLIED) {
|| (sect.sct_own && getrel(getnatp(sect.sct_own), own) == ALLIED)) {
/* FIXME duplicates shp_check_nav() logic */ /* FIXME duplicates shp_check_nav() logic */
switch (dchr[sect.sct_type].d_nav) { switch (dchr[sect.sct_type].d_nav) {
case NAVOK: case NAVOK: