summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp54
1 files changed, 40 insertions, 14 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 9e5ae3ad1..39d0bd450 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -2071,20 +2071,40 @@ void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage,
int dx = static_cast<int>(static_cast<float>(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));
@@ -2183,6 +2203,12 @@ void Being::recalcSpritesOrder()
{
std::map<int, int>::const_iterator repIt
= itemReplacer.find(mSpriteIDs[remSprite]);
+ if (repIt == itemReplacer.end())
+ {
+ repIt = itemReplacer.find(0);
+ if (repIt->second == 0)
+ repIt = itemReplacer.end();
+ }
if (repIt != itemReplacer.end())
{
mSpriteHide[remSprite] = repIt->second;