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
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)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Fri, 22 Feb 2002 15:46:06 +0100

Dear diary, on Fri, Feb 22, 2002 at 03:38:05PM CET, I got a letter,
where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> On Fri, Feb 22, 2002 at 02:59:29AM -0800, Raahul Kumar wrote:
> > 
> > > +If none of the following is there, nothing is chosen and dest_x, dest_y 
> > > is
> > > set
> > > +to actual punit's position.
> > > +
> > > +Returns value of the victim which has been chosen:
> > > +
> > > +99999   means empty city
> > > +99998   means hut
> > > +sane number means ordinar value of the victim
> > > +1       means barbarians wanting to pillage
> > > +0       means nothing found or error
> > > +- 2 * MORT * TRADE_WEIGHTING means nothing found and punit causing
> > > unhappiness
> 
> And now lets look at the usage of the return values of
> ai_military_findvictim:
> 
> ./ai/aiunit.c:1289:      ai_military_findvictim(pplayer, punit, &dest_x, 
> &dest_y);
> ./ai/aiunit.c:1631:      ai_military_findvictim(pplayer, punit, &dest_x, 
> &dest_y);
> 
> Two times discarded.
> 
> ./ai/aiunit.c:868:    i = ai_military_findvictim(pplayer, punit, &x, &y);
> 
>     i = ai_military_findvictim(pplayer, punit, &x, &y);
>     freelog(LOG_DEBUG,
>             "Stationary escort @(%d,%d) received %d best @(%d,%d)",
>             punit->x, punit->y, i, x, y);
>     if (i >= 40 * SHIELD_WEIGHTING)
>       handle_unit_move_request(punit, x, y, FALSE, FALSE);
> /* otherwise don't bother, but free cities are free cities and must be 
> snarfed. -- Syela */
> 
> [ SHIELD_WEIGHTING is currently 17 ]
> 
> So it looks to me that a boolean value would be enough. At least this
> "- 2 * MORT * TRADE_WEIGHTING" thing can be removed.

Please see my another mail :^).

-- 

                                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/


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