From d9dab8f2d9436b84a318cd5df171ba96dd4ec5ac Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 28 Feb 2017 16:18:47 +0300 Subject: Add paths.xml option overweightPercent for show overweight message. Default value: 50 --- src/client.cpp | 1 + src/defaults.cpp | 2 ++ src/gui/dialogsmanager.cpp | 5 ++++- src/gui/widgets/tabs/setup_other.cpp | 1 - src/settings.h | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index b7f62415b..51ad12106 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1870,6 +1870,7 @@ void Client::initPaths() settings.linkCommandSymbol = paths.getStringValue("linkCommandSymbol"); if (settings.linkCommandSymbol.empty()) settings.linkCommandSymbol = "="; + settings.overweightPercent = paths.getIntValue("overweightPercent"); } void Client::initTradeFilter() diff --git a/src/defaults.cpp b/src/defaults.cpp index 476603507..596f56f47 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -670,6 +670,8 @@ DefaultsData* getPathsDefaults() AddDEF("palettesDir", ""); AddDEF("defaultPaletteFile", "palette.gpl"); + AddDEF("overweightPercent", 50); + return configData; } diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index c1ed960be..b4a3cc6ea 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -166,8 +166,11 @@ void DialogsManager::attributeChanged(const AttributesT id, { if (!weightNotice && config.getBoolValue("weightMsg")) { + int percent = settings.overweightPercent; + if (percent < 1) + percent = 50; const int max = PlayerInfo::getAttribute( - Attributes::MAX_WEIGHT) / 2; + Attributes::MAX_WEIGHT) * percent / 100; const int total = oldVal; if (newVal >= max && total < max) { diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 8ed123a4d..656192f18 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -275,7 +275,6 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : new SetupItemCheckBox(_("Enable weight notifications"), "", "weightMsg", this, "weightMsgEvent"); - // TRANSLATORS: settings group new SetupItemLabel(_("Shop"), "", this); diff --git a/src/settings.h b/src/settings.h index d25f27d21..258af83f9 100644 --- a/src/settings.h +++ b/src/settings.h @@ -75,6 +75,7 @@ class Settings final cameraMode(0U), crazyMoveState(0U), targetingType(0U), + overweightPercent(50U), mapDrawType(MapType::NORMAL), emoteType(EmoteType::Player), persistentIp(true), @@ -135,6 +136,7 @@ class Settings final unsigned int cameraMode; unsigned int crazyMoveState; unsigned int targetingType; + unsigned int overweightPercent; MapTypeT mapDrawType; EmoteTypeT emoteType; bool persistentIp; -- cgit v1.2.3-60-g2f50