From 52d9663b97db3dfc419e16f2d0ba50bba0a85d82 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 Jul 2016 23:42:39 +0300 Subject: Show hp and max hp in being popup. --- src/gui/popups/beingpopup.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/gui/popups/beingpopup.cpp') diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 308629343..44432c4d5 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -72,7 +72,7 @@ void BeingPopup::postInit() void BeingPopup::addLabels(const int fontHeight) { - for (int f = 0; f < 10; f ++) + for (int f = 0; f < 11; f ++) { Label *const label = new Label(this, "A"); label->setPosition(0, fontHeight * (f + 1)); @@ -261,6 +261,24 @@ void BeingPopup::show(const int x, const int y, Being *const b) num ++; } + const int maxHp = b->getMaxHP(); + if (maxHp > 0) + { + int hp = b->getHP(); + if (hp == 0) + hp = maxHp - b->getDamageTaken(); + if (hp > 0) + { + ptr = mLabels[num]; + // TRANSLATORS: being popup label + ptr->setCaption(strprintf(_("Hp: %d/%d"), + hp, + maxHp)); + ptr->adjustSize(); + num ++; + } + } + ptr = mLabels[num]; // TRANSLATORS: being popup label ptr->setCaption(strprintf(_("Particles: %u"), -- cgit v1.2.3-60-g2f50