Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#
Home

[Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: Raahul Kumar <raahul_da_man@xxxxxxxxx>, Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Feb 2002 20:12:06 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Feb 20, 2002 at 04:09:42PM +0100, Petr Baudis wrote:
> Typo fixed in attached patch.

>  /*************************************************************************
> -This looks at tiles neighbouring the unit to find something to kill or
> -explore. It prefers tiles in the following order:
> +This function looks at tiles directly neighbouring the unit in order to find
> +something to kill or explore.  It prefers tiles in the following order:
> +
>  1. Undefended cities
>  2. Huts
>  3. Enemy units weaker than the unit
>  4. Land barbarians also like unfrastructure tiles (for later pillage)
> -If none of the following is there, nothing is chosen.
>  
> -work of Syela - mostly to fix the ZOC/goto strangeness

> +If none of the following is there, nothing is chosen.

How can the caller distinguish this? What does the function return?

> -  if (get_transporter_capacity(punit)) {
> -    unit_list_iterate(map_get_tile(x, y)->units, aunit)
> -      if (!is_sailing_unit(aunit)) return(0);
> -    unit_list_iterate_end;
> -  } /* ferryboats do not attack.  no. -- Syela */
> +  

> +  /* Ferryboats with passengers do not attack. -- Syela */
> +  if (punit->ai.passenger > 0) {
> +    return 0;
> +  }

Are you sure that these are equivalent?

> +          benefit = (benefit + 40) * punit->hp / unit_type(punit)->hp;

What is that 40?

> +        SET_BEST(99999);
...
> +      if (map_has_special(x1, y1, S_HUT) && best < 99999
> +          && could_unit_move_to_tile(punit, punit->x, punit->y, x1, y1) != 0
> +          && !is_barbarian(unit_owner(punit))
> +          && punit->ai.ai_role != AIUNIT_ESCORT
> +          && punit->ai.charge == 0 /* Above line doesn't seem to work. :( */
> +          && punit->ai.ai_role != AIUNIT_DEFEND_HOME) {
> +        SET_BEST(99998);
> +      }

These 9999* are ugly.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 Q:  Do you know what the death rate around here is?
 A:  One per person.


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