Skip to content

Commit

Permalink
xrGame/MainMenu.cpp: replace std::for_each with range-based for
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Nov 11, 2018
1 parent 9d5e0fc commit 9ed96c5
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,15 @@ void CMainMenu::ReadTextureInfo()

const auto ParseFileSet = [&]()
{
/*
* Original CoP textures_descr
* loading time:
* Single-threaded ~80 ms
* Multi-threaded ~40 ms
* Just a bit of speedup
*/
// tbb::parallel_for_each(files, [](const FS_File& file) // Cause memory corruption (detected by Valgrind)
std::for_each(files.begin(), files.end(), [](const FS_File& file)
for (const auto& file : files)
{
string_path path, name;
_splitpath(file.name.c_str(), nullptr, path, name, nullptr);
xr_strcat(name, ".xml");
path[xr_strlen(path) - 1] = '\0'; // cut the latest '\\'

CUITextureMaster::ParseShTexInfo(path, name);
});
}
};

UpdateFileSet(UI_PATH_DEFAULT);
Expand Down

0 comments on commit 9ed96c5

Please sign in to comment.