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

Facades for ship pathfinders #1843

Closed
DorpsGek opened this issue Mar 10, 2008 · 2 comments
Closed

Facades for ship pathfinders #1843

DorpsGek opened this issue Mar 10, 2008 · 2 comments
Labels
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

Noldo opened the ticket and wrote:

Why??
Wouldn't it be nice if all the pathfinders for specific vehicle type has a clean interface?

Added:
-abstract class ShipPf that is the interface common to all ship pathfinders.
-derived classes for each current ship pathfinder.
-files pathfinder_front.{h|cpp}

Moved:
-this and that from ship_cmd.cpp to pathfinder_front.cpp to make the original ChooseShipTrack look the way it looks.

Collateral Damage / Nice Bonus:
OPF/NPF code got removed from ship_cmd.cpp

Problems:
-Some of the static variables and functions that were needed in the pathfinder_front.cpp were also needed in non-related
contexts elsewhere in ship_cmd.cpp so I left those in ship_cmd.cpp too which is ugly code and data duplication and needs a solution.
-Also the Depot finding function is duplicated in ShipPf_Yapf and ShipPf_Opf, deriving one from the other would solve that,
but maybe there's some better solution.

Development ideas:
-The switch/case construct could propably be replaced with some kind of array-like thing that is indexed with the patch setting.

Attachments

Reported version: trunk
Operating system: All


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

SmatZ wrote:

I see a lot of "new", but no "delete".
(generally, I don't think this is a good idea... or maybe it IS a good idea, but done wrong)


This comment was imported from FlySpray: https://bugs.openttd.org/task/1843#comment3648

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 5, 2010

Rubidium closed the ticket.

Reason for closing: Implemented

Although differently and without classes


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

@DorpsGek DorpsGek closed this as completed Jan 5, 2010
@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles 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
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