From 8d1a54deb1b0dfda44fa8d87d43feb5cdf95c7f4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 28 Mar 2023 01:43:43 +0300 Subject: [PATCH 50/50] Client: Add send_desired_settings option See osdn #47673 Signed-off-by: Marko Lindqvist --- client/options.c | 16 ++++++++++++++-- client/options.h | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/options.c b/client/options.c index 80eca0d81a..8652c62744 100644 --- a/client/options.c +++ b/client/options.c @@ -87,6 +87,7 @@ struct client_options gui_options = { .use_prev_server = FALSE, .heartbeat_enabled = FALSE, + .send_desired_settings = TRUE, /** Migrations **/ .first_boot = FALSE, @@ -1890,13 +1891,23 @@ static struct client_option client_options[] = { "this from its default value unless you know what " "you're doing."), COC_NETWORK, GUI_STUB, DEFAULT_METASERVER_OPTION, NULL, 0), - GEN_BOOL_OPTION(heartbeat_enabled, N_("Send heartbeat messages to server"), + GEN_BOOL_OPTION(heartbeat_enabled, + N_("Send heartbeat messages to the server"), N_("Periodically send an empty heartbeat message to the " "server to probe whether the connection is still up. " "This can help to make it obvious when the server has " "cut the connection due to a connectivity outage, if " "the client would otherwise sit idle for a long period."), COC_NETWORK, GUI_STUB, TRUE, NULL), + GEN_BOOL_OPTION(send_desired_settings, + N_("Send desired settings to the server"), + N_("In single-player mode client usually sends user's " + "desired server settings to the server it has " + "launched internally. By disabling this option one " + "can prevent such override of server settings from " + "other sources, such as settings balanced for a " + "custom ruleset."), + COC_NETWORK, GUI_STUB, TRUE, NULL), GEN_STR_LIST_OPTION(default_sound_set_name, N_("Soundset"), N_("This is the soundset that will be used. Changing " @@ -4202,6 +4213,7 @@ void handle_server_setting_const if (!psoption->desired_sent \ && psoption->is_visible \ && psoption->is_changeable \ + && gui_options.send_desired_settings \ && is_server_running() \ && packet->initial_setting) { \ /* Only send our private settings if we are running \ @@ -5624,7 +5636,7 @@ static void desired_settable_option_send(struct option *poption) ****************************************************************************/ void resend_desired_settable_options(void) { - if (is_server_running()) { + if (gui_options.send_desired_settings && is_server_running()) { settable_options_hash_iterate(settable_options_hash, name, value) { (void) value; /* Silence compiler warning about unused variable */ struct option *poption = optset_option_by_name(server_optset, name); diff --git a/client/options.h b/client/options.h index 34bb617fa3..8d7faedcda 100644 --- a/client/options.h +++ b/client/options.h @@ -107,6 +107,7 @@ struct client_options int default_server_port; bool use_prev_server; bool heartbeat_enabled; + bool send_desired_settings; char default_metaserver[512]; char default_tileset_square_name[512]; char default_tileset_hex_name[512]; -- 2.39.2