diff options
author | Louis Pearson <desttinghimgame@gmail.com> | 2017-04-27 06:33:59 -0500 |
---|---|---|
committer | Zeno- <kde.psych@gmail.com> | 2017-04-27 21:33:59 +1000 |
commit | 04ba2d2721e456aea2280dd9fa4bf6224f3656c8 (patch) | |
tree | fc8efdbaa8b4087344e4a2dd730e788ae18b58dc /src/game.cpp | |
parent | b82e5ec8804e9058b48f3d2a168a4c019a777055 (diff) | |
download | minetest-04ba2d2721e456aea2280dd9fa4bf6224f3656c8.tar.gz minetest-04ba2d2721e456aea2280dd9fa4bf6224f3656c8.tar.bz2 minetest-04ba2d2721e456aea2280dd9fa4bf6224f3656c8.zip |
Search user path for sounds (#5657)
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/game.cpp b/src/game.cpp index 97dc8c064..82bd440df 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -567,27 +567,35 @@ public: class GameOnDemandSoundFetcher: public OnDemandSoundFetcher { std::set<std::string> m_fetched; +private: + void paths_insert(std::set<std::string> &dst_paths, + const std::string &base, + const std::string &name) + { + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".0.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".1.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".2.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".3.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".4.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".5.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".6.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".7.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".8.ogg"); + dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".9.ogg"); + } public: void fetchSounds(const std::string &name, - std::set<std::string> &dst_paths, - std::set<std::string> &dst_datas) + std::set<std::string> &dst_paths, + std::set<std::string> &dst_datas) { if (m_fetched.count(name)) return; m_fetched.insert(name); - std::string base = porting::path_share + DIR_DELIM + "sounds"; - dst_paths.insert(base + DIR_DELIM + name + ".ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".0.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".1.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".2.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".3.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".4.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".5.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".6.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".7.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".8.ogg"); - dst_paths.insert(base + DIR_DELIM + name + ".9.ogg"); + + paths_insert(dst_paths, porting::path_share, name); + paths_insert(dst_paths, porting::path_user, name); } }; |