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

Cargo flow legend does not get redrawn in additional area when zoomed out #7004

Closed
btzy opened this issue Dec 31, 2018 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@btzy
Copy link
Contributor

btzy commented Dec 31, 2018

Tested using the current source code on the master branch, with 64-bit Windows 10, compiled with Visual Studio 2017 with all the default options. This bug also exists in the official v1.8.0 binaries.

To reproduce:

  1. Download and open this save file:
    Flardinghead Transport, Feb 16th, 1975.zip
    There is a bus route: Runnbury <--> Flardinghead <--> Grudinghattan
  2. Enable the cargo flow legend overlay for passengers:
    cargoflowlegend-4
  3. Zoom in with the mouse wheel until you only see the edge between Runnbury and Flardinghead (but Flardinghead must be outside the viewport):
    cargoflowlegend-1
  4. Zoom out with the mouse wheel once, so that you can see Flardinghead station; observe that the edge from Flardinghead to Grudinghattan is not drawn:
    cargoflowlegend-2
  5. Wait for a while (around 5 seconds), and observe that the edge from Flardinghead to Grudinghattan appears:
    cargoflowlegend-3
  6. Repeat steps 3 and 4, then zoom out two notches in succession instead of one. Observe that the edge appears immediately after the second notch (so it is not due to some long-running algorithm).

Expected behaviour: Step 4 should draw the edge from Flardinghead to Grudinghattan immediately, instead of after around 5 seconds.

Sometimes, the edge is drawn immediately; in that case, just retry by going to step 3 and continuing from there. More often than not, the edge from Flardinghead to Grudinghattan will not be drawn.

@btzy
Copy link
Contributor Author

btzy commented Dec 31, 2018

It is probably because main_gui.cpp line 200 (calling ScrollWindowTo) is before main_gui.cpp line 202 (calling DoZoomInOutWindow). ScrollWindowTo calls RebuildViewportOverlay to recalculate whether stations and edges are within the visible viewport, but that is done before actually zooming out the window. So the zoom value used by the link graph recalculation is the old value.

btzy added a commit to btzy/OpenTTD that referenced this issue Dec 31, 2018
Previously, when the user zooms in or out, the linkgraph overlay was recalculated before the zoom.  This caused some stations and edges to be missing from the visible region of the viewport.
btzy added a commit to btzy/OpenTTD that referenced this issue Jan 1, 2019
Previously, when the user zooms in or out, the linkgraph overlay was recalculated before the zoom.  This caused some stations and edges to be missing from the visible region of the viewport.
Also used LINKGRAPH_DELAY when zooming, for consistency with scrolling and resizing.
@andythenorth andythenorth added needs triage This issue needs further investigation before it becomes actionable bug Something isn't working labels Jan 7, 2019
@LordAro LordAro removed the needs triage This issue needs further investigation before it becomes actionable label Jan 23, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue Feb 23, 2019
Previously the linkgraph was rebuilt before the viewport extents were finalized.
@PeterN PeterN closed this as completed in 87ebfe1 Feb 23, 2019
nielsmh pushed a commit to nielsmh/OpenTTD that referenced this issue Mar 11, 2019
…l. (OpenTTD#7265)

Previously the linkgraph was rebuilt before the viewport extents were finalized.
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
…l. (OpenTTD#7265)

Previously the linkgraph was rebuilt before the viewport extents were finalized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants