summaryrefslogtreecommitdiff
path: root/src/resources/db/sounddb.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 18:19:20 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 18:19:20 +0300
commitf55d6f7c27db71b7327d4de4ee294bcaf7b82f6b (patch)
treea65ae6d75b7cf43eab60fc7ede6cb8a2cc722f33 /src/resources/db/sounddb.cpp
parentd8f56c2b9a68de7bba8f5848b126bd25741eb494 (diff)
downloadplus-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.gz
plus-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.bz2
plus-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.tar.xz
plus-f55d6f7c27db71b7327d4de4ee294bcaf7b82f6b.zip
add support for include in sounds.xml.
Diffstat (limited to 'src/resources/db/sounddb.cpp')
-rw-r--r--src/resources/db/sounddb.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp
index 639156909..ca7d0d654 100644
--- a/src/resources/db/sounddb.cpp
+++ b/src/resources/db/sounddb.cpp
@@ -37,8 +37,12 @@ namespace
void SoundDB::load()
{
unload();
+ loadXmlFile(paths.getStringValue("soundsFile"));
+}
- XML::Document *doc = new XML::Document(paths.getStringValue("soundsFile"));
+void SoundDB::loadXmlFile(const std::string &fileName)
+{
+ XML::Document *doc = new XML::Document(fileName);
const XmlNodePtr root = doc->rootNode();
if (!root || !xmlNameEqual(root, "sounds"))
@@ -49,7 +53,14 @@ void SoundDB::load()
for_each_xml_child_node(node, root)
{
- if (xmlNameEqual(node, "sound"))
+ if (xmlNameEqual(node, "include"))
+ {
+ const std::string name = XML::getProperty(node, "name", "");
+ if (!name.empty())
+ loadXmlFile(name);
+ continue;
+ }
+ else if (xmlNameEqual(node, "sound"))
{
const std::string name = XML::getProperty(node, "name", "");
const int id = NotifyManager::getIndexBySound(name);