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: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Waypoints for path-finding
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Tue, 1 Apr 2003 12:51:40 +0200

On Tue, Apr 01, 2003 at 11:27:19AM +0100, Gregory Berkolaiko wrote:
> On Mon, 31 Mar 2003, Raimar Falke wrote:
> 
> > On Mon, Mar 31, 2003 at 06:26:16PM +0100, Gregory Berkolaiko wrote:
> > > On Mon, 31 Mar 2003, Raimar Falke wrote:
> > > 
> > > > I want to convert the client goto (remove client/goto.c). It was
> > > > decided that I should preserve the waypoints-feature. So we have to
> > > > add waypoint support to the path finding. Suggested interface:
> > > > 
> > > > 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);
> > > > 
> > > > Reasons: a naive implementation creates a new map for every part
> > > > (start-1st waypoint, 1st-2nd,...) and assembles the paths together at
> > > > the end. I think this may be done without internal knowledge and so
> > > > can be placed in pft.
> > > 
> > > Mmm, now that a little bird told me that I am expected to write this 
> > > function, I started looking for excuses and found them!
> > > 
> > > This function will be no use in client because of how the waypoints work 
> > > now (and it's certainly nice and should stay this way):  you add 
> > > waypoints 
> > > "dynamically", the map is recalculated each time you hit "g" and then the 
> > > little white path is displayed from the position of your last waypoint to 
> > > where your mouse is.
> > > 
> > > Try it, you'll see.
> > 
> > I know and I want to preserve the current behavior. I don't see the
> > connections.
> 
> This is how the current behaviour functions:
> 1. user hits "g"
> 2. goto map from the unit position is generated
> 3. user moves mouse, the goto line from the unit position to the mouse 
>    location is drawn
> 4. user hits "g" (to add a waypoint)
> 5. goto map from the waypoint position is generated
> 6. user moves mouse, the goto line from the waypoint position to the mouse 
>    location is drawn
> 7. loop to 4
> 
> For details see insert_waypoint and around.
> 
> 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.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  The Software is not designed or licensed for use in on-line control
  equipment in hazardous environments, such as operation of nuclear
  facilities, aircraft navigation or control, or direct life support
  machines. 
    -- Java Compiler Compiler Download and License Agreement



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