Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [RFC] Caching AI values
Home

[Freeciv-Dev] Re: [RFC] Caching AI values

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Cc: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>, "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC] Caching AI values
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Apr 2002 18:01:27 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Apr 04, 2002 at 09:36:07AM -0600, Mike Kaufman wrote:
> On Thu, Apr 04, 2002 at 11:58:39AM +0100, Gregory Berkolaiko wrote:
> > On Wed, 3 Apr 2002, Raimar Falke wrote:
> > 
> > > On Sat, Mar 23, 2002 at 03:09:07PM +0000, Gregory Berkolaiko wrote:
> > > > 
> > > > But first a couple of examples:
> > > > ======================================================================
> > > 
> > > > Cached value: list of all own refuelling points of the type FUEL_CITY
> > > > (basically the list of all cities)
> > > 
> > > IMHO the speed improvement for this is very small if only cities are
> > > included. The problem are the airbases. To get these you have to
> > > iterate over the whole map. What about a global airbase list? 
> > > Mantained by set_special and clear_special.
> > 
> > Yes, this is very good idea.
> > Still if you have 10 bombers and you consider them one-by-one, it make 
> > sense to build the list only once.
> 
> no, this isn't a good idea (checking for airports in set/clear_special that
> is). We should maintain the list where we create and/or destroy airports,
> otherwise we have to do an airport check the billion other times we use
> set_special.

So you are against a:

void map_set_special(int x, int y, enum tile_special_type spe)
{
  MAP_TILE(x, y)->special |= spe;

  if (contains_special(spe, S_ROAD) || contains_special(spe, S_RAILROAD)) {
    reset_move_costs(x, y);
  }
+  if (contains_special(spe, S_AIRBASE))
+    add it to the list
}

??

You are for (in update_unit_activity):
  if (activity==ACTIVITY_AIRBASE) {
    if (total_activity (punit->x, punit->y, ACTIVITY_AIRBASE)
        >= map_build_airbase_time(punit->x, punit->y)) {
      map_set_special(punit->x, punit->y, S_AIRBASE);
      unit_activity_done = TRUE;
+     add to list
    }
  }

> Besides, don't we have to have a list for each player?

You can't own specials.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  reality.sys corrupt. Reboot Universe? (y,n,q)


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