summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-10-23 08:02:22 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-10-23 08:02:22 +0000
commit8eda6c18fd391e34f180aaece96140a374f274f9 (patch)
tree9598ebf5280790951b30befe9c84d4bba57198e4 /src/resources/iteminfo.cpp
parentc9f618b5c50f759cf172d8e37063ef56e05812cf (diff)
downloadmana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.gz
mana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.bz2
mana-8eda6c18fd391e34f180aaece96140a374f274f9.tar.xz
mana-8eda6c18fd391e34f180aaece96140a374f274f9.zip
Merged changesets 3653, 3655-3657, 3659-3560, 3671-3672 from trunk to
0.0. Mostly memory leak fixes by Guillaume.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index b5b25ac0..3b32ec71 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -103,22 +103,16 @@ ItemInfo::setAttackType(const std::string &attackType)
void
ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)
{
- if (mSounds.find(event) == mSounds.end())
- {
- mSounds[event] = new std::vector<std::string>;
- }
-
- mSounds[event]->push_back("sfx/" + filename);
+ mSounds[event].push_back("sfx/" + filename);
}
const std::string&
ItemInfo::getSound(EquipmentSoundEvent event) const
{
- static const std::string empty = "";
- std::map<EquipmentSoundEvent, std::vector<std::string>*>::const_iterator i;
+ static const std::string empty;
+ std::map< EquipmentSoundEvent, std::vector<std::string> >::const_iterator i;
i = mSounds.find(event);
- return (i == mSounds.end()) ? empty :
- i->second->at(rand() % i->second->size());
+ return i == mSounds.end() ? empty : i->second[rand() % i->second.size()];
}