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

Vehicles are sometimes incorrectly shown as refittable #6155

Closed
DorpsGek opened this issue Oct 27, 2014 · 5 comments
Closed

Vehicles are sometimes incorrectly shown as refittable #6155

DorpsGek opened this issue Oct 27, 2014 · 5 comments
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

dandan opened the ticket and wrote:

Under certain circumstances, the purchase menu and refit GUI show vehicles to be 'refittable' even when they are not (see screenshot).

This happens when the vehicle is refittable to a single cargo only but the cargo subtype display callback (CB 19) is enabled via veh. prop. 1E. It seems that this triggers the 'refittable' string and enables the refit GUI without any further test whether a cargo subtype string is actually returned.

This problem becomes apparent in the SBB set, which has a GRF parameter that enables more refit options. When the parameter is switched off, some vehicles behave as described.

A minimal test grf is attached.

Attachments

Reported version: trunk
Operating system: All


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

peter1138 wrote:

While it is possible to execute the callback, this can result in the opposite problem: an engine not being flagged as refittable when actually it is.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6155#comment14397

@DorpsGek
Copy link
Member Author

frosch wrote:

Should "cb == CALLBACK_FAILED" fall through to the default_cargo condition?

I guess we can also add a Vehicle* parameter to IsEngineRefittable, which would be allowed to be NULL. I think there are other functions with similar behaviour.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6155#comment14398

@DorpsGek
Copy link
Member Author

peter1138 wrote:

Hmm, yeah, probably should fall through. Also as per the real callback, grf version should be checked.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6155#comment14399

@DorpsGek
Copy link
Member Author

peter1138 wrote:

This version reuses the existing function (although adding a Vehicle * parameter to something in engine.cpp feels wrong!), adds the fall-through, and also checks grf version.

Side affect is some vehicles (e.g. in DBSetXL) which were listed as refittable in the build engine list are no longer marked, but once built and connected in a depot should be fine.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6155#comment14400

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs bug labels Apr 7, 2018
@TrueBrain TrueBrain added patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay bug Something isn't working and removed bug from FlySpray labels Apr 13, 2018
@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@andythenorth
Copy link
Contributor

Thanks for this. There's been no activity on this for some time, and as it stands, it doesn't look likely that it will go any further. Since OpenTTD moved to GitHub, we use pull requests rather than patches, as they are a much more productive workflow.

I'm planning to close this soon (in 7 days), as we try to keep the issue count low for OpenTTD, it helps us focus on things that are important and fun.

If you would like to continue with this patch, the best way would be to move the patch to your own GitHub fork, update it for the current OpenTTD master, and then create a pull request. For more information, please see our CONTRIBUTING.md.

We are also happy to discuss directly on the issue, or in #openttd irc, including help to get this into a pull request. Thanks for your contribution!

^^ this much is just procedure (hi TrueBrain)

My £0.02: don't create newgrf vehicles that do this. Then the issue goes away. There is no need to enable CB19 if it's not going to be used.

@andythenorth andythenorth removed patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay stale Stale issues labels Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

3 participants