[freeciv-ai] Re: (PR#11995) Stupid AI Creates Tall Stacks
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11995 >
Jason Short wrote:
> * I'm pretty sure ai_air_goto is wrong. For air units it's not that no
> tiles are dangerous; rather EVERY tile (except those with airbases,
> empty carriers, or cities) is dangerous.
I thought the PF is_pos_dangerous function indicates that PF should not
allow a unit to end a turn on a tile, and that aircraft can end their
turns in mid air (true for the Bomber unit).
> I think your goto function
> will result in planes swiftly charging off to run out of fuel...
> Remember that PF has no
> handling of fuel yet. But maybe I don't understand this code and
> immediate_destination takes care of this.
> BTW what
> happens if no immediate destination is found? Does the (air) unit just
> keep on trying or does it stop and look for a new role?
I created the immediate_destination function by refactoring the warmap
goto code. If it is wrong in my code it might be wrong in the old warmap
> You can look at how this is done in client/goto.c
I didn't think to do so. I'll take a look.
> * I don't like how you replace calls of ai_unit_goto with a specific
> typed goto call (ai_air_goto, ai_ferry_goto, etc.). IMO it would be
> better to just have ai_unit_goto and have this function check the type
> of the unit and call one of the other functions.
> * I'm not sure of some of the code you add to pftools.c. pftools is
> used not just by the AI but also by human players. You should avoid
> adding ai-specific there *if possible*.
I think the amphibious-goto code could stay, but the risk-avoidance code
is really AI specific, so I'll move that to aiunit.[hc]
I will create a new version of the patch.