FollowTrack distance output?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
Celestar
Director
Director
Posts: 574
Joined: 02 Jul 2004 10:56
Contact:

FollowTrack distance output?

Post by Celestar »

Is there any way telling FollowTrack to spit out the actual distance? Somehow the only response is '1' I get :(

Celestar
matthijs
Engineer
Engineer
Posts: 76
Joined: 25 Jun 2004 15:20
Location: Enschede, Netherlands
Contact:

Post by matthijs »

I think that the enumproc you give to FollowTrack should save the best length found, in the void* data for example. At least, IIRC this is how it works for train pathfinding. Does this help?
User avatar
tmesisbob
Engineer
Engineer
Posts: 79
Joined: 26 Mar 2004 19:17

Post by tmesisbob »

rdf.maxtracklen will give you the best distance (by road) to the tile which is within rdf.mindist tiles of the destination.

So if the algorithm reaches the destination then rdf.mindist is 0 and rdf.maxtracklen will tell you how many road tiles have to be followed to get there.

These variables can be examined after the call to the inital FollowTrack.

I hope this makes sence :?
User avatar
Celestar
Director
Director
Posts: 574
Joined: 02 Jul 2004 10:56
Contact:

Post by Celestar »

Somehow I ALWAYS get a distance of "1" as result, unless it finds no route.

Celestar
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 15 guests