Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [RFC] Move cost map interface
Home

[Freeciv-Dev] Re: [RFC] Move cost map interface

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC] Move cost map interface
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 13 Apr 2002 11:23:36 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Apr 12, 2002 at 01:56:46PM +0100, Gregory Berkolaiko wrote:
> On Thu, 11 Apr 2002, Ross W. Wetmore wrote:
> > Ditch any separate queue entry objects like in the current code.
> > Each costmap location should contain a next index used to chain
> > it into the (bucket) lists, and there is no need to store x,y
> > values as the indexed location gives this implicitly. You 
> > probably want a uchar_t from,dest; for iterating forwards and 
> > backwards through the final map, as well as ushort_t next; and 
> > int cost (or maybe struct cost to hold costfn specific extensions). 
> > This makes up your basic struct cost_tile where a vector of 
> > cost_tiles == a cost_map contains all the useful/necessary warmap 
> > generated data that you might want to save for reuse. (The rest of 
> > the warmap parameterization can be shared or reproduced as needed 
> > with little or no effort).
> 
> There is a great advantage I see in this approach:
> after you've computed the whole map, these links "next" and "prev" order 
> the locations in the "right" order, so you can make another iterate 
> without computing any new costs.

If I understand this in the correct way my goto_agent has this
feature:

+struct cell {
+  struct position pos;
+  int turns, points_left, railroad, steps;
+  struct cell *prev;
+  int dir_from_prev_to_pos;
+};

But this is an implementation thing and has nothing to do with the
interface.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The very concept of PNP is a lovely dream that simply does not translate to
  reality. The confusion of manually doing stuff is nothing compared to the
  confusion of computers trying to do stuff and getting it wrong, which they
  gleefully do with great enthusiasm." 
    -- Jinx Tigr in the SDM


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