summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
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()];
}