Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] Re: (PR#13539) Fix AI tile effect miscalculation
Home

[Freeciv-Dev] Re: (PR#13539) Fix AI tile effect miscalculation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13539) Fix AI tile effect miscalculation
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Jul 2005 14:06:36 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13539 >

Per I. Mathisen wrote:

>  /****************************************************************************
> +  Recalculate the base output (all types) of all workers and specialists in
> +  the city.  The output[] array is completely cleared in the process.  This
> +  does not account for output transformations (like trade->(sci,gold,lux))
> +  or city bonuses (pcity->bonus[]).
> +****************************************************************************/
> +void get_citizen_output_uncached(const struct city *pcity, int *output)
> +{
> +  bool celebrating = base_city_celebrating(pcity);
> +
> +  memset(output, 0, O_COUNT * sizeof(*output));
> +  city_map_checked_iterate(pcity->tile, x, y, ptile) {
> +    if (pcity->city_map[x][y] == C_TILE_WORKER) {
> +      output_type_iterate(o) {
> +        output[o] += base_city_get_output_tile(x, y, pcity, celebrating, o);
> +      } output_type_iterate_end;
> +    }
> +  } city_map_checked_iterate_end;
> +  add_specialist_output(pcity, output);
> +}

Adding this new function isn't the right solution.  The right solution
is to find the actual cause of the problem.  One suspect I have is the
recent change that set tile output to 0 for unknown tiles (required for
the client; even before the terrain-pointer change this caused a buffer
underrun).  Since the AI has no incentive to explore and autoexplorers
generally don't explore your citymap areas this may cause settlers to be
undervalued.

-jason





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