From 7852b453367e7cbfd82f4262a46505152759ddce Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 16 Jan 2012 18:28:32 +0300 Subject: Fix player and monsters hp bars in evol server. --- src/being.cpp | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index af3b14419..39d0bd450 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -2071,20 +2071,40 @@ void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage, int dx = static_cast(static_cast(width) / p); - if ((!damage && (this != player_node || hp == maxHP) && serverVersion < 1) - || (!hp && maxHP == damage)) - { - graphics->setColor(userPalette->getColorWithAlpha(color1)); - graphics->fillRectangle(gcn::Rectangle( - x, y, dx, height)); - return; + if (serverVersion < 1) + { // old servers + if ((!damage && (this != player_node || hp == maxHP)) + || (!hp && maxHP == damage)) + { + graphics->setColor(userPalette->getColorWithAlpha(color1)); + graphics->fillRectangle(gcn::Rectangle( + x, y, dx, height)); + return; + } + else if (width - dx <= 0) + { + graphics->setColor(userPalette->getColorWithAlpha(color2)); + graphics->fillRectangle(gcn::Rectangle( + x, y, width, height)); + return; + } } - else if (width - dx <= 0) - { - graphics->setColor(userPalette->getColorWithAlpha(color2)); - graphics->fillRectangle(gcn::Rectangle( - x, y, width, height)); - return; + else + { // evol servers + if (hp == maxHP) + { + graphics->setColor(userPalette->getColorWithAlpha(color1)); + graphics->fillRectangle(gcn::Rectangle( + x, y, dx, height)); + return; + } + else if (width - dx <= 0) + { + graphics->setColor(userPalette->getColorWithAlpha(color2)); + graphics->fillRectangle(gcn::Rectangle( + x, y, width, height)); + return; + } } graphics->setColor(userPalette->getColorWithAlpha(color1)); -- cgit v1.2.3-60-g2f50