diff --git a/data/gui/screens/options_general.stkgui b/data/gui/screens/options_general.stkgui
index 9fdc39fde..83d3041e9 100644
--- a/data/gui/screens/options_general.stkgui
+++ b/data/gui/screens/options_general.stkgui
@@ -63,7 +63,15 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp
index 07c1353f0..1a2c8a959 100644
--- a/src/config/user_config.hpp
+++ b/src/config/user_config.hpp
@@ -792,6 +792,9 @@ namespace UserConfigParams
PARAM_DEFAULT(BoolUserConfigParam(true, "lobby-chat",
&m_network_group, "Enable chatting in networking lobby, if off than "
"no chat message will be displayed from any players."));
+ PARAM_PREFIX BoolUserConfigParam m_race_chat
+ PARAM_DEFAULT(BoolUserConfigParam(true, "race-chat",
+ &m_network_group, "Enable chatting during races."));
PARAM_PREFIX IntUserConfigParam m_max_players
PARAM_DEFAULT(IntUserConfigParam(8, "max-players",
&m_network_group, "Maximum number of players on the server "
diff --git a/src/guiengine/message_queue.cpp b/src/guiengine/message_queue.cpp
index fefe53c40..73a942e73 100644
--- a/src/guiengine/message_queue.cpp
+++ b/src/guiengine/message_queue.cpp
@@ -132,9 +132,9 @@ public:
const unsigned height = irr_driver->getActualScreenSize().Height;
gui::IGUIFont* font = GUIEngine::getFont();
font->initGlyphLayouts(m_message, m_gls);
- // Reserve space for 5 lines of text, it will occupy the circle
+ // Reserve space for 3 lines of text, it will occupy the circle
const int max_width = width - (brp.m_left_border +
- brp.m_right_border) - (font->getHeightPerLine() * 5);
+ brp.m_right_border) - (font->getHeightPerLine() * 3);
if (max_width < 0)
{
m_display_timer = -1;
@@ -147,18 +147,18 @@ public:
font->getHeightPerLine(), font->getInverseShaping(),
font->getScale());
- if ((int)dim.Height > font->getHeightPerLine() * 5)
+ if ((int)dim.Height > font->getHeightPerLine() * 3)
{
- // Max 5 lines to prevent too long message from network chat
+ // Max 3 lines to prevent too long message from network chat
int newline_count = 0;
for (unsigned i = 0; i < m_gls.size(); i++)
{
if (m_gls[i].flags & gui::GLF_NEWLINE)
{
- if (++newline_count >= 5)
+ if (++newline_count >= 3)
{
m_gls.erase(m_gls.begin() + i, m_gls.end());
- dim.Height = font->getHeightPerLine() * 5;
+ dim.Height = font->getHeightPerLine() * 3;
break;
}
}
diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp
index 3a7a7de14..7b2e60404 100644
--- a/src/network/protocols/client_lobby.cpp
+++ b/src/network/protocols/client_lobby.cpp
@@ -874,7 +874,7 @@ void ClientLobby::handleChat(Event* event)
{
if (GUIEngine::getCurrentScreen() == NetworkingLobby::getInstance())
NetworkingLobby::getInstance()->addMoreServerInfo(message);
- else
+ else if (UserConfigParams::m_race_chat)
MessageQueue::add(MessageQueue::MT_GENERIC, message);
}
} // handleChat
diff --git a/src/states_screens/dialogs/race_paused_dialog.cpp b/src/states_screens/dialogs/race_paused_dialog.cpp
index 5141f96ac..7690a6f73 100644
--- a/src/states_screens/dialogs/race_paused_dialog.cpp
+++ b/src/states_screens/dialogs/race_paused_dialog.cpp
@@ -86,7 +86,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth,
getWidget("send")->setText(L"\u21B2");
// Unicode smile emoji
getWidget("emoji")->setText(L"\u263A");
- if (UserConfigParams::m_lobby_chat)
+ if (UserConfigParams::m_lobby_chat && UserConfigParams::m_race_chat)
{
m_text_box->setActive(true);
getWidget("send")->setVisible(true);
diff --git a/src/states_screens/options/options_screen_general.cpp b/src/states_screens/options/options_screen_general.cpp
index 7f732a0b3..59c4f3979 100644
--- a/src/states_screens/options/options_screen_general.cpp
+++ b/src/states_screens/options/options_screen_general.cpp
@@ -88,24 +88,9 @@ void OptionsScreenGeneral::init()
assert( internet_enabled != NULL );
internet_enabled->setState( UserConfigParams::m_internet_status
==RequestManager::IPERM_ALLOWED );
- CheckBoxWidget* stats = getWidget("enable-hw-report");
- assert( stats != NULL );
- stats->setState(UserConfigParams::m_hw_report_enable);
- CheckBoxWidget* chat = getWidget("enable-lobby-chat");
+ setInternetCheckboxes(internet_enabled->getState());
- if(internet_enabled->getState())
- {
- stats->setActive(true);
- stats->setState(UserConfigParams::m_hw_report_enable);
- chat->setActive(true);
- chat->setState(UserConfigParams::m_lobby_chat);
- }
- else
- {
- stats->setActive(false);
- chat->setActive(false);
- }
CheckBoxWidget* handicap = getWidget("enable-handicap");
assert( handicap != NULL );
handicap->setState( UserConfigParams::m_per_player_difficulty );
@@ -187,36 +172,12 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
// If internet gets enabled, re-initialise the addon manager (which
// happens in a separate thread) so that news.xml etc can be
// downloaded if necessary.
- CheckBoxWidget* stats = getWidget("enable-hw-report");
- CheckBoxWidget* chat = getWidget("enable-lobby-chat");
+ setInternetCheckboxes(internet->getState());
+ PlayerProfile* profile = PlayerManager::getCurrentPlayer();
if(internet->getState())
- {
NewsManager::get()->init(false);
- stats->setActive(true);
- stats->setState(UserConfigParams::m_hw_report_enable);
- chat->setActive(true);
- chat->setState(UserConfigParams::m_lobby_chat);
-#ifdef MOBILE_STK
- getWidget("assets_settings")->setActive(true);
-#endif
- }
- else
- {
- chat->setActive(false);
- stats->setActive(false);
-#ifdef MOBILE_STK
- getWidget("assets_settings")->setActive(false);
-#endif
-
- // Disable this, so that the user has to re-check this if
- // enabled later (for GDPR compliance).
- UserConfigParams::m_hw_report_enable = false;
- stats->setState(false);
-
- PlayerProfile* profile = PlayerManager::getCurrentPlayer();
- if (profile != NULL && profile->isLoggedIn())
- profile->requestSignOut();
- }
+ else if (profile != NULL && profile->isLoggedIn())
+ profile->requestSignOut();
// Deactivate internet after 'requestSignOut' so that the sign out request is allowed
if (!internet->getState())
@@ -233,6 +194,13 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
{
CheckBoxWidget* chat = getWidget("enable-lobby-chat");
UserConfigParams::m_lobby_chat = chat->getState();
+ CheckBoxWidget* race_chat = getWidget("enable-race-chat");
+ race_chat->setActive(UserConfigParams::m_lobby_chat);
+ }
+ else if (name=="enable-race-chat")
+ {
+ CheckBoxWidget* chat = getWidget("enable-race-chat");
+ UserConfigParams::m_race_chat = chat->getState();
}
else if (name=="show-login")
{
@@ -272,6 +240,39 @@ void OptionsScreenGeneral::eventCallback(Widget* widget, const std::string& name
#endif
} // eventCallback
+void OptionsScreenGeneral::setInternetCheckboxes(bool activate)
+{
+ CheckBoxWidget* stats = getWidget("enable-hw-report");
+ CheckBoxWidget* chat = getWidget("enable-lobby-chat");
+ CheckBoxWidget* race_chat = getWidget("enable-race-chat");
+
+ if (activate)
+ {
+ stats->setActive(true);
+ stats->setState(UserConfigParams::m_hw_report_enable);
+ chat->setActive(true);
+ chat->setState(UserConfigParams::m_lobby_chat);
+ race_chat->setActive(UserConfigParams::m_lobby_chat);
+ race_chat->setState(UserConfigParams::m_race_chat);
+#ifdef MOBILE_STK
+ getWidget("assets_settings")->setActive(true);
+#endif
+ }
+ else
+ {
+ chat->setActive(false);
+ stats->setActive(false);
+ race_chat->setActive(false);
+#ifdef MOBILE_STK
+ getWidget("assets_settings")->setActive(false);
+#endif
+ // Disable this, so that the user has to re-check this if
+ // enabled later (for GDPR compliance).
+ UserConfigParams::m_hw_report_enable = false;
+ stats->setState(false);
+ }
+} // setInternetCheckboxes
+
// -----------------------------------------------------------------------------
void OptionsScreenGeneral::tearDown()
diff --git a/src/states_screens/options/options_screen_general.hpp b/src/states_screens/options/options_screen_general.hpp
index 2a714966a..31439b267 100644
--- a/src/states_screens/options/options_screen_general.hpp
+++ b/src/states_screens/options/options_screen_general.hpp
@@ -38,6 +38,8 @@ class OptionsScreenGeneral : public GUIEngine::Screen, public GUIEngine::ScreenS
std::vector m_skins;
+ void setInternetCheckboxes(bool activate);
+
public:
friend class GUIEngine::ScreenSingleton;