<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40570 >

> [EMAIL PROTECTED] - Thu Nov 20 21:19:18 2008]:
> 
> In the attached game the only Columbian unit - if set to auto 
> explore - tries to violate the peace treaty.

Thanks for the savegame. I have confirmed that making the
unit auto-explore causes it to stop immediately because
of the potential treaty violation, even though there are
other tiles it could explore instead.

> The attached patch now handles cities (especially allied
> cities where the allies didn't trade maps/map access)
> correctly.

I did some more investigating in the code and it would seem
that there is a much simpler way to fix the problem. The
attached patch makes a one line addition to the tile
behaviour parameter function no_fights() to make it ignore
tiles that are part of a territory the player cannot enter
by treaty. As far as I can tell, this makes auto-explore
work exactly the same as your patch. I will test it some
more (as I hope you and others will too) to see if there
are not any bad side-effects in the AI code, since no_fights
is used for more than just exploring.


-----------------------------------------------------------------------
確かにそんなやり方で解決できるが。
diff --git a/common/aicore/pf_tools.c b/common/aicore/pf_tools.c
index 17a095c..218306e 100644
--- a/common/aicore/pf_tools.c
+++ b/common/aicore/pf_tools.c
@@ -463,6 +463,7 @@ enum tile_behavior no_fights(const struct tile *ptile, enum known_type known,
 			     struct pf_parameter *param)
 {
   if (is_non_allied_unit_tile(ptile, param->owner)
+      || players_non_invade(tile_owner(ptile), param->owner)
       || is_non_allied_city_tile(ptile, param->owner)) {
     /* Can't attack */
     return TB_IGNORE;
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to