You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two issues with the grid lines not showing up when they should.
First issue
To reproduce the first issue, do one of:
Place a shop while auto-open is enabled.
or
Open the construction window for any shop or ride, including flat rides, excluding prebuilt coasters, then, without placing anything, do one of:
Press the Escape key.
Open the scenery or footpath placement window.
Open the construction window for anything else.
Many more. Basically: activate another tool.
Now, the gridlines will not be shown and will never show up again until the game is reloaded.
Note that enabling gridlines in the config still overwrites this.
The cause for this issue is in RideConstruction.cpp L613 and L627, which leads to hide_gridlines() being called twice, which in turn sets Viewport->gShowGridLinesRefCount to a negative value. gShowGridLinesRefCount is a number (and not a boolean) because apparently when activating another tool, first the new tool is activated, then the old tool is deactivated. So, in the scenarios above, the counter goes from 0 to 1 to 2, and then back to 0 (because hide is called twice), while the second tool is still active. When the second tool is deactivated, the counter goes down to -1.
Second issue
The second issue is maybe more of a problem of the plugin API, but I believe that they are connected. If a custom tool is activated, its onStart method is called before the current tool is cancelled.
Open the scenery window or a construction window so that grid lines are shown.
Activate a custom tool with the plugin API, where, in the onStart method, the gridlines flag is set.
The expected result should be, that the first tool is deactivated first, then the onStart method is called and sets the gridlines flag. In reality, it happens the other way around and the flag is overwritten in the hide_gridlines() method.
Common problem and possible solution
While these two issues could be fixed in different, independent ways, I think that they both have the same core problem:
The second tool is activated before the first tool is deactivated.
If this is fixed, the second issue is solved immediately, while the first issue could then be fixed by substituting gShowGridLinesRefCount with a boolean.
June 2023 Update
The current state of this issue seems to be the following:
Option Gridlines on Landscape disabled:
Open tool such that gridlines show (construction windows, see above).
There are two issues with the grid lines not showing up when they should.
First issue
To reproduce the first issue, do one of:
or
Now, the gridlines will not be shown and will never show up again until the game is reloaded.
Note that enabling gridlines in the config still overwrites this.
The cause for this issue is in
RideConstruction.cpp
L613 and L627, which leads tohide_gridlines()
being called twice, which in turn setsViewport->gShowGridLinesRefCount
to a negative value.gShowGridLinesRefCount
is a number (and not a boolean) because apparently when activating another tool, first the new tool is activated, then the old tool is deactivated. So, in the scenarios above, the counter goes from 0 to 1 to 2, and then back to 0 (because hide is called twice), while the second tool is still active. When the second tool is deactivated, the counter goes down to -1.Second issue
The second issue is maybe more of a problem of the plugin API, but I believe that they are connected. If a custom tool is activated, its
onStart
method is called before the current tool is cancelled.onStart
method, the gridlines flag is set.The expected result should be, that the first tool is deactivated first, then the
onStart
method is called and sets the gridlines flag. In reality, it happens the other way around and the flag is overwritten in thehide_gridlines()
method.Common problem and possible solution
While these two issues could be fixed in different, independent ways, I think that they both have the same core problem:
The second tool is activated before the first tool is deactivated.
If this is fixed, the second issue is solved immediately, while the first issue could then be fixed by substituting
gShowGridLinesRefCount
with a boolean.June 2023 Update
The current state of this issue seems to be the following:
Option
Gridlines on Landscape
disabled:Expected: Gridlines stay visible.
Observed: Gridlines disappear.
Option
Gridlines on Landscape
enabled:ui.mainViewport.visibilityFlags ^= (1 << 7)
Expected: Gridlines stay visible.
Observed: Gridlines disappear.
Option
Gridlines on Landscape
enabled:Gridlines on Landscape
.Expected: Gridlines stay visible.
Observed: Gridlines disappear.
Note: In all cases, gridlines do not break, they still appear if you switch to any other tool that activates them.
The text was updated successfully, but these errors were encountered: