Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [PATCH] [aiunit.c-1.42] ai_military_findvictim() clean
Home

[Freeciv-Dev] Re: [PATCH] [aiunit.c-1.42] ai_military_findvictim() clean

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: Raahul Kumar <raahul_da_man@xxxxxxxxx>, Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] [aiunit.c-1.42] ai_military_findvictim() cleanup (PR#1264)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 22 Feb 2002 20:53:54 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Feb 22, 2002 at 08:37:12PM +0100, Petr Baudis wrote:
> +  int stack_size = unit_list_size(&(map_get_tile(punit->x, 
> punit->y)->units));

IMHO this should really be converted to a "bool only_unit_at_tile" or similar.

> +  if (punit->unhappiness > 0) {
> +    /* When we're causing unhappiness, we'll set best even lower, so that we
> +     * will take even targets which we would ignore otherwise (in other 
> words -
> +     * we're going to commit a suicide). */
> +    best = - 2 * MORT * TRADE_WEIGHTING;
> +  }

> +  /* Ferryboats with passengers do not attack. -- Syela */
> +  if (punit->ai.passenger > 0) {
> +    return 0;
> +  }

These two blocks can be reordered for speed.

> +        /* We're only dealing with adjacent victims here. */
> +        int move_cost = 0;

> +                    / (attack + vuln) - move_cost * SHIELD_WEIGHTING);

Can be removed.

> +          /* No need to amortize! */

Can you explain this?

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  +#if defined(__alpha__) && defined(CONFIG_PCI)
  +       /*
  +        * The meaning of life, the universe, and everything. Plus
  +        * this makes the year come out right.
  +        */
  +       year -= 42;
  +#endif
    -- Patch for 1.3.2 (kernel/time.c) from Marcus Meissner


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