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

Change: allow pause/unpause console command in single player too #9342

Merged
merged 1 commit into from Jun 10, 2021

Conversation

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jun 9, 2021

Motivation / Problem

For some weird reason, pause/unpause console command only works in network games. I couldn't think of a single reason for that to make sense.

Mainly I needed this to ensure games are unpaused after game-start for automated testing. Now in game_start.scr I can do unpause, and I am sure the game is not paused. Sweet.

Description

Fixed the weird limitation.

Limitations

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')
@@ -160,6 +160,26 @@ DEF_CONSOLE_HOOK(ConHookNoNetwork)
return CHR_ALLOW;
}

/**
* Check whether we are in singleplayer mode or are the server.

This comment has been minimized.

@rubidium42

rubidium42 Jun 10, 2021
Contributor

The name of the hook and content of the comment do not match with the implementation. It does not check whether its the server or not in network, it also checks for being in the menu.
I don't really have an useful alternative name for the hook though, unless making it super explicit like "ConHookServerOrSinglePlayerOrEditor".

This comment has been minimized.

@TrueBrain

TrueBrain Jun 10, 2021
Author Member

Been fiddling with this, but basically I think there is no right answer.

Updated the comment to better reflect reality, but as far as the function-name goes .. I think this name is already confusing enough, adding more letters to it doesn't help :) So yeah, I also don't have any useful alternatives, so lets go with this :)

This comment has been minimized.

@TrueBrain

TrueBrain Jun 10, 2021
Author Member

Nevermind, found a clean solution :)

@TrueBrain TrueBrain force-pushed the TrueBrain:pause-in-singleplayer-is-fine branch 4 times, most recently from dce34b3 to 21547f2 Jun 10, 2021
@TrueBrain TrueBrain force-pushed the TrueBrain:pause-in-singleplayer-is-fine branch from 21547f2 to 70ce4ee Jun 10, 2021
@TrueBrain TrueBrain merged commit 849a105 into OpenTTD:master Jun 10, 2021
13 checks passed
13 checks passed
@github-actions
Emscripten
Details
@github-actions
Commit checker
Details
@github-actions
Check preview needs update Check preview needs update
Details
@github-actions
Linux (clang, clang++, libsdl2-dev)
Details
@github-actions
Linux (gcc, g++, libsdl2-dev)
Details
@github-actions
Linux (gcc, g++, libsdl1.2-dev)
Details
@github-actions
Linux (gcc, g++, -DOPTION_DEDICATED=ON)
Details
@github-actions
Mac OS (x64, x86_64)
Details
@github-actions
Windows (windows-latest, x86)
Details
@github-actions
Windows (windows-latest, x64)
Details
@github-actions
Windows (windows-2016, x86)
Details
@github-actions
Windows (windows-2016, x64)
Details
@github-actions
Check Annotations
Details
@TrueBrain TrueBrain deleted the TrueBrain:pause-in-singleplayer-is-fine branch Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants