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

@TrueBrain TrueBrain commented Jan 2, 2021

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 force-pushed the TrueBrain:emergency_twice branch from 082fde6 to c9b5203 Jan 2, 2021
This was clearly overlooked during the initial implementation.
@TrueBrain TrueBrain force-pushed the TrueBrain:emergency_twice branch from c9b5203 to d1d8e9b Jan 2, 2021
@LordAro
Copy link
Member

@LordAro 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

@TrueBrain TrueBrain commented Jan 2, 2021

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

@michicc
michicc approved these changes Jan 2, 2021
@TrueBrain TrueBrain merged commit c288eba into OpenTTD:master Jan 2, 2021
8 checks passed
8 checks passed
Emscripten
Details
Commit checker
Details
Check preview needs update Check preview needs update
Details
Linux (clang, clang++)
Details
Linux (gcc, g++)
Details
Mac OS (x64, x86_64) Mac OS (x64, x86_64)
Details
Windows (x86) Windows (x86)
Details
Windows (x64) Windows (x64)
Details
@TrueBrain TrueBrain deleted the TrueBrain:emergency_twice branch Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants