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

Pressing a station name in the station list doesn't move you to the correct station #9337

Closed
LC-Zorg opened this issue Jun 4, 2021 · 5 comments

Comments

@LC-Zorg
Copy link

LC-Zorg commented Jun 4, 2021

Version of OpenTTD

1.11.2 (new bug)

Expected result

Pressing a station name in the station list takes you to the correct station

Actual result

Pressing a station name in the station list will move you to another station lower in the list. The bug appeared after increasing the spacing between lines of text (1.11.2). It looks as though the spacing between the lines of the text is not the same as the spacing between the button fields.

Example

Pressing Station 5 will take you to Station 7 or 8
Station list bug

Steps to reproduce

Open the save below in game versions 1.11.1 and 1.11.2
Station list BUG, 2020-05-22.zip

Comments

(Perhaps noteworthy, perhaps not)
Overall, the spacing between lines of text seem unnecessarily so large. With a large number of stations, this may make it a bit difficult to browse the list. Perhaps it would be worthwhile to reduce the height of the colored cargo field?

Below are some alternatives.
Stations list - alternative version
v1 - Height of the colored cargo field reduced to a minimum
v2 - Vertical, wider transport rating bar moved to the side
v3 - Color cargo field height decreased by 5 pixels, transport rating bar increased by 1

I'm not sure if it is better. I did it out of curiosity whether something more readable could be done on this scale. :) A certain advantage of v1 and v2 may be the preservation of the original spacing between lines of the text, and thus also the consistent appearance of the interface. In that case, it might be possible in the future to add a general spacing setting that would affect all GUI elements.

@glx22
Copy link
Contributor

glx22 commented Jun 10, 2021

I tried to reproduce this issue, but I couldn't. Everything I tested works as expected.

@ldpl
Copy link
Contributor

ldpl commented Jun 10, 2021

I had someone reporting this issue for citymania client (supposedly) as well: https://citymania.org/forum/topic/125
But didn't have any luck reproducing it either :(

@ldpl
Copy link
Contributor

ldpl commented Jun 10, 2021

Ah, nvm, I can repro it now, posssibly something to do with font size.
Guess I'll make the patch then.

@ldpl
Copy link
Contributor

ldpl commented Jun 10, 2021

Actually, in master this was already fixed by #9073 (or may be it even predates the bug) so it's just a question of backporting now.

Anyhow, 1.11.2 can be fixed by changing in station_gui.cpp

uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_STL_LIST, 0, FONT_HEIGHT);

to

uint line_height = this->GetWidget<NWidgetBase>(widget)->resize_y;
uint id_v = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_STL_LIST, 0, line_height);

@LordAro LordAro added backport requested This PR should be backport to current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Jul 17, 2021
@LordAro
Copy link
Member

LordAro commented Jul 17, 2021

Closed, already fixed. Thanks @ldpl ! (I've added the backport label, but a new 1.11 release is unlikely)

@LordAro LordAro closed this as completed Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants