Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: Waypoints for path-finding
Home

[Freeciv-Dev] Re: Waypoints for path-finding

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raimar Falke <rf13@xxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Waypoints for path-finding
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Tue, 1 Apr 2003 14:03:32 +0100 (BST)

On Tue, 1 Apr 2003, Raimar Falke wrote:

> On Tue, Apr 01, 2003 at 01:05:30PM +0100, Gregory Berkolaiko wrote:
> > > > How do you plan to change it and at which stage you would call the 
> > > > function
> > > >  struct pf_path *pft_get_path(const struct pf_parameter *const 
> > > > parameter,
> > > >                               int end_x, int end_y,
> > > >                               int num_waypoints,
> > > >                               struct map_position *waypoints);
> > > 
> > > The simplest solution: some code remembers the waypoints (like the
> > > current code does) and every time the mouse moves the above new
> > > function is called.
> > 
> > *sigh* I wish you thought before writing this.
> > 
> > After k-th waypoint is specified, the paths
> >     waypoint[0] -> waypoint[1] -> ... -> waypoint[k]
> > are all fixed.  There is no need to recompute them. All user is interested 
> > in is the path 
> >     waypoint[k] -> mouse_location,
> > which can be obtained by calling
> >     parameter.x = waypoint[k].x
> >     parameter.y = waypoint[k].y
> >     /* The rest of parameter remains the same */
> >     map = pf_create_map(parameter)
> >     path = pf_get_path(map, mouse.x, mouse.y)
> >     draw_segment(path)
> 
> Yes but this way the client code needs to assembles all parts if this path
> is sent to the server. And I think this should be done by some pf(t) code.

Assembling segments is one thing, recalculating several segments when only 
one is changed is another.

Will
        pft_extend_path(path, new_segment) 
be enough?

G.



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