Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: [PATCH] use enum values for ai_choice at aicity.c (PR#
Home

[Freeciv-Dev] Re: [PATCH] use enum values for ai_choice at aicity.c (PR#

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Markus Linnala <maage@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] use enum values for ai_choice at aicity.c (PR#1313)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Mon, 11 Mar 2002 10:58:19 +0100

Dear diary, on Sun, Mar 10, 2002 at 05:21:04PM CET, I got a letter,
where Markus Linnala <maage@xxxxxxxxx> told me, that...
> 
> Use enum values instead of plain ints.
> 
> diff -ur -X freeciv/diff_ignore freeciv/ai/aicity.c 
> freeciv-ct-none/ai/aicity.c
> --- freeciv/ai/aicity.c       Fri Mar  8 19:06:18 2002
> +++ freeciv-ct-none/ai/aicity.c       Sun Mar 10 18:17:37 2002
> @@ -424,14 +424,14 @@
>        buycost = city_buy_cost(pcity);
>        if (pcity->shield_stock == 0) {
>       /* nothing */
> -      } else if (bestchoice.type == 0 && is_wonder(bestchoice.choice) &&
> +      } else if (bestchoice.type == CT_NONE && is_wonder(bestchoice.choice) 
> &&
>                 buycost >= 200) {
>       /* wait for more vans */
> -      } else if (bestchoice.type != 0 && unit_type_flag(bestchoice.choice, 
> F_CITIES) &&
> +      } else if (bestchoice.type != CT_NONE && 
> unit_type_flag(bestchoice.choice, F_CITIES) &&
>            !city_got_effect(pcity, B_GRANARY) && (pcity->size < 2 ||
>           pcity->food_stock < city_granary_size(pcity->size-1))) {
>       /* nothing */
> -      } else if (bestchoice.type != 0 && bestchoice.type < 3 && /* not a 
> defender */
> +      } else if (bestchoice.type != CT_NONE && bestchoice.type != 
> CT_DEFENDER &&
>          buycost > unit_types[bestchoice.choice].build_cost * 2) { /* too 
> expensive */
>          if (unit_type_flag(bestchoice.choice, F_CARAVAN) &&
>              pplayer->ai.maxbuycost < 100) pplayer->ai.maxbuycost = 100;

I like this.

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
"If you have acquired knowledge, what do you lack?
    If you lack knowledge, what have you acquired?"
Lev. R. 1:6
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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