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>, Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] aiunit.c ai_military_findvictim() cleanup (PR#1264) [aiunit.c-1.38]
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Feb 2002 19:11:47 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Feb 22, 2002 at 06:32:48PM +0100, Petr Baudis wrote:
> > > +          && !is_barbarian(unit_owner(punit))
> > > +          && punit->ai.ai_role != AIUNIT_ESCORT
> > 
> > > +          && punit->ai.charge == 0 /* Above line doesn't seem to work. 
> > > :( */
> > 
> > Please explain.
> 
> That was Syela! :) Sorry, but I fear I can't explain it well yet. It's 
> possible
> that we're not consistent in keeping those two values in sync; not really an
> idea.

Mhh.

> +This function looks at tiles directly neighbouring the unit in order to find

s/tiles directly neighbouring/tiles adjacent to/

> +something to kill or explore.  It prefers tiles in the following order:
>  
> -work of Syela - mostly to fix the ZOC/goto strangeness
> +Returns value of the victim which has been chosen:
> +
> +99999   means empty (undefended) city
> +99998   means hut

> +sane number means value of enemy unit weaker than our unit

Sane is relative: s/sane number/number from (1..99998)/

> +1       means barbarians wanting to pillage
> +0       means nothing found or error
> +-2*MORT*TRADE_WEIGHTING means nothing found and punit causing unhappiness

> +If nothing is chosen, (dest_x, dest_y) is set to actual punit's position.

s/If nothing is chosen/If a value <=0 is returned/
Is <=0 correct here?

> +  int units_stack = unit_list_size(&(map_get_tile(punit->x, 
> punit->y)->units));

Either rename to stack_size or create a "bool more_than_one_unit_here = ...".

> +    best = 0 - 2 * MORT * TRADE_WEIGHTING;

s/0 //

> +          benefit = (benefit + unit_value(get_role_unit(F_CITIES, 0)))
> +                    * punit->hp / unit_type(punit)->hp;

Could be replaced by

> +          benefit += unit_value(get_role_unit(F_CITIES, 0));
> +          benefit = (benefig * punit->hp) / unit_type(punit)->hp;

Plus the SET_BEST change.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "These download files are in Microsoft Word 6.0 format. After
  unzipping, these files can be viewed in any text editor, including
  all versions of Microsoft Word, WordPad, and Microsoft Word Viewer."
    -- http://www.microsoft.com/hwdev/pc99.htm


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