diff options
Diffstat (limited to 'src/gui/widgets/avatarlistbox.cpp')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 566cd9de..69c3dfde 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -100,10 +100,22 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics) if (a->getDisplayBold()) graphics->setFont(boldFont); + std::string text; + + if (a->getMaxHp() > 0) + { + text = strprintf("%s %d/%d", a->getName().c_str(), + a->getHp(), a->getMaxHp()); + } + else + { + text = a->getName(); + } + // Draw Name - graphics->drawText(a->getName(), 15, y); + graphics->drawText(text, 15, y); - width = getFont()->getWidth(a->getName()) + 17; // Extra right padding + width = getFont()->getWidth(text) + 17; // Extra right padding if (width > newWidth) { |