mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
Fix navmesh cache progress bar jumps
When initial approximation of maximum progress based on numer of cells is too high comparing to real number of navmesh tiles.
This commit is contained in:
parent
cc97c4450a
commit
8fedca5780
1 changed files with 11 additions and 4 deletions
|
@ -457,11 +457,18 @@ void Launcher::DataFilesPage::updateNavMeshProgress()
|
||||||
QRegularExpressionMatch match = pattern.match(text);
|
QRegularExpressionMatch match = pattern.match(text);
|
||||||
if (!match.hasMatch())
|
if (!match.hasMatch())
|
||||||
return;
|
return;
|
||||||
int maximum = match.captured(2).toInt();
|
int value = match.captured(1).toInt();
|
||||||
|
const int maximum = match.captured(2).toInt();
|
||||||
if (text.contains("cell"))
|
if (text.contains("cell"))
|
||||||
maximum *= 100;
|
ui.navMeshProgressBar->setMaximum(maximum * 100);
|
||||||
ui.navMeshProgressBar->setMaximum(std::max(ui.navMeshProgressBar->maximum(), maximum));
|
else if (maximum > ui.navMeshProgressBar->maximum())
|
||||||
ui.navMeshProgressBar->setValue(match.captured(1).toInt());
|
ui.navMeshProgressBar->setMaximum(maximum);
|
||||||
|
else
|
||||||
|
value += static_cast<int>(std::round(
|
||||||
|
(ui.navMeshProgressBar->maximum() - maximum)
|
||||||
|
* (static_cast<float>(value) / static_cast<float>(maximum))
|
||||||
|
));
|
||||||
|
ui.navMeshProgressBar->setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::navMeshToolFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
void Launcher::DataFilesPage::navMeshToolFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||||
|
|
Loading…
Reference in a new issue