Change: allow pause/unpause console command in single player too (#9342)
(cherry picked from commit 849a10520c
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
563884105f
commit
364ce76d51
@@ -174,11 +174,24 @@ DEF_CONSOLE_HOOK(ConHookNoNetwork)
|
|||||||
return CHR_ALLOW;
|
return CHR_ALLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if are either in singleplayer or a server.
|
||||||
|
* @return True iff we are either in singleplayer or a server.
|
||||||
|
*/
|
||||||
|
DEF_CONSOLE_HOOK(ConHookServerOrNoNetwork)
|
||||||
|
{
|
||||||
|
if (_networking && !_network_server) {
|
||||||
|
if (echo) IConsoleError("This command is only available to a network server.");
|
||||||
|
return CHR_DISALLOW;
|
||||||
|
}
|
||||||
|
return CHR_ALLOW;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_CONSOLE_HOOK(ConHookNewGRFDeveloperTool)
|
DEF_CONSOLE_HOOK(ConHookNewGRFDeveloperTool)
|
||||||
{
|
{
|
||||||
if (_settings_client.gui.newgrf_developer_tools) {
|
if (_settings_client.gui.newgrf_developer_tools) {
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
if (echo) IConsoleError("This command is only available in game and editor.");
|
if (echo) IConsoleError("This command is only available in-game and in the editor.");
|
||||||
return CHR_DISALLOW;
|
return CHR_DISALLOW;
|
||||||
}
|
}
|
||||||
return ConHookNoNetwork(echo);
|
return ConHookNoNetwork(echo);
|
||||||
@@ -223,7 +236,7 @@ DEF_CONSOLE_CMD(ConResetEnginePool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
IConsoleError("This command is only available in game and editor.");
|
IConsoleError("This command is only available in-game and in the editor.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -684,6 +697,11 @@ DEF_CONSOLE_CMD(ConPauseGame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_game_mode == GM_MENU) {
|
||||||
|
IConsoleError("This command is only available in-game and in the editor.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
|
if ((_pause_mode & PM_PAUSED_NORMAL) == PM_UNPAUSED) {
|
||||||
DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
|
DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
|
||||||
if (!_networking) IConsolePrint(CC_DEFAULT, "Game paused.");
|
if (!_networking) IConsolePrint(CC_DEFAULT, "Game paused.");
|
||||||
@@ -701,6 +719,11 @@ DEF_CONSOLE_CMD(ConUnpauseGame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_game_mode == GM_MENU) {
|
||||||
|
IConsoleError("This command is only available in-game and in the editor.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((_pause_mode & PM_PAUSED_NORMAL) != PM_UNPAUSED) {
|
if ((_pause_mode & PM_PAUSED_NORMAL) != PM_UNPAUSED) {
|
||||||
DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE);
|
DoCommandP(0, PM_PAUSED_NORMAL, 0, CMD_PAUSE);
|
||||||
if (!_networking) IConsolePrint(CC_DEFAULT, "Game unpaused.");
|
if (!_networking) IConsolePrint(CC_DEFAULT, "Game unpaused.");
|
||||||
@@ -3430,8 +3453,8 @@ void IConsoleStdLibRegister()
|
|||||||
IConsole::CmdRegister("unban", ConUnBan, ConHookServerOnly);
|
IConsole::CmdRegister("unban", ConUnBan, ConHookServerOnly);
|
||||||
IConsole::CmdRegister("banlist", ConBanList, ConHookServerOnly);
|
IConsole::CmdRegister("banlist", ConBanList, ConHookServerOnly);
|
||||||
|
|
||||||
IConsole::CmdRegister("pause", ConPauseGame, ConHookServerOnly);
|
IConsole::CmdRegister("pause", ConPauseGame, ConHookServerOrNoNetwork);
|
||||||
IConsole::CmdRegister("unpause", ConUnpauseGame, ConHookServerOnly);
|
IConsole::CmdRegister("unpause", ConUnpauseGame, ConHookServerOrNoNetwork);
|
||||||
|
|
||||||
IConsole::CmdRegister("company_pw", ConCompanyPassword, ConHookNeedNetwork);
|
IConsole::CmdRegister("company_pw", ConCompanyPassword, ConHookNeedNetwork);
|
||||||
IConsole::AliasRegister("company_password", "company_pw %+");
|
IConsole::AliasRegister("company_password", "company_pw %+");
|
||||||
|
Reference in New Issue
Block a user