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: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: Petr Baudis <pasky@xxxxxxxxxxx>, 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: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Feb 2002 15:38:05 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

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.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Of course, someone who knows more about this will correct me if I'm
  wrong, and someone who knows less will correct me if I'm right."
    -- David Palmer (palmer@xxxxxxxxxxxxxxxxxx)


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