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

Autoreplace window isn't updated after group hierarchy changes #5978

Closed
DorpsGek opened this issue Apr 11, 2014 · 7 comments
Closed

Autoreplace window isn't updated after group hierarchy changes #5978

DorpsGek opened this issue Apr 11, 2014 · 7 comments
Labels
bug Something isn't working flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

juanjo opened the ticket and wrote:

The autoreplace window lists are not updated after making a group hierarchy change.

Group 1: Has no maglevs.
Group 2: Has maglevs.

Open autoreplace window for G1. It doesn't list maglevs.
Add G2 as a subgroup of G1. Autoreplace window for G1 should list maglevs, but it doesn't.

Showing diesel engines and then going back to maglev ones makes window up-to-date.

Maybe group hierarchy code should call InvalidateAutoreplaceWindow somewhere.

Reported version: trunk
Operating system: All


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

juanjo wrote:

Title should be "Autoreplace window isn't updated after group hierarchy changes."


This comment was imported from FlySpray: https://bugs.openttd.org/task/5978#comment13228

@DorpsGek
Copy link
Member Author

alex6 wrote:

I was not able to reproduce the problem following the steps.
Do you have a savegame ?


This comment was imported from FlySpray: https://bugs.openttd.org/task/5978#comment13577

@DorpsGek
Copy link
Member Author

juanjo wrote:

Here is a savegame (r27037) and some images.
It happens if you open a replacement window for vehicles of GROUP 1.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5978#comment13578

@DorpsGek
Copy link
Member Author

3298 wrote:

It was indeed a simple fix, a call to GroupStatistics::UpdateAutoreplace was missing. While I was testing I also found two other equally small issues between autoreplace and groups: the group window doesn't refresh when starting or stopping a replacement (i.e. the autoreplace icon didn't (dis-)appear when it should, but after another redraw trigger like selecting a group it did), and in addition the color of the autoreplace icon in the group window doesn't accurately reflect the status of autoreplace when the only remaining vehicles to replace are in subgroups (it is drawn like when the autoreplace has finished, even though that is not yet true).
The attached patch fixes all three issues. The first two hunks refresh the group window when starting/stopping autoreplace; the third hunk fixes the issue with incorrect display of autoreplace's "finished" status; and the fourth hunk is the fix for the original issue, refreshing the autoreplace window on group hierarchy changes.
I aggregated them into a single patch because they are closely related, tiny, and easy to separate if needed.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5978#comment14645

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) 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
@frosch123 frosch123 removed the Core label Apr 14, 2018
@andythenorth andythenorth added the stale Stale issues label Jan 5, 2019
@andythenorth
Copy link
Contributor

@J0anJosep is this one yours? :)

@J0anJosep
Copy link
Contributor

I didn't wrote the patch, just created the ticket on FS. I'll check it. In case 3298 doesn't create a PR soon, I'll do it and credit him if I find the patch to be correct.

@LordAro LordAro removed the stale Stale issues label Jan 12, 2019
J0anJosep added a commit to J0anJosep/OpenTTD that referenced this issue Jan 12, 2019
J0anJosep added a commit to J0anJosep/OpenTTD that referenced this issue Jan 12, 2019
@andythenorth
Copy link
Contributor

Thanks for doing that @J0anJosep

3298 can't use GitHub for ethical reasons, so won't be creating any PRs. See https://www.tt-forums.net/viewtopic.php?f=33&t=83025

nielsmh pushed a commit to nielsmh/OpenTTD that referenced this issue Mar 11, 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 flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

6 participants