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

Don't complain that you cannot remove rail/road if it doesn't exist. #9034

wants to merge 1 commit into
base: master
Choose a base branch


Copy link

@Xaroth Xaroth commented Apr 12, 2021

Motivation / Problem

Currently, when you place a 10-piece length of rail on an existing 9-piece length of rail, you don't get an error, even though you told it to re-build 9 pieces of rail. If you do the opposite (9 pieces of rail over an existing 10-piece length of rail), you get an error. This is somewhat inconsistent, not to mention quite a nuisance while building.


For both the creation and removal of rail and road pieces, we no longer complain when the requested change is already done. This makes building a bit more idempotent, and hopefully a little bit less frustrating.


I'm not 100% how this affects AI scripts. Some AIscript guru might know more about this.

I also purposefully did not touch any of the water functions, as that is a can of worms I'm not confident in opening.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@Xaroth Xaroth force-pushed the dont-complain-removal branch from 51f8a97 to 79a1f75 Compare Apr 12, 2021
if (ret.Failed()) return ret;
if (ret.Failed()) {
if (ret.GetErrorMessage() != STR_ERROR_ALREADY_BUILT) return ret;
else {
Copy link

@glx22 glx22 Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless else and wrong style.

Copy link

@Kuhnovic Kuhnovic commented Oct 27, 2021

I would really like to see this go in. I think it's a pretty useless error message, and it's thrown very inconsistently. Also, since we abort on the first error message, it might also prevent more useful error messages from being displayed depending on the order of how certain "can we build here"-checks are performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants