From e9de7ecf1d440d8c2f9cd7cf1a74cd4d313b49a8 Mon Sep 17 00:00:00 2001 From: Louis Moureaux Date: Mon, 15 Aug 2022 00:25:52 +0200 Subject: [PATCH] Add commands to control the timeout Add three new timeout-related server commands: - timeoutshow displays the current timeout - timeoutadd adds time to the current turn - timeoutset sets the remaining time for the current turn They are named timeoutsomething for three reasons: - timeoutincrease already exists - it's easier to find them if they're together in /help commands - sub-commands like "timeout show" are not feasible with the current implementation This is heavily inspired from an earlier patch used by LT with 2.6, 41cc12b401fe4a9db8d22b78039561710fff59e3. The syntax is however more flexible, allowing for hours or minutes to be passed directly without doing any calculation. Closes #1151. --- server/commands.cpp | 26 +++++++++ server/commands.h | 5 +- server/stdinhand.cpp | 129 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 153 insertions(+), 7 deletions(-) diff --git a/server/commands.cpp b/server/commands.cpp index 440afd8a70..b60f73e5e2 100644 --- a/server/commands.cpp +++ b/server/commands.cpp @@ -423,6 +423,32 @@ static struct command commands[] = { N_("If there is none, become the game organizer with increased " "permissions."), nullptr, nullptr, CMD_ECHO_ADMINS, VCF_NONE, 50}, + {"timeoutshow", ALLOW_INFO, SYN_ORIG_("timeoutshow"), + N_("Show timeout settings and timers."), + N_("Shows information about the timeout for the current turn, for " + "instance how much time is left."), + nullptr, CMD_ECHO_ALL, VCF_NONE, 0}, + {"timeoutset", ALLOW_CTRL, + // TRANS: translate text between <> only + N_("timeoutset