Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken FollowTrack_t functions #1801

Closed
DorpsGek opened this issue Feb 24, 2008 · 1 comment
Closed

Fix broken FollowTrack_t functions #1801

DorpsGek opened this issue Feb 24, 2008 · 1 comment
Labels
component: pathfinder This issue is related to Pathfinder flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

michi_cc opened the ticket and wrote:

FollowTrackRail() and its siblings from yapf.h are currently not usable, depending on compiler version, moon phase or whatever. This is currently not a problem as trunk doesn't use this functions at the moment.

The problem is that the user of these functions has to provide a FollowTrack_t structure, which is then cast to a CFollowTrackT structure derived from FollowTrack_t. But CFollowTrackT has one additional member over FollowTrack_t, so depending on how the compiler generates code, an access to that member can overwrite memory. (Seen with MSVC2005 using debug runtime with full stack checking.)

I've extracted this solution to the problem from YAPP. It is more radical than just moving the offending member to the base structure, but this way is more elegant code-wise as it removes the need to use different functions for each transport type and for with or without 90 degree turns. Using CFollowTrackT directly would still have the problem that at least an if statement for 90 degree turns is neccessary.

Attachments

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/1801
@DorpsGek
Copy link
Member Author

KUDr closed the ticket.

Reason for closing: Fixed

in r12252: Broken FollowTrack_t related functions (thanks michi_cc).
-Fixed by removing FollowTrack_t structure and all related functions. Their purpose was to allow to call track followers from C code. They were:

  1. never used
  2. obsoleted by switching to C++

This comment was imported from FlySpray: https://bugs.openttd.org/task/1801

@DorpsGek DorpsGek added component: pathfinder This issue is related to Pathfinder flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pathfinder This issue is related to Pathfinder flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant