Skip to content

Commit

Permalink
ShadowNinja Requested Changes (Comments, Cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
ExeVirus committed Jun 11, 2021
1 parent 3284247 commit 38839b4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion builtin/mainmenu/music_player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
local current_file = ""
local current_music_handle = nil

--stops current music, if not the same as the requested file, then plays the new file on repeat
-- Stops current music, if not the same as the requested file, then plays the new file on repeat
function menu_music_play(file)
if file ~= current_file then
if current_music_handle ~= nil then
Expand Down
6 changes: 3 additions & 3 deletions builtin/mainmenu/tab_local.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ if enable_gamebar then
if ("game_btnbar_" .. pkgmgr.games[j].id == key) then
mm_texture.update("singleplayer", pkgmgr.games[j])
core.set_topleft_text(pkgmgr.games[j].name)
--switch game theme, if found, and current game theme is not already playing
if(pkgmgr.games[j].id ~= core.settings:get("menu_last_game")) then
-- Switch game theme, if found, and current game theme is not already playing
if pkgmgr.games[j].id ~= core.settings:get("menu_last_game") then
menu_music_play(pkgmgr.games[j].path .. DIR_DELIM .. "menu" .. DIR_DELIM .. "theme")
end
core.settings:set("menu_last_game",pkgmgr.games[j].id)
Expand Down Expand Up @@ -312,7 +312,7 @@ if enable_gamebar then
menudata.worldlist:set_filtercriteria(game.id)
core.set_topleft_text(game.name)
mm_texture.update("singleplayer",game)
if(old_tab ~= new_tab) then
if old_tab ~= new_tab then
menu_music_play(game.path .. DIR_DELIM .. "menu" .. DIR_DELIM .. "theme")
end
end
Expand Down
13 changes: 6 additions & 7 deletions src/gui/guiEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,19 @@ void MenuMusicFetcher::fetchSounds(const std::string &name,
if(m_fetched.count(name))
return;
m_fetched.insert(name);
std::string base;
std::vector<fs::DirListNode> list;
base = porting::path_share + DIR_DELIM;
//Reusable local function
// Reusable local function
auto add_paths = [&dst_paths](const std::string name, const std::string base = "") {
dst_paths.insert(base + name + ".ogg");
for (int i = 0; i < 10; i++)
dst_paths.insert(base + name + "." + itos(i) +
".ogg");
};
add_paths(name, base + "sounds" + DIR_DELIM);
add_paths(name);
base = porting::path_user + DIR_DELIM;
add_paths(name, base + "sounds" + DIR_DELIM);
std::string share_prefix = porting::path_share + DIR_DELIM;
add_paths(name, share_prefix + "sounds" + DIR_DELIM);
std::string user_prefix = porting::path_user + DIR_DELIM;
add_paths(name, user_prefix + "sounds" + DIR_DELIM);
// Allow for absolute paths
add_paths(name);
}

Expand Down

0 comments on commit 38839b4

Please sign in to comment.