Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] Re: (PR#10557) unit with orders being taken over by the AI
Home

[Freeciv-Dev] Re: (PR#10557) unit with orders being taken over by the AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#10557) unit with orders being taken over by the AI
From: "brett wexell" <bwexell@xxxxxxxxx>
Date: Wed, 20 Oct 2004 17:33:51 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10557 >

Thanks.  I tried to go back to the saved game, but I
must have deleted it over the weekend.   

I should have saved it off and sent it to you.


--- Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:

> 
> <URL:
> http://rt.freeciv.org/Ticket/Display.html?id=10557 >
> 
> - Build yourself a trireme and a settlers.
> - Put the settlers in the trireme.
> - Put the trireme on a longish goto.
> - Aitoggle yourself.
> - Hit turn done a few times.
> - The server crashes (with the backtrace from
> earlier in the ticket).
> 
> This patch should fix it.  It looks to me like if
> you get an allied AI
> unit inside your transporter that AI unit could take
> over the
> transporter, but when I tried to reproduce this I
> got PR#10652 instead.
>  In any case this patch should fix that too.
> 
> jason
> 
> > ? diff
> Index: ai/aiferry.c
>
===================================================================
> RCS file: /home/freeciv/CVS/freeciv/ai/aiferry.c,v
> retrieving revision 1.7
> diff -u -r1.7 aiferry.c
> --- ai/aiferry.c      20 Oct 2004 18:20:53 -0000      1.7
> +++ ai/aiferry.c      20 Oct 2004 22:14:10 -0000
> @@ -270,7 +270,16 @@
> 
>
****************************************************************************/
>  static bool is_boat_free(struct unit *boat, struct
> unit *punit, int cap)
>  {
> +  /* - Only ground-unit transporters are consider.
> +   * - Units with orders are skipped (the AI
> doesn't control units with
> +   *   orders).
> +   * - Only boats that we own are eligible.
> +   * - Only available boats or boats that are
> already dedicated to this unit
> +   *   are eligible.
> +   * - Only boats with enough remaining capacity
> are eligible.
> +   */
>    return (is_ground_units_transport(boat)
> +       && !unit_has_orders(boat)
>         && boat->owner == punit->owner
>         && (boat->ai.passenger == FERRY_AVAILABLE
>             || boat->ai.passenger == punit->id)
> @@ -468,8 +477,7 @@
>      struct unit *ferryboat =
> find_unit_by_id(punit->transported_by);
>  
>      /* Check if we are the passenger-in-charge */
> -    if (ferryboat->ai.passenger <= 0
> -        || ferryboat->ai.passenger == punit->id) {
> +    if (is_boat_free(ferryboat, punit, 0)) {
>        struct tile *beach_tile;     /* Destination
> for the boat */
>        struct unit *bodyguard =
> find_unit_by_id(punit->ai.bodyguard);
>  
> 



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com




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