Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: Changing interface for generate_warmap (PR#1108)
Home

[Freeciv-Dev] Re: Changing interface for generate_warmap (PR#1108)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Changing interface for generate_warmap (PR#1108)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Dec 2001 14:06:45 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Dec 14, 2001 at 12:00:57PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Thu, Dec 13, 2001 at 06:34:05PM +0000, Gregory Berkolaiko wrote:
> > >  --- Jason Short <vze2zq63@xxxxxxxxxxx> wrote: 
> > >> I don't understand what Raimar is saying.  Why will the current
> > >> interface Gregory has not be extensible?  Just pass in a local
> > >> warmap instead of NULL, and it'll use that variable instead.  Of
> > >> course, you'll have to initialize it separately - but that's
> > >> probably a good thing; 
> > 
> > >> if you have a warmap for each city you don't want to free and
> > >> re-malloc each time you generate a new one.
> > 
> > Good point.
> > 
> 
> So which interface should I be aiming for?
> 
> And do you think this patch is useful and will be accepted under certain
> conditions (if so, specify the conditions)?

For a transition time I think a parallel interface would be good. This
allows you to change one function at a time to use a local warmap and
also reduce the patch size.

struct move_cost_map *cost_map_create(struct city *pcity, struct unit *punit);
void cost_map_destory(struct move_cost_map *p);
int cost_map_sea_cost(struct move_cost_map *p, int x,int y);
int cost_map_land_cost(struct move_cost_map *p, int x,int y);

You can exchange "cost_map_" with something different. And if you use
"warmap" you have to explain what "warmap" means ;) The first patch
has to do the changes in gotohand.c (please don't introduce extra
cache rules, in the long run we want to avoid the global warmap). And
than a series of patches which each centered around a
generate_warmap() call. Something like this.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Many of my assistants were fans of Tolkien, who wrote 'Lord of the Rings'
  and a number of other children's stories for adults.  The first character
  alphabet that was programmed for my plotter was Elvish rather than Latin."
    -- from SAIs "life as a computer for a quarter of a century"


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