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

Private railways aren't being given all options for track lays when only plain track exists in their home hexes #7

Closed
ollybh opened this issue Oct 15, 2022 · 2 comments
Assignees
Labels
1858 Affects the 1858 implementation bug Something isn't working

Comments

@ollybh
Copy link
Owner

ollybh commented Oct 15, 2022

If B&CR's first build is a straight plain piece of track (tile 9) in hex F15, then it should be able to build in G16. But it is only being given options to build in its other two home hexes, D15 and E14. The code for calculating available builds is probably confused because there are no revenue centres to trace a route from.

@ollybh
Copy link
Owner Author

ollybh commented Nov 17, 2022

Engine::Graph compute does a couple of things when home_as_token is set.

  1. Each home hex is added to the hexes array.
  2. Each town or city in a home hex is added to the nodes array.

The node walk starts from the items in the nodes array, so if there is plain track in one of the home hexes then this will not somewhere that is considered.

A plain track tile doesn't have anything that inherits from Engine::Part::Node. Need to think of a way to add this hex to the walk list.

@ollybh ollybh added the bug Something isn't working label Nov 21, 2022
@ollybh
Copy link
Owner Author

ollybh commented Nov 25, 2022

Fixed in commit c5285d4.

@ollybh ollybh closed this as completed Nov 25, 2022
ollybh added a commit that referenced this issue Dec 3, 2022
If a plain track tile was built in a private company's home hex, then
the graph computed did not follow this track, unless it was connected to
a town or city. See issue #7.

This commit creates a new node class to represent these plain track
paths. These are added to the node list in the graph and they are then
included in the walk list.

This might not be safe if this code was being used for evaluating train
routes, but this will only ever be considered for track lays by private
companies, or checking connections between private and major companies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1858 Affects the 1858 implementation bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant