mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +02:00
Don't send loading updates too frequently
This commit is contained in:
parent
937935ce8c
commit
cda4ae84aa
@ -282,14 +282,19 @@ bool CVCMIServer::prepareToStartGame()
|
||||
Load::ProgressAccumulator progressTracking;
|
||||
Load::Progress current(1);
|
||||
progressTracking.include(current);
|
||||
Load::Type currentProgress = std::numeric_limits<Load::Type>::max();
|
||||
|
||||
auto progressTrackingThread = boost::thread([this, &progressTracking]()
|
||||
auto progressTrackingThread = boost::thread([this, &progressTracking, ¤tProgress]()
|
||||
{
|
||||
while(!progressTracking.finished())
|
||||
{
|
||||
std::unique_ptr<LobbyLoadProgress> loadProgress(new LobbyLoadProgress);
|
||||
loadProgress->progress = progressTracking.get();
|
||||
addToAnnounceQueue(std::move(loadProgress));
|
||||
if(progressTracking.get() != currentProgress)
|
||||
{
|
||||
currentProgress = progressTracking.get();
|
||||
std::unique_ptr<LobbyLoadProgress> loadProgress(new LobbyLoadProgress);
|
||||
loadProgress->progress = currentProgress;
|
||||
addToAnnounceQueue(std::move(loadProgress));
|
||||
}
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user