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

Fix #7635: Game crash on exit scenario editor. #7652

Merged
merged 1 commit into from Oct 7, 2019

Conversation

stormcone
Copy link
Contributor

I think the GM_NORMAL is the only game mode when the station building widgets are available.

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure this is good, but I wonder if it's complete - there are a lot of other references to != GM_EDITOR (in road_gui.cpp) that probably should be == GM_NORMAL instead
(this is the correct solution - see road_gui.cpp:722 for where the toolbar is created)

@stormcone
Copy link
Contributor Author

I think most of them could be == GM_NORMAL. The question is whether we want to narrow the possible game modes from != GM_EDITOR to == GM_NORMAL.

The actual problem here is that the _game_mode is set to GM_MENU before the windows are destroyed:

OpenTTD/src/openttd.cpp

Lines 322 to 329 in 425cd3e

static void LoadIntroGame(bool load_newgrfs = true)
{
_game_mode = GM_MENU;
if (load_newgrfs) ResetGRFConfig(false);
/* Setup main window */
ResetWindowSystem();

I checked the ResetGRFConfig and the ResetWindowSystem functions (and those they call) and I think it would be safe to put the _game_mode = GM_MENU; after the ResetWindowSystem();, because those functions do not depend on the game mode. So that could be an alternative solution.

@LordAro LordAro requested a review from PeterN August 3, 2019 08:30
Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been open way too long, this will do perfectly fine.

@LordAro LordAro merged commit 1e50295 into OpenTTD:master Oct 7, 2019
@stormcone stormcone deleted the fix-7635 branch October 8, 2019 19:57
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

Successfully merging this pull request may close these issues.

None yet

2 participants