]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/bestpath.c
License upgrade to GPL version 3 or later
[empserver] / src / lib / common / bestpath.c
index 41b0e83086e4accfdfb105f251880dd6acee819e..3907d5392b483d4de930b4df005e99ff021bca3e 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
  *  ---
  *
  *  bestpath.c: Find the best path between sectors
- * 
+ *
  *  Known contributors to this file:
  *     Steve McClure, 1998-2000
  *     Markus Armbruster, 2006
  */
 
-/* 
+/*
  * IMPORTANT: These routines are very selectively used in the server.
  *
  * "bestownedpath" is only used to determine paths for ships and planes.
- * 
+ *
  * Callers should not be calling these directly anymore. They should use
  * the "BestShipPath", "BestAirPath", "BestLandPath" and "BestDistPath"
  * functions.  Note that those last two use the A* algorithms to find
@@ -125,7 +124,6 @@ bestownedpath(char *bpath, char *bigmap,
 
     routelen = 0;              /* path length is now 0 */
     mapindex[x][y] = 0;                /* mark starting spot   */
-    markedsectors = 1;         /* source sector marked */
     minx = x - 2;              /* set X scan bounds    */
     maxx = x + 2;
     miny = y - 1;              /* set Y scan bounds    */
@@ -202,8 +200,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: