summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
committerReid <reidyaro@gmail.com>2012-01-25 22:05:36 +0100
commit8b612abb42853a22c1a9545e2c9280d154646543 (patch)
treef466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/being.cpp
parenta913dd41df61760de6ece552f941e002251ff54c (diff)
parentd340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff)
downloadplus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz
plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2
plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz
plus-8b612abb42853a22c1a9545e2c9280d154646543.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
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;