diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-02 17:23:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-02 17:23:32 +0300 |
commit | f89de74b1ac1cd9a02a70dab9221d601296da8cd (patch) | |
tree | 444451eb017720bdc1d3457e6e7976a84e065351 /src/resources | |
parent | c2748e2217f0ac69e2f06f39e6411f5e77c11974 (diff) | |
download | plus-f89de74b1ac1cd9a02a70dab9221d601296da8cd.tar.gz plus-f89de74b1ac1cd9a02a70dab9221d601296da8cd.tar.bz2 plus-f89de74b1ac1cd9a02a70dab9221d601296da8cd.tar.xz plus-f89de74b1ac1cd9a02a70dab9221d601296da8cd.zip |
Add intmap defines.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/itemdb.cpp | 14 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 6 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index da3444c0e..9de6b307e 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -589,11 +589,10 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum) itr_end = spriteToItems->end(); itr != itr_end; ++ itr) { const int remSprite = itr->first; - const std::map<int, int> &itemReplacer = itr->second; + const IntMap &itemReplacer = itr->second; logger->log("sprite: %d", remSprite); - for (std::map<int, int>::const_iterator - repIt = itemReplacer.begin(), + for (IntMapCIter repIt = itemReplacer.begin(), repIt_end = itemReplacer.end(); repIt != repIt_end; ++ repIt) { @@ -934,8 +933,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo, { // replace only given sprites for (int f = 0; f < 10; f ++) { - std::map<int, int> *const mapList - = itemInfo->addReplaceSprite( + IntMap *const mapList = itemInfo->addReplaceSprite( parseSpriteName(removeSprite), f); if (!mapList) continue; @@ -969,7 +967,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo, { const int from = XML::getProperty(itemNode, "from", 0); const int to = XML::getProperty(itemNode, "to", 1); - std::map<int, int> *mapList = itemInfo->addReplaceSprite( + IntMap *mapList = itemInfo->addReplaceSprite( parseSpriteName(removeSprite), SpriteDirection::DOWN); if (mapList) (*mapList)[from] = to; @@ -1002,7 +1000,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo, { const int from = XML::getProperty(itemNode, "from", 0); const int to = XML::getProperty(itemNode, "to", 1); - std::map<int, int> *mapList = itemInfo->addReplaceSprite( + IntMap *mapList = itemInfo->addReplaceSprite( parseSpriteName(removeSprite), SpriteDirection::UP); if (mapList) (*mapList)[from] = to; @@ -1022,7 +1020,7 @@ static void loadReplaceSprite(ItemInfo *const itemInfo, } default: { - std::map<int, int> *const mapList = itemInfo->addReplaceSprite( + IntMap *const mapList = itemInfo->addReplaceSprite( parseSpriteName(removeSprite), direction); if (!mapList) return; diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 56b2e1fe0..9e3e4acfa 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -165,8 +165,8 @@ const SoundInfo &ItemInfo::getSound(const ItemSoundEvent::Type event) const % i->second.size()] : empty; } -std::map<int, int> *ItemInfo::addReplaceSprite(const int sprite, - const int direction) +IntMap *ItemInfo::addReplaceSprite(const int sprite, + const int direction) { if (direction < 0 || direction >= 10) return nullptr; @@ -183,7 +183,7 @@ std::map<int, int> *ItemInfo::addReplaceSprite(const int sprite, SpriteToItemMap::iterator it = spMap->find(sprite); if (it == spMap->end()) { - std::map<int, int> tmp; + IntMap tmp; (*mSpriteToItemReplaceMap[direction])[sprite] = tmp; it = mSpriteToItemReplaceMap[direction]->find(sprite); } diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index ebc267e15..1233daf73 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -33,13 +33,15 @@ #include "resources/soundinfo.h" #include "resources/spritedisplay.h" +#include "utils/intmap.h" + namespace ColorDB { class ItemColorData; } // sprite, <itemfrom, itemto> -typedef std::map<int, std::map<int, int> > SpriteToItemMap; +typedef std::map<int, IntMap> SpriteToItemMap; typedef SpriteToItemMap::const_iterator SpriteToItemMapCIter; /** @@ -202,7 +204,7 @@ class ItemInfo final void setDrawPriority(const int direction, const int n); - const std::map<int, int> &getTags() const A_WARN_UNUSED + const IntMap &getTags() const A_WARN_UNUSED { return mTags; } void addTag(const int tag) @@ -239,8 +241,8 @@ class ItemInfo final int getReplaceToSpriteId(int id) const A_WARN_UNUSED; - std::map<int, int> *addReplaceSprite(const int sprite, - const int direction); + IntMap *addReplaceSprite(const int sprite, + const int direction); const SpriteToItemMap *getSpriteToItemReplaceMap(const int directions) const A_WARN_UNUSED; |