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

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, found a clean solution :)

@TrueBrain TrueBrain force-pushed the pause-in-singleplayer-is-fine branch 4 times, most recently from dce34b3 to 21547f2 Compare June 10, 2021 17:30
@TrueBrain TrueBrain force-pushed the pause-in-singleplayer-is-fine branch from 21547f2 to 70ce4ee Compare June 10, 2021 17:34
@TrueBrain TrueBrain merged commit 849a105 into OpenTTD:master Jun 10, 2021
@TrueBrain TrueBrain deleted the pause-in-singleplayer-is-fine branch June 10, 2021 18:11
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.

None yet

2 participants