[Freeciv-Dev] Re: Waypoints for path-finding
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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.
Raimar
|
|