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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Xaroth
Copy link
Contributor

@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.

Description

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.

Limitations

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')

src/rail_cmd.cpp Outdated Show resolved Hide resolved
@Kuhnovic
Copy link
Contributor

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.

@2TallTyler 2TallTyler added size: trivial This Pull Request is trivial work: minor details This Pull Request has some minor details left to do labels Oct 23, 2022
@2TallTyler
Copy link
Member

2TallTyler commented Nov 7, 2022

@Xaroth Are you willing to update this with the one requested change? I tried to fix it for you but you unchecked the "maintainers can make changes" box. Then I'd like to approve it. 🙂

@Xaroth
Copy link
Contributor Author

Xaroth commented Nov 7, 2022

@Xaroth Are you willing to update this with the one requested change? I tried to fix it for you but you unchecked the "maintainers can make changes" box. Then I'd like to approve it. 🙂

The checkbox is enabled on my end, I never disabled it.
image

@2TallTyler
Copy link
Member

Maybe I just don't know how to use GitHub. I haven't been a maintainer for long and this was my first time trying that tool. 😛

In any case, if you can quickly make that fix I'll approve this. 😄

@Xaroth Xaroth force-pushed the dont-complain-removal branch 3 times, most recently from e43ba55 to 8e461a2 Compare November 7, 2022 21:18
Copy link
Member

@2TallTyler 2TallTyler left a comment

Choose a reason for hiding this comment

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

I'm in favor of suppressing useless messages. Code is fine as far as I can tell. Whoever merges this should confirm that it won't mess up AIs. 🙂

@PeterN
Copy link
Member

PeterN commented Nov 8, 2022

Can you please squash your fix commit into the first commit.

And the 'rule' I've heard is don't update non-English translations, as the translation system will handle that.

This could potentially break AIs if they expect certain responses, but I'm not about to check if any actually are...

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

Agreed - eints does the string deletion itself, don't do it in PR

And yes, the AI impact is definitely something that needs considering. I imagine it would have no practical effect, but it's definitely a change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: trivial This Pull Request is trivial work: minor details This Pull Request has some minor details left to do
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants