-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
[NO SQUASH] (cherry pick) Don't call GameSession::restart_level in the constructor #3115
base: master
Are you sure you want to change the base?
[NO SQUASH] (cherry pick) Don't call GameSession::restart_level in the constructor #3115
Conversation
This stops testing/the title screen (yes, the title screen) from reparsing the level by simply changing the usage pattern of the TitleScreen. (Cherry picked from swagtoy/supertux:editor2)
wait hold on there's a regression where you can control Tux from the title screen |
Okay, seems to work! Later i'll actually end up probably creating an |
Seems good now. I did test some things and it doesn't crash and burn. Any final words? |
|
} | ||
screen->restart_level(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put a try/catch here so the game doesn't crash if level loading fails. You can then put the pop_screen()
there in catch
instead.
@@ -354,10 +354,13 @@ WorldMapSector::update(float dt_sec) | |||
Vector shrinkpos = Vector(level_->get_pos().x + 16 - m_camera->get_offset().x, | |||
level_->get_pos().y + 8 - m_camera->get_offset().y); | |||
std::string levelfile = m_parent.m_levels_path + level_->get_level_filename(); | |||
|
|||
auto gamesession = std::make_unique<GameSession>(levelfile, m_parent.m_savegame, &level_->get_statistics()); | |||
gamesession->restart_level(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put a try/catch here so the game doesn't crash if level loading fails. You can then put the pop_screen()
there in catch
instead.
This stops testing (on the "Test from here")/the title screen (yes, the title screen) from reparsing the level by simply changing the usage pattern of the GameSession constructor.
Cherry picked from commit swagtoy@0d25b71 upon the request of Vankata.