Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277
Home

[Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch: make ai understand peace and alliances (PR#1277)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sun, 24 Feb 2002 21:37:12 +0100

Dear diary, on Sun, Feb 24, 2002 at 08:19:04PM CET, I got a letter,
where "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> told me, that...
> diff -u3NrX freeciv/diff_ignore freeciv/ai-old/advmilitary.c 
> freeciv/ai/advmilitary.c
> --- freeciv/ai-old/advmilitary.c      Sat Feb 23 14:19:06 2002
> +++ freeciv/ai/advmilitary.c  Sun Feb 24 19:37:06 2002
> @@ -223,7 +223,7 @@
>      assess_danger(pcity);
>    city_list_iterate_end;
>  }
> -       
> +
>  /********************************************************************** 
>  ...
>  ***********************************************************************/

oh dear..

> @@ -262,7 +262,7 @@
>    unit_list_iterate_end;
>  
>    players_iterate(aplayer) {
> -    if (aplayer != city_owner(pcity)) {
> +    if (pplayers_at_war(city_owner(pcity),aplayer)) {

thou shalt always make space after ','

>        boatspeed = (get_invention(aplayer, game.rtech.nav)
>                  == TECH_KNOWN ? 12 : 6);
>        boatid = find_boat(aplayer, &x, &y, 0);
> diff -u3NrX freeciv/diff_ignore freeciv/ai-old/aiunit.c freeciv/ai/aiunit.c
> --- freeciv/ai-old/aiunit.c   Sun Feb 24 01:00:21 2002
> +++ freeciv/ai/aiunit.c       Sun Feb 24 19:38:18 2002
> @@ -1396,8 +1396,7 @@
>  
>  /* this is horrible, but I need to do something like this somewhere. -- 
> Syela */
>    players_iterate(aplayer) {
> -    if (aplayer == pplayer) continue;
> -    /* AI will try to conquer only enemy cities. -- Nb */
> +    if (!pplayers_at_war(pplayer,aplayer)) continue;
>      city_list_iterate(aplayer->cities, acity)
>        city_reinforcements_cost_and_value(acity, punit);
>        acity->ai.invasion = 0;

Why did you remove the comment? It's still true. (I would move it above the if,
though)

> @@ -1657,20 +1656,27 @@
>    return(best);
>  }
>  
> +/*************************************************************************
> +  ...
> +**************************************************************************/

What about inserting some rant there?

> @@ -1755,7 +1761,7 @@
>  }
>  
>  /*************************************************************************
> -...
> +  TODO: teach AI about trade routes with friendly players

Please make a sentence from this. Also, I'm used to usually sign my TODOs.

>  **************************************************************************/
>  static void ai_manage_caravan(struct player *pplayer, struct unit *punit)
>  {
> @@ -2301,7 +2306,9 @@
>      handicap = ai_handicap(pplayer, H_TARGETS);
>      for( i = 0; i < game.nplayers; i++) {
>        aplayer = &game.players[i];
> -      if (aplayer == pplayer) continue;
> +      /* ignore cities we are at peace with, assumes that there is
> +         no need to establish embassy by the time we have peace */
> +      if (!pplayers_at_war(pplayer, aplayer)) continue;
>        /* sneaky way of avoiding foul diplomat capture  -AJS */
>        has_emb=player_has_embassy(pplayer, aplayer) || pdiplomat->foul;
>        city_list_iterate(aplayer->cities, acity)

I certainly do NOT like this. This assumption is bad. Please remove it.

Except for that and the other (minor) objections, I like the patch.

-- 

                                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]