summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-13 22:15:53 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-13 22:15:53 +0300
commitecd456560bf8dbd12822ccc8a5b71e957ab85df4 (patch)
treeb699609e725e09a87e6600a603600fdc535b9e0e
parentb7103fbcef86554476871ad363e2a6b3bad0b77e (diff)
downloadmv-ecd456560bf8dbd12822ccc8a5b71e957ab85df4.tar.gz
mv-ecd456560bf8dbd12822ccc8a5b71e957ab85df4.tar.bz2
mv-ecd456560bf8dbd12822ccc8a5b71e957ab85df4.tar.xz
mv-ecd456560bf8dbd12822ccc8a5b71e957ab85df4.zip
Add support compotability with future mana reorder sprites implimentation.
(support for missing sprite tag)
-rw-r--r--src/being.cpp48
1 files changed, 37 insertions, 11 deletions
diff --git a/src/being.cpp b/src/being.cpp
index b344e9709..036f823e6 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2171,22 +2171,48 @@ void Being::recalcSpritesOrder()
{
int remSprite = itr->first;
const std::map<int, int> &itemReplacer = itr->second;
- if (itemReplacer.empty())
- {
- mSpriteHide[remSprite] = 1;
+ if (remSprite >= 0)
+ { // slot known
+ if (itemReplacer.empty())
+ {
+ mSpriteHide[remSprite] = 1;
+ }
+ else
+ {
+ std::map<int, int>::const_iterator repIt
+ = itemReplacer.find(mSpriteIDs[remSprite]);
+ if (repIt != itemReplacer.end())
+ {
+ mSpriteHide[remSprite] = repIt->second;
+ if (repIt->second != 1)
+ {
+ setSprite(remSprite, repIt->second,
+ mSpriteColors[remSprite],
+ 1, false, true);
+ }
+ }
+ }
}
else
- {
+ { // slot unknown. Search for real slot, this can be slow
std::map<int, int>::const_iterator repIt
- = itemReplacer.find(mSpriteIDs[remSprite]);
- if (repIt != itemReplacer.end())
+ = itemReplacer.begin();
+ std::map<int, int>::const_iterator repIt_end
+ = itemReplacer.end();
+ for (;repIt != repIt_end; ++ repIt)
{
- mSpriteHide[remSprite] = repIt->second;
- if (repIt->second != 1)
+ for (unsigned slot2 = 0; slot2 < sz; slot2 ++)
{
- setSprite(remSprite, repIt->second,
- mSpriteColors[remSprite],
- 1, false, true);
+ if (mSpriteIDs[slot2] == repIt->first)
+ {
+ mSpriteHide[slot2] = repIt->second;
+ if (repIt->second != 1)
+ {
+ setSprite(slot2, repIt->second,
+ mSpriteColors[slot2],
+ 1, false, true);
+ }
+ }
}
}
}