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

Extremely low (x1/128) track build/remove cost severely restricts the track conversion feature. #7633

Closed
James103 opened this issue Jul 1, 2019 · 3 comments

Comments

@James103
Copy link
Contributor

@James103 James103 commented Jul 1, 2019

Version of OpenTTD

OpenTTD 20190603-master

Expected result

You should be able to universally convert track no matter what the costs are for building track.

Actual result

When you use BaseCosts 5.0 newGRF to set the "build track" cost multiplier and "remove track" cost multiplier to x1/128, track conversion is no longer universal: Instead, you can convert (electrified) rail to monorail or maglev, and you can convert from monorail to maglev and vice versa. That's it. You can't convert from monorail/maglev to normal railway, nor can you (de)electrify railways.

I think reducing the build track and remove track costs to x1/128 causes some combinations to return 0 as the cost, which the game treats as being invalid, and so those conversions return "No suitable railway track" and are therefore prohibited.

Steps to reproduce

  1. Load BaseCosts 5.0 newGRF and set the "build track" cost multiplier and "remove track" cost multiplier to x1/128.
  2. Build one piece each of Rail, Electrified Rail, Monorail, and Maglev.
  3. Attempt to convert the rail types. The results (from my testing) look like this:
  • Normal Rail: can convert to Maglev/Monorail only
  • Electric Rail: can convert to Maglev/Monorail only
  • Monorail: can convert to Maglev only
  • Maglev: can convert to Monorail only
  • Unable to downgrade Monorail/Maglev to Railway
  • Unable to (de-)electrify railways
@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 1, 2019

It looks like the problem would be the cost becoming 0 rather than -1.

return (cost.GetCost() == 0) ? error : cost;

The solution will likely have to be tracking a separate error flag throughout the function.

@James103
Copy link
Contributor Author

@James103 James103 commented Jul 6, 2019

Does the same problem with zero-cost conversion failing occur with road and tramway? If so, could you fix those as well (same/similar method to #7634, tracking separate "found_convertible_road" and "found_convertible_tramway" flags in addition to "found_convertible_track")?

@nielsmh
Copy link
Contributor

@nielsmh nielsmh commented Jul 6, 2019

I can't reproduce it with RattRoads at least, I haven't tried with tram tracks though. (This is without the patch in #7634.) Still might be worth making the same change to road building.

nielsmh added a commit to nielsmh/OpenTTD that referenced this issue Jul 6, 2019
@nielsmh nielsmh closed this in #7634 Jul 6, 2019
nielsmh added a commit that referenced this issue Jul 6, 2019
douiwby added a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
spnda added a commit to spnda/OpenTTD that referenced this issue Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.