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

(cherry pick) Don't call GameSession::restart_level in the constructor #3115

Merged

Conversation

swagtoy
Copy link
Contributor

@swagtoy swagtoy commented Nov 29, 2024

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.

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)
@swagtoy
Copy link
Contributor Author

swagtoy commented Nov 29, 2024

wait hold on there's a regression where you can control Tux from the title screen

@swagtoy
Copy link
Contributor Author

swagtoy commented Nov 29, 2024

Okay, seems to work!

Later i'll actually end up probably creating an start_game() function, but this will unfortunately be part of the Level editor PR for now as I just don't have the time to cherry pick stuff and fix it only to stub my foot later.

@swagtoy swagtoy changed the title (cherry pick) Don't call GameSession::restart_level in the constructor [no squash] (cherry pick) Don't call GameSession::restart_level in the constructor Nov 29, 2024
src/supertux/levelset_screen.cpp Outdated Show resolved Hide resolved
src/supertux/game_session.cpp Show resolved Hide resolved
src/supertux/title_screen.cpp Outdated Show resolved Hide resolved
@swagtoy swagtoy changed the title [no squash] (cherry pick) Don't call GameSession::restart_level in the constructor [NO SQUASH] (cherry pick) Don't call GameSession::restart_level in the constructor Nov 29, 2024
@swagtoy
Copy link
Contributor Author

swagtoy commented Nov 29, 2024

Seems good now. I did test some things and it doesn't crash and burn. Any final words?

@Vankata453
Copy link
Member

src/supertux/game_session.cpp:253:5: style: Statements following 'throw' will never be executed. [unreachableCode]
    ScreenManager::current()->pop_screen();
    ^

src/supertux/levelset_screen.cpp Outdated Show resolved Hide resolved
src/worldmap/worldmap_sector.cpp Outdated Show resolved Hide resolved
@swagtoy
Copy link
Contributor Author

swagtoy commented Dec 3, 2024

RE: src/worldmap/worldmap_sector.cpp

Your change here would've broken logic as we never pushed anything on the screen to begin with.

@swagtoy
Copy link
Contributor Author

swagtoy commented Dec 3, 2024

(commenting in a regular comment as Github is broken right now)

@Vankata453 Vankata453 changed the title [NO SQUASH] (cherry pick) Don't call GameSession::restart_level in the constructor (cherry pick) Don't call GameSession::restart_level in the constructor Dec 3, 2024
@Vankata453 Vankata453 merged commit e34bc46 into SuperTux:master Dec 3, 2024
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.

2 participants