Merge with develop

This commit is contained in:
kervala 2016-02-06 00:24:44 +01:00
parent 4bfacefdd8
commit 93a0e60b59
2 changed files with 10 additions and 9 deletions

View file

@ -678,12 +678,9 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix())); if (CFile::isDirectory(getRyzomSharePrefix())) directoryPrefixes.push_back(CPath::standardizePath(getRyzomSharePrefix()));
#endif #endif
std::vector<std::string> directoriesToProcess; std::map<std::string, sint> directoriesToProcess;
// reserve maximum memory space for all combinations // first pass, build a map with all existing directories to process in second pass
directoriesToProcess.reserve(directoryPrefixes.size() * paths.size());
// first pass, build a vector with all existing directories to process in second pass
for (uint j = 0; j < directoryPrefixes.size(); j++) for (uint j = 0; j < directoryPrefixes.size(); j++)
{ {
std::string directoryPrefix = directoryPrefixes[j]; std::string directoryPrefix = directoryPrefixes[j];
@ -698,15 +695,17 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
// only process existing directories // only process existing directories
if (CFile::isExists(directory)) if (CFile::isExists(directory))
directoriesToProcess.push_back(directory); directoriesToProcess[directory] = 1;
} }
} }
uint total = (uint)directoriesToProcess.size(); uint total = (uint)directoriesToProcess.size();
uint current = 0, next = 0; uint current = 0, next = 0;
std::map<std::string, sint>::const_iterator it = directoriesToProcess.begin(), iend = directoriesToProcess.end();
// second pass, add search paths // second pass, add search paths
for (uint i = 0, len = directoriesToProcess.size(); i < len; ++i) while (it != iend)
{ {
// update next progress value // update next progress value
++next; ++next;
@ -717,9 +716,11 @@ static void addPaths(IProgressCallback &progress, const std::vector<std::string>
// next is current value // next is current value
current = next; current = next;
CPath::addSearchPath(directoriesToProcess[i], recurse, false, &progress); CPath::addSearchPath(it->first, recurse, false, &progress);
progress.popCropedValues(); progress.popCropedValues();
++it;
} }
} }

View file

@ -112,7 +112,7 @@ bool InitMouseWithCursor (bool hardware)
} }
else if (width != 0 && height != 0) else if (width != 0 && height != 0)
{ {
nlwarning("mouse pos %u, %u", x, y); nlwarning("Mouse pos %f, %f", x, y);
Driver->setMousePos(x / width, y / height); Driver->setMousePos(x / width, y / height);
} }
} }