diff options
author | Ira Rice <irarice@gmail.com> | 2009-03-25 19:14:04 -0600 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-03-25 19:14:04 -0600 |
commit | bfa4a2e11e0c31418d21a91eca7495589c50c11e (patch) | |
tree | 8f5202581b2877018dd0fc6c7b3529572dcae0dd /src/being.cpp | |
parent | 34b7a86d06eba936c0642bc66ba104e4669d6b01 (diff) | |
download | mana-bfa4a2e11e0c31418d21a91eca7495589c50c11e.tar.gz mana-bfa4a2e11e0c31418d21a91eca7495589c50c11e.tar.bz2 mana-bfa4a2e11e0c31418d21a91eca7495589c50c11e.tar.xz mana-bfa4a2e11e0c31418d21a91eca7495589c50c11e.zip |
Merged relevent changes from TMW commit
dfcc6397848d4597b386b688f689352de6c19ae2
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/being.cpp b/src/being.cpp index 3a772fbd..61826089 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -534,32 +534,18 @@ int Being::getOffset(char pos, char neg) const int Being::getWidth() const { - if (mSprites[BASE_SPRITE]) - { - const int width = mSprites[BASE_SPRITE]->getWidth() > DEFAULT_WIDTH ? - mSprites[BASE_SPRITE]->getWidth() : - DEFAULT_WIDTH; - return width; - } + if (AnimatedSprite *base = mSprites[BASE_SPRITE]) + return std::max(base->getWidth(), DEFAULT_WIDTH); else - { return DEFAULT_WIDTH; - } } int Being::getHeight() const { - if (mSprites[BASE_SPRITE]) - { - const int height = mSprites[BASE_SPRITE]->getHeight() > DEFAULT_HEIGHT ? - mSprites[BASE_SPRITE]->getHeight() : - DEFAULT_HEIGHT; - return height; - } + if (AnimatedSprite *base = mSprites[BASE_SPRITE]) + return std::max(base->getHeight(), DEFAULT_HEIGHT); else - { return DEFAULT_HEIGHT; - } } void Being::setTargetAnimation(SimpleAnimation* animation) @@ -575,9 +561,8 @@ void Being::load() int hairstyles = 1; while (ItemDB::get(-hairstyles).getSprite(GENDER_MALE) != "error.xml") - { hairstyles++; - } + mNumberOfHairstyles = hairstyles; } |