summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-21 21:28:24 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-21 21:28:24 +0300
commit3b71334296de5b53d2a6fa64c33b283ca3fa2a71 (patch)
tree1cea04790aaaa3e6219dc052469d026ebb079b95 /src
parentd65b19913092fa0ebe8848c0c902e6ee487d55c9 (diff)
downloadplus-3b71334296de5b53d2a6fa64c33b283ca3fa2a71.tar.gz
plus-3b71334296de5b53d2a6fa64c33b283ca3fa2a71.tar.bz2
plus-3b71334296de5b53d2a6fa64c33b283ca3fa2a71.tar.xz
plus-3b71334296de5b53d2a6fa64c33b283ca3fa2a71.zip
Show effect names in debug window in target tab.
Diffstat (limited to 'src')
-rw-r--r--src/being/actorsprite.cpp25
-rw-r--r--src/being/actorsprite.h2
-rw-r--r--src/gui/popups/beingpopup.cpp17
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp11
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.h1
-rw-r--r--src/resources/db/statuseffectdb.h2
6 files changed, 39 insertions, 19 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 5334bcb6a..b315a7c08 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -248,8 +248,8 @@ static void applyEffectByOption1(ActorSprite *const actor,
{
FOR_EACH (OptionsMapCIter, it, options)
{
- const int opt = (*it).first;
- const int id = (*it).second;
+ const uint32_t opt = (*it).first;
+ const uint32_t id = (*it).second;
if (opt == option)
{
actor->setStatusEffect(id, Enable_true);
@@ -544,3 +544,24 @@ void ActorSprite::cleanupTargetCursors()
}
end_foreach
}
+
+std::string ActorSprite::getStatusEffectsString() const
+{
+ std::string effectsStr;
+ if (!mStatusEffects.empty())
+ {
+ FOR_EACH (std::set<int>::const_iterator, it, mStatusEffects)
+ {
+ const StatusEffect *const effect =
+ StatusEffectDB::getStatusEffect(
+ *it,
+ Enable_true);
+ if (!effect)
+ continue;
+ if (!effectsStr.empty())
+ effectsStr.append(", ");
+ effectsStr.append(effect->mName);
+ }
+ }
+ return effectsStr;
+}
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 0bc6eff00..06433628f 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -187,6 +187,8 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
const std::set<int> &getStatusEffects() const A_WARN_UNUSED
{ return mStatusEffects; }
+ std::string getStatusEffectsString() const;
+
virtual void stopCast(const bool b A_UNUSED)
{ }
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index f3d9195cc..fe70d9ad7 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -339,25 +339,12 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label6 = nullptr;
}
- const std::set<int> &effects = b->getStatusEffects();
+ const std::string effects = b->getStatusEffectsString();
if (!effects.empty())
{
- std::string effectsStr;
- FOR_EACH (std::set<int>::const_iterator, it, effects)
- {
- const StatusEffect *const effect =
- StatusEffectDB::getStatusEffect(
- *it,
- Enable_true);
- if (!effect)
- continue;
- if (!effectsStr.empty())
- effectsStr.append(", ");
- effectsStr.append(effect->mName);
- }
// TRANSLATORS: being popup label
label7->setCaption(strprintf(_("Effects: %s"),
- effectsStr.c_str()));
+ effects.c_str()));
label7->adjustSize();
}
else
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index fc22ada18..6cf3540ab 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -289,7 +289,9 @@ TargetDebugTab::TargetDebugTab(const Widget2 *const widget) :
// TRANSLATORS: debug window label
mKarmaLabel(new Label(this, strprintf("%s ?", _("Karma:")))),
// TRANSLATORS: debug window label
- mMannerLabel(new Label(this, strprintf("%s ?", _("Manner:"))))
+ mMannerLabel(new Label(this, strprintf("%s ?", _("Manner:")))),
+ // TRANSLATORS: debug window label
+ mEffectsLabel(new Label(this, strprintf("%s ?", _("Effects:"))))
{
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -307,6 +309,7 @@ TargetDebugTab::TargetDebugTab(const Widget2 *const widget) :
place(0, 10, mCriticalHitLabel, 2);
place(0, 11, mKarmaLabel, 2);
place(0, 12, mMannerLabel, 2);
+ place(0, 13, mEffectsLabel, 2);
place.getCell().matchColWidth(0, 0);
place = h.getPlacer(0, 1);
@@ -371,6 +374,9 @@ void TargetDebugTab::logic()
mMannerLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
_("Manner:"), target->getManner()));
+ mEffectsLabel->setCaption(strprintf("%s %s",
+ // TRANSLATORS: debug window label
+ _("Effects:"), target->getStatusEffectsString().c_str()));
const int delay = target->getAttackDelay();
if (delay)
@@ -412,6 +418,8 @@ void TargetDebugTab::logic()
mKarmaLabel->setCaption(strprintf("%s ?", _("Karma:")));
// TRANSLATORS: debug window label
mMannerLabel->setCaption(strprintf("%s ?", _("Manner:")));
+ // TRANSLATORS: debug window label
+ mEffectsLabel->setCaption(strprintf("%s ?", _("Effects:")));
}
mTargetLabel->adjustSize();
@@ -426,6 +434,7 @@ void TargetDebugTab::logic()
mCriticalHitLabel->adjustSize();
mKarmaLabel->adjustSize();
mMannerLabel->adjustSize();
+ mEffectsLabel->adjustSize();
BLOCK_END("TargetDebugTab::logic")
}
diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h
index 44d45dbb9..1dd92b39d 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.h
+++ b/src/gui/widgets/tabs/debugwindowtabs.h
@@ -104,6 +104,7 @@ class TargetDebugTab final : public DebugTab
Label *mCriticalHitLabel A_NONNULLPOINTER;
Label *mKarmaLabel A_NONNULLPOINTER;
Label *mMannerLabel A_NONNULLPOINTER;
+ Label *mEffectsLabel A_NONNULLPOINTER;
};
class NetDebugTab final : public DebugTab
diff --git a/src/resources/db/statuseffectdb.h b/src/resources/db/statuseffectdb.h
index 64dca44b2..c713979fd 100644
--- a/src/resources/db/statuseffectdb.h
+++ b/src/resources/db/statuseffectdb.h
@@ -32,7 +32,7 @@
class StatusEffect;
-typedef std::map<int, int> OptionsMap;
+typedef std::map<uint32_t, uint32_t> OptionsMap;
typedef OptionsMap::const_iterator OptionsMapCIter;
namespace StatusEffectDB