[Freeciv-Dev] Re: [Patch] Missed firepower in aiunit.c
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx> wrote:
> A small fix to a small bug.
>
> Friendly advice: don't read the description, look at the patch, it's
> shorter.
>
Looks good. While you're at it, see you if you can all the various 10's and
30's lying around.
> =========== Description ===========
>
> In ai_military_gothere (aiunit.c:1082) d_val is computed as sum of
> actual units' attack ratings (aka belligerence) -- by calling
> stack_attack_value -- and attack rating for hypothetical unit is added
> in "if". The latter attack rating does not take into account firepower
> and it should. The computation is converted to use the standard
> you_couldnt_possibly_invent_an_uglier_and_longer_name belligerence
> functions.
> Also, a numerical constant is substituted by an already existing define.
>
> =========== Files affected ========
>
> ai/aiunit.c
>
> =========== Behaviour change ======
>
> yes, but it was wrong before
> > ? auto.rc
> ? saves
> Index: ai/aiunit.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/ai/aiunit.c,v
> retrieving revision 1.183
> diff -u -r1.183 aiunit.c
> --- ai/aiunit.c 2002/03/01 14:07:28 1.183
> +++ ai/aiunit.c 2002/03/02 19:05:05
> @@ -1097,13 +1097,14 @@
> if (!(dest_x == x && dest_y == y)) {
>
> /* do we require protection? */
> - d_val = stack_attack_value(dest_x, dest_y) * 30;
> + d_val = stack_attack_value(dest_x, dest_y);
> if ((dcity = map_get_city(dest_x, dest_y))) {
> d_type = ai_choose_defender_versus(dcity, punit->type);
> - d_val += base_get_attack_power(d_type,
> - do_make_unit_veteran(dcity, d_type),
> - SINGLE_MOVE) * unit_types[d_type].hp;
> + d_val +=
> + base_unit_belligerence_primitive(d_type, do_make_unit_veteran(dcity,
> d_type),
> + SINGLE_MOVE, unit_types[d_type].hp);
> }
> + d_val *= POWER_DIVIDER;
> d_val /= (unit_type(punit)->move_rate / SINGLE_MOVE);
> if (unit_flag(punit, F_IGTER)) d_val /= 1.5;
> freelog(LOG_DEBUG,
>
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - sign up for Fantasy Baseball
http://sports.yahoo.com
|
|