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: rf13@xxxxxxxxxxxxxxxxxxxxxx, 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: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Thu, 21 Feb 2002 17:05:32 +0000 (GMT)

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> 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?

I guess it should be something like CITY_CAPTURE_BONUS


> > +        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.

well, at least it's functional and clear

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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