Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2006:
[Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allie
Home

[Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allie

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chadaeschliman@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allies)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Feb 2006 20:49:29 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [guest - Thu Feb 09 04:36:49 2006]:
> 
> Here is a patch to common/aicore/pf_tools.c which provides a partial fix
> to goto for bombers.  During it's first turn after refueling the bomber
> can go to any point on the map which is within it's single turn range or
> it can goto any allied city or airbase which is within it's two turn
> range.  During it's second turn it can only goto an allied city or
airbase.

Your patch is slightly broken...attached is a patch that I think does
what you're trying to do: allows a goto into a seemingly unsafe tile so
long as a unit has enough moves to return.

There are two problems with it.  The first, rather trivial one, is that
since it uses real_map_distance instead of the actual distance traveled,
you could get stranded if your path took you around obstacles but you
didn't have enough fuel to return around them.

The second, and insurmountable, one is that dangerous positions simply
cannot be used in this way.  Consider a case with a bomber where we have
a city, another city 18 moves away, and a city halfway in between (say,
10 moves from each).  The correct path, of course, takes the bomber to
the halfway point and on, for a travel time of 4 turns.  Your patch will
not find a path at all (because AFAICT your patch is buggy).  In my
patch a direct path will be found and the bomber will crash.  The
problem is that marking a dangerous position as not dangerous has global
consequences.  In this case our bomber tries to use it as a refueling
point on the way to the far city, and so crashes.

The correct fix needs to come inside the PF code itself, where dangerous
positions are handled.  We should allow gotos to dangerous positions, so
long as the unit has at least half of its MP remaining at the end of the
goto (well...sort of).  This would have the effect of fixing not only
air but also trireme gotos.

-jason




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