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: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: Petr Baudis <pasky@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 17:03:51 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Feb 22, 2002 at 03:36:10PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Fri, Feb 22, 2002 at 03:46:06PM +0100, Petr Baudis wrote:
> > > Dear diary, on Fri, Feb 22, 2002 at 03:38:05PM CET, I got a letter,
> > > where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > > > 
> [...]
> > > > 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 :^).
> > 
> > Which one?
> 
> Basically we agree that this unhappiness setting in not used at all.
> 
> However boolean value will not be sufficient.  You need at least three:
> NOTHING_TO_KILL
> SOMETHING_GOOD
> SOMETHING_SO_GOOD_EVEN_A_BODYGUARD_CANT_RESIST_IT

Ok.

> Then all of them would be used, fx in
> 
> 1631       ai_military_findvictim(pplayer, punit, &dest_x, &dest_y);  
> 1632       if (dest_x == punit->x && dest_y == punit->y) {
> 1633 /* no one to bash here.  Will try to move onward */
> 
> this idiotic if (dest....) would be replaced by a better one
> if (ai_mil_fv(...) == NOTHING_TO_KILL)

Ok.

> I would suggest commiting Petr's patch as a cleanup patch asap and
> then making an upgrade patch with fixing typos and making sense of
> return values.

I will take a look at the latest version.

        Raimar

P.S.: 

      ai_military_findvictim(pplayer, punit, &dest_x, &dest_y);
      if (dest_x == punit->x && dest_y == punit->y) {
/* no one to bash here.  Will try to move onward */
        find_something_to_kill(pplayer, punit, &dest_x, &dest_y);
        if (same_pos(punit->x, punit->y, dest_x, dest_y)) {

Do you see the problem here? .... 

(dest_x == punit->x && dest_y == punit->y) vs 
 (same_pos(punit->x, punit->y, dest_x, dest_y))

This is a long way to go.

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  One nuclear bomb can ruin your whole day.


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