Search user path for sounds (#5657)
parent
b82e5ec880
commit
04ba2d2721
36
src/game.cpp
36
src/game.cpp
|
@ -567,27 +567,35 @@ public:
|
||||||
class GameOnDemandSoundFetcher: public OnDemandSoundFetcher
|
class GameOnDemandSoundFetcher: public OnDemandSoundFetcher
|
||||||
{
|
{
|
||||||
std::set<std::string> m_fetched;
|
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:
|
public:
|
||||||
void fetchSounds(const std::string &name,
|
void fetchSounds(const std::string &name,
|
||||||
std::set<std::string> &dst_paths,
|
std::set<std::string> &dst_paths,
|
||||||
std::set<std::string> &dst_datas)
|
std::set<std::string> &dst_datas)
|
||||||
{
|
{
|
||||||
if (m_fetched.count(name))
|
if (m_fetched.count(name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_fetched.insert(name);
|
m_fetched.insert(name);
|
||||||
std::string base = porting::path_share + DIR_DELIM + "sounds";
|
|
||||||
dst_paths.insert(base + DIR_DELIM + name + ".ogg");
|
paths_insert(dst_paths, porting::path_share, name);
|
||||||
dst_paths.insert(base + DIR_DELIM + name + ".0.ogg");
|
paths_insert(dst_paths, porting::path_user, name);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue