summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-16 23:06:58 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-18 21:31:52 +0300
commit67d3b8c193b51bbf892fd965547746511e8ddf87 (patch)
treeb11031d009c6df44263f0be9f01503fae2c09615 /src/resources/iteminfo.cpp
parent884c064f762c4d5ca23458ea43d9c34348259840 (diff)
downloadmv-67d3b8c193b51bbf892fd965547746511e8ddf87.tar.gz
mv-67d3b8c193b51bbf892fd965547746511e8ddf87.tar.bz2
mv-67d3b8c193b51bbf892fd965547746511e8ddf87.tar.xz
mv-67d3b8c193b51bbf892fd965547746511e8ddf87.zip
add delay to action sounds.
delay now unused.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 4ec5d81f9..a6372ca93 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -23,6 +23,7 @@
#include "resources/iteminfo.h"
#include "resources/itemdb.h"
+
#include "configuration.h"
#include "utils/dtor.h"
@@ -105,22 +106,24 @@ void ItemInfo::setAttackAction(const std::string &attackAction)
mAttackAction = attackAction;
}
-void ItemInfo::addSound(const EquipmentSoundEvent event,
- const std::string &filename)
+void ItemInfo::addSound(const SoundEvent event,
+ const std::string &filename, const int delay)
{
- mSounds[event].push_back(paths.getStringValue("sfx").append(filename));
+ mSounds[event].push_back(SoundInfo(
+ paths.getStringValue("sfx").append(filename), delay));
}
-const std::string &ItemInfo::getSound(const EquipmentSoundEvent event) const
+const SoundInfo &ItemInfo::getSound(const SoundEvent event) const
{
- static const std::string empty;
- std::map<EquipmentSoundEvent, StringVect>::const_iterator i;
+ static const SoundInfo empty("", 0);
+ std::map<SoundEvent, SoundInfoVect>::const_iterator i;
i = mSounds.find(event);
if (i == mSounds.end())
return empty;
- return (!i->second.empty()) ? i->second[rand() % i->second.size()] : empty;
+ return (!i->second.empty()) ? i->second[rand()
+ % i->second.size()] : empty;
}
std::map<int, int> *ItemInfo::addReplaceSprite(const int sprite,