summaryrefslogtreecommitdiff
path: root/src/itemsoundmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
commitc649cf883480071c9b93909c4ea4ee5ec98155b2 (patch)
tree71022fd2db59c643c19c78c5524ffcd038e35a7f /src/itemsoundmanager.cpp
parent4cab6fc78e19799f223d951d5ccc9afb303b65f2 (diff)
downloadmanaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.gz
manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.bz2
manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.xz
manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.zip
Remove some duplicate code.
Diffstat (limited to 'src/itemsoundmanager.cpp')
-rw-r--r--src/itemsoundmanager.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/itemsoundmanager.cpp b/src/itemsoundmanager.cpp
index 5206273a7..71fc015bf 100644
--- a/src/itemsoundmanager.cpp
+++ b/src/itemsoundmanager.cpp
@@ -41,16 +41,7 @@ void ItemSoundManager::playSfx(const Item *const item,
void ItemSoundManager::playSfx(const int itemId,
const ItemSoundEvent::Type sound)
{
- const ItemInfo &info = ItemDB::get(itemId);
- std::string sfx = info.getSound(sound).sound;
- if (sfx.empty())
- {
- // fallback to player race sound if no item sound.
- const int id = -100 - player_node->getSubType();
- const ItemInfo &info2 = ItemDB::get(id);
- sfx = info2.getSound(sound).sound;
- }
- soundManager.playGuiSfx(sfx);
+ playSfx(ItemDB::get(itemId), sound);
}
void ItemSoundManager::playSfx(const FloorItem *const item,
@@ -58,7 +49,12 @@ void ItemSoundManager::playSfx(const FloorItem *const item,
{
if (!item)
return;
- const ItemInfo &info = ItemDB::get(item->getItemId());
+ playSfx(ItemDB::get(item->getItemId()), sound);
+}
+
+void ItemSoundManager::playSfx(const ItemInfo &info,
+ const ItemSoundEvent::Type sound)
+{
std::string sfx = info.getSound(sound).sound;
if (sfx.empty())
{