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: prevent clients making emergency saves twice if server disconnects #8477

Merged
merged 1 commit into from Jan 2, 2021

Conversation

TrueBrain
Copy link
Member

Motivation / Problem

While reading through issues, I found this comment:

#7462 (comment)

Clearly, that is wrong, so I looked into it. Found the fix.

Description

This was clearly overlooked during the initial implementation of #6796 . Also cleaned up the code a bit, and removed a curse-word .. we shouldn't be doing that anymore ;)

Limitations

None I know of

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 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')

@TrueBrain TrueBrain changed the title Fix: prevent clients from making emergency saves twice if server disconnects Fix: prevent clients making emergency saves twice if server disconnects Jan 2, 2021
@TrueBrain TrueBrain added candidate: yes This Pull Request is a candidate for being merged size: trivial This Pull Request is trivial labels Jan 2, 2021
This was clearly overlooked during the initial implementation.
@LordAro
Copy link
Member

LordAro commented Jan 2, 2021

I wonder if this is a fix for #7462 as a whole, did you check?

@TrueBrain
Copy link
Member Author

I wonder if this is a fix for #7462 as a whole, did you check?

What a silly question! Of course I checked :D And no, it does not. This only fixes the observation you did in the comment.

Your analysis of the problem in that ticket is correct, and basically, it is not a bug. There currently is no clean way (that I can see) to start an additional thread to do the saving in, as we are about to jump back to the main menu. As we don't do async, and the drawing-thread is controlled (via a lock) in the main gameloop, there are not that many options :) It would require another game-mode and a placeholder graphics .. not sure that is worth it. But I will comment this too in the issue after merging this PR :D

@TrueBrain TrueBrain merged commit c288eba into OpenTTD:master Jan 2, 2021
@TrueBrain TrueBrain deleted the emergency_twice branch January 2, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate: yes This Pull Request is a candidate for being merged size: trivial This Pull Request is trivial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants