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

Game crash on exit scenario editor when you build or demolish infrastructure #7635

Closed
James103 opened this issue Jul 2, 2019 · 2 comments
Closed
Milestone

Comments

@James103
Copy link
Contributor

James103 commented Jul 2, 2019

Version of OpenTTD

20190603-master-g846fc8fe09

Expected result

No crash on exit scenario editor

Actual result

Game crash on exit scenario editor after doing any of the following*.
Here is the crash log.

Steps to reproduce

  1. Load scenario editor.
  2. Do any of the following*.
  3. Exit scenario editor.
  4. Game crash

*Commands that crash the game (step 2)

  • Building some road (1 piece is enough)
  • Clearing some land (1 tile is enough).
  • Building some canals or rivers (1 tile is enough).
  • Building a bridge (road or aqueduct, 2 tiles are enough)
  • Possibly more that haven't been tested yet.
  • Edit: Leaving the road or dock toolbar open (by @stormcone)

Commands that don't crash the game

  • Terraforming/landscaping.
  • Doing nothing.
  • Planting some trees.
  • Building some towns and/or industries.
  • Placing rocky land.
  • Resetting the landscape (removing company-owned property).
  • Configuring AI/GS.
  • Possibly more that haven't been tested yet.
@stormcone
Copy link
Contributor

I can confirm this, but it's easier to reproduce.

  • Just go to the scenario editor
  • Open the road or the dock toolbar
  • Go to the main menu without closing the toolbar
  • Crash

The problem is in the following lines:

if (_game_mode != GM_EDITOR && this->IsWidgetLowered(WID_DT_STATION)) SetViewportCatchmentStation(nullptr, true);

if (_game_mode != GM_EDITOR && (this->IsWidgetLowered(WID_ROT_BUS_STATION) || this->IsWidgetLowered(WID_ROT_TRUCK_STATION))) SetViewportCatchmentStation(nullptr, true);

Because when you exit from the scenario editor mode, the _game_mode's value is changed to GM_MENU before the above mentioned lines are called. So the _game_mode != GM_EDITOR condition fails, but it should not. This bug has the same root cause as the one which was fixed with #7551, when you tried to close the toolbars in the scenario editor mode.

JGRennison added a commit to JGRennison/OpenTTD-patches that referenced this issue Jul 11, 2019
stormcone added a commit to stormcone/OpenTTD that referenced this issue Jul 12, 2019
@nielsmh nielsmh added this to the 1.10.0 milestone Sep 1, 2019
@James103
Copy link
Contributor Author

James103 commented Oct 3, 2019

Can reproduce on master-20191002, with no crash log (due to #7758). It just says "OpenTTD has stopped working".

@LordAro LordAro closed this as completed in 1e50295 Oct 7, 2019
douiwby pushed a commit to douiwby/OpenTTD that referenced this issue Apr 16, 2020
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

3 participants