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

[Freeciv-Dev] Re: [PATCH] [aiunit.c-1.40] ai_military_findvictim() clean

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
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-1.40] ai_military_findvictim() cleanup (PR#1264)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Fri, 22 Feb 2002 19:20:43 +0100

Dear diary, on Fri, Feb 22, 2002 at 07:11:47PM CET, I got a letter,
where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > +This function looks at tiles directly neighbouring the unit in order to 
> > find
> 
> s/tiles directly neighbouring/tiles adjacent to/

Done.

> > +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)/

Ok.

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

Yes.

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

Yes sir.

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

Done.

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

Ok (didn't reproduce exactly ;).

Improved patch attached.

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
No one can feel as helpless as the owner of a sick goldfish.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/

Attachment: findvictim-cleanup.patch
Description: Text document


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