Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: (PR#4326) Pathfinding
Home

[Freeciv-Dev] Re: (PR#4326) Pathfinding

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4326) Pathfinding
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sun, 1 Jun 2003 11:54:27 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Sat, 31 May 2003, ChrisK@xxxxxxxx wrote:

> Here is another Pathfinding deficiency.
> 
> Try to send the cruiser NW of Cagayan de Oro to Fukuoka. PF chooses a route
> through the occupied enemy city, and stops the execution at once:
> "aborted GOTO as there are units in the way."

The attached patch fixes it.

Will be committed soonish.

G.


Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.50
diff -u -r1.50 goto.c
--- client/goto.c       2003/05/28 14:48:38     1.50
+++ client/goto.c       2003/06/01 18:50:59
@@ -322,8 +322,15 @@
 static enum tile_behavior get_TB(int x, int y, enum known_type known,
                                 struct pf_parameter *param)
 {
+  struct tile *ptile = map_get_tile(x, y);
+
   if (known == TILE_UNKNOWN) {
     return TB_IGNORE;
+  }
+  if (is_non_allied_unit_tile(ptile, param->owner)
+      || is_non_allied_city_tile(ptile, param->owner)) {
+    /* Can attack but can't count on going through */
+    return TB_DONT_LEAVE;
   }
   return TB_NORMAL;
 }

[Prev in Thread] Current Thread [Next in Thread]