summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/sounddb.cpp15
-rw-r--r--src/resources/db/sounddb.h2
2 files changed, 15 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);
diff --git a/src/resources/db/sounddb.h b/src/resources/db/sounddb.h
index 3c421ca62..5d1361088 100644
--- a/src/resources/db/sounddb.h
+++ b/src/resources/db/sounddb.h
@@ -29,6 +29,8 @@ namespace SoundDB
{
void load();
+ void loadXmlFile(const std::string &fileName);
+
void unload();
std::string &getSound(const int id);