summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-26 22:58:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-26 22:58:31 +0300
commit182fe0545897aae420dddf92efc17784be622ebf (patch)
treed306d6706f928956211daed905f6547ec7bdb743 /src
parent83981f76348655507d225aca220893e668b09bdc (diff)
downloadmv-182fe0545897aae420dddf92efc17784be622ebf.tar.gz
mv-182fe0545897aae420dddf92efc17784be622ebf.tar.bz2
mv-182fe0545897aae420dddf92efc17784be622ebf.tar.xz
mv-182fe0545897aae420dddf92efc17784be622ebf.zip
Try update attributes/stats in stat pages in any changes.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/statspage.cpp10
-rw-r--r--src/gui/widgets/statspage.h6
-rw-r--r--src/gui/widgets/statspagebasic.cpp7
3 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/widgets/statspage.cpp b/src/gui/widgets/statspage.cpp
index 1f30f2862..9b45ce227 100644
--- a/src/gui/widgets/statspage.cpp
+++ b/src/gui/widgets/statspage.cpp
@@ -41,6 +41,7 @@ StatsPage::StatsPage(const Widget2 *const widget,
const std::string &page) :
Container(widget),
WidgetListener(),
+ AttributeListener(),
StatListener(),
mAttrs(),
mAttrCont(new VertContainer(this, 32)),
@@ -68,6 +69,15 @@ void StatsPage::widgetResized(const Event &event A_UNUSED)
mAttrScroll->setSize(getWidth(), getHeight());
}
+void StatsPage::attributeChanged(const AttributesT id,
+ const int oldVal A_UNUSED,
+ const int newVal A_UNUSED)
+{
+ const Attrs::const_iterator it = mAttrs.find(id);
+ if (it != mAttrs.end() && it->second)
+ it->second->update();
+}
+
void StatsPage::statChanged(const AttributesT id,
const int oldVal1 A_UNUSED,
const int oldVal2 A_UNUSED)
diff --git a/src/gui/widgets/statspage.h b/src/gui/widgets/statspage.h
index b9ab37df5..5723b7d3d 100644
--- a/src/gui/widgets/statspage.h
+++ b/src/gui/widgets/statspage.h
@@ -23,6 +23,7 @@
#include "gui/widgets/attrs/attrdisplay.h"
+#include "listeners/attributelistener.h"
#include "listeners/statlistener.h"
#include "localconsts.h"
@@ -32,6 +33,7 @@ class VertContainer;
class StatsPage final : public Container,
public WidgetListener,
+ public AttributeListener,
public StatListener
{
public:
@@ -42,6 +44,10 @@ class StatsPage final : public Container,
void widgetResized(const Event &event) override final;
+ void attributeChanged(const AttributesT id,
+ const int oldVal,
+ const int newVal) override final;
+
void statChanged(const AttributesT id,
const int oldVal1,
const int oldVal2) override final;
diff --git a/src/gui/widgets/statspagebasic.cpp b/src/gui/widgets/statspagebasic.cpp
index 04252abf5..5732afd29 100644
--- a/src/gui/widgets/statspagebasic.cpp
+++ b/src/gui/widgets/statspagebasic.cpp
@@ -105,7 +105,7 @@ void StatsPageBasic::attributeChanged(const AttributesT id,
if (it->second)
it->second->update();
}
- break;
+ return;
case Attributes::PLAYER_CORR_POINTS:
// Update all attributes
@@ -115,12 +115,15 @@ void StatsPageBasic::attributeChanged(const AttributesT id,
if (it->second)
it->second->update();
}
- break;
+ return;
default:
break;
}
PRAGMA45(GCC diagnostic pop)
+ const Attrs::const_iterator it = mAttrs.find(id);
+ if (it != mAttrs.end() && it->second)
+ it->second->update();
}
void StatsPageBasic::setPointsNeeded(const AttributesT id,