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 #10206: Disable scripts in intro game #10241

Merged
merged 1 commit into from Dec 15, 2022
Merged

Conversation

glx22
Copy link
Contributor

@glx22 glx22 commented Dec 14, 2022

Fixes #10206

Motivation / Problem

Using scripts in intro game can cause crashes.
We always said intro should not use scripts or newgrfs, but we only enforced the newgrf part (with broken save error because disabling newgrf in a running game is never a good idea).
Dedicated servers may also crash because of scripts during the load test as it's done in GM_MENU (unrelated but it's funny to see the broken save error when starting a dedicated server with -g and a save containing newgrf)

Description

Discard script data on load and skip starting of scripts (like it's done for network games).
As OpenTTD requires a script to be started for is_ai companies, prevent using any random ones (that may cause crash by accessing settings) by forcing Dummy AI for intro.
And don't show AIDebugWindow when an AI dies in intro (as Dummy AI will instant die).

Limitations

This also solves the crash reported in #9720 but starting scripts before the gamestate is ready is still an issue, and #9745 should handle that when done.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@glx22 glx22 force-pushed the fix_10206 branch 2 times, most recently from 01cfc9f to 17c15f3 Compare December 15, 2022 02:11
src/ai/ai_scanner.cpp Outdated Show resolved Hide resolved
@glx22 glx22 merged commit 2848483 into OpenTTD:master Dec 15, 2022
@glx22 glx22 deleted the fix_10206 branch December 15, 2022 20:43
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.

Assert when loading titlegame with AI
3 participants