Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [IAMBACK] [PATCH] [1.3] cleanup of proccess_*_want() (
Home

[Freeciv-Dev] Re: [IAMBACK] [PATCH] [1.3] cleanup of proccess_*_want() (

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [IAMBACK] [PATCH] [1.3] cleanup of proccess_*_want() (PR#1295)
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Sat, 6 Apr 2002 13:36:37 +0200

Dear diary, on Sat, Apr 06, 2002 at 01:04:33PM CEST, I got a letter,
where Raahul Kumar <raahul_da_man@xxxxxxxxx> told me, that...
> > +        /* We first need to develop a tech required by the unit... */
> > +
> > +        /* Cost (shield equivalent) of gaining these techs. */
> > +        /* FIXME? Katvrr advises that this should be weighted more heavily 
> > in
> > +         * big danger. */
> > +        int tech_cost = total_bulbs_required_for_goal(pplayer,
> > +                          unit_types[unit_type].tech_requirement) / 4
> > +                        / city_list_size(&pplayer->cities);
> > +
> 
> This was great. I like the use of tech_cost. A big improvement in legibility.

/me bows

> > -static void process_attacker_want(struct player *pplayer,
> > -                       struct city *pcity, int b, Unit_Type_id n,
> > -                            bool vet, int x, int y, bool unhap, int *e0, 
> > int
> > *v,
> > -                            int bx, int by, int boatspeed, int needferry)
> <snip>
> > +static void process_attacker_want(struct player *pplayer, struct city
> > *pcity,
> > +                                  int value, Unit_Type_id victim_unit_type,
> > +                                  bool veteran, int x, int y, bool unhap,
> > +                                  int *best_value, int *best_choice,
> > +                                  int boatx, int boaty, int boatspeed,
> > +                                  int needferry)
> > +{ 
> 
> You really like long parameter lists don't you? I'm not sure this is an
> improvement on the original. It's absurdly long. I'll help you out by telling
> you how to get rid of boatspeed. In the short run, you can use
> unit_move_rate(punit) for a quick fix. In the long run, you can look at my
> patches for f_s_t_k and how I use unit_move_turns to fix the problem.

Out of scope of this patch. There's already a TODO.

> > +      
> > +      want = military_amortize(desire, MAX(1, move_time),
> > +                               bcost_balanced + needferry);
> > +
> 
> Much better want equation. I'd want this patch to go into CVS for this reason
> alone.

:^)

-- 
 
                                Petr "Pasky" Baudis
 
* ELinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
Teamwork is essential -- it allows you to blame someone else.
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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