diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-20 00:25:42 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-20 00:25:42 +0200 |
commit | 3f00faa305201fabcc74e17dc24da4cefa9dbfa5 (patch) | |
tree | 460a7a06c97912e5ed9a525f01624748dd7a16a6 /src/resources | |
parent | da9ec0b7b8e061b3d3bf1d145284de9d778456c1 (diff) | |
download | plus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.gz plus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.bz2 plus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.tar.xz plus-3f00faa305201fabcc74e17dc24da4cefa9dbfa5.zip |
Fix some code style and some errors.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/itemdb.cpp | 4 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 3 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index d6be7eae0..418bfb848 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -560,7 +560,9 @@ void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode) void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode) { std::string removeSprite = XML::getProperty(replaceNode, "sprite", ""); - std::map<int,int> &mapList = itemInfo->addReplaceSprite(parseSpriteName(removeSprite)); + std::map<int, int> &mapList = itemInfo->addReplaceSprite( + parseSpriteName(removeSprite)); + itemInfo->setRemoveSprites(); for_each_xml_child_node(itemNode, replaceNode) diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 02c3c4d45..255a9a7b3 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -69,7 +69,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const return i == mSounds.end() ? empty : i->second[rand() % i->second.size()]; } -std::map<int,int> &ItemInfo::addReplaceSprite(int sprite) +std::map<int, int> &ItemInfo::addReplaceSprite(int sprite) { std::map<int, std::map<int, int> >::iterator it = mSpriteToItemReplaceMap.find(sprite); diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 05adb9215..5ea537fae 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -226,7 +226,7 @@ class ItemInfo int getReplaceToSpriteId(int id) const; - std::map<int,int> &addReplaceSprite(int sprite); + std::map<int, int> &addReplaceSprite(int sprite); std::map<int, std::map<int, int> > getSpriteToItemReplaceMap() const { return mSpriteToItemReplaceMap; } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 808615ae9..5a635a8c2 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -457,7 +457,10 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) unsigned char *charData = new unsigned char[len + 1]; const char *charStart = (const char*) xmlNodeGetContent(dataChild); if (!charStart) + { + delete charData; return; + } unsigned char *charIndex = charData; |