Skip to content

Commit

Permalink
dont update dlman or dl progress overlay during gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Nov 22, 2018
1 parent e0054b8 commit 01710d7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ local dltzoom = 0.5
-- download queue/progress
t[#t + 1] =
Def.ActorFrame {
PausingDownloadsMessageCommand=function(self)
self:visible(false)
end,
ResumingDownloadsMessageCommand=function(self)
self:visible(false)
end,
AllDownloadsCompletedMessageCommand = function(self)
self:visible(false)
end,
Expand Down
7 changes: 7 additions & 0 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ void
DownloadManager::UpdateDLSpeed(bool gameplay)
{
this->gameplay = gameplay;
if (gameplay)
MESSAGEMAN->Broadcast("PausingDownloads");
else
MESSAGEMAN->Broadcast("ResumingDownloads");

UpdateDLSpeed();
}

Expand Down Expand Up @@ -492,6 +497,8 @@ DownloadManager::Update(float fDeltaSeconds)
{
if (!initialized)
init();
if (gameplay)
return;
UpdatePacks(fDeltaSeconds);
UpdateHTTP(fDeltaSeconds);
return;
Expand Down
50 changes: 26 additions & 24 deletions src/ScreenInstallOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,34 +250,36 @@ ScreenInstallOverlay::Update(float fDeltaTime)
DoInstalls(args);
}
#if !defined(WITHOUT_NETWORKING)
static float lastDLProgressUpdate = 0;
lastDLProgressUpdate += fDeltaTime;
if (DLMAN->downloads.empty() || lastDLProgressUpdate < 0.5)
return;
lastDLProgressUpdate = 0;
Message msg("DLProgressAndQueueUpdate");
if (!DLMAN->gameplay) {
static float lastDLProgressUpdate = 0;
lastDLProgressUpdate += fDeltaTime;
if (DLMAN->downloads.empty() || lastDLProgressUpdate < 0.5)
return;
lastDLProgressUpdate = 0;
Message msg("DLProgressAndQueueUpdate");

vector<RString> dls;
for (auto& dl : DLMAN->downloads) {
dls.push_back(dl.second->Status());
}
msg.SetParam("dlsize", static_cast<int>(DLMAN->downloads.size()));
msg.SetParam("dlprogress", join("\n", dls));
vector<RString> dls;
for (auto& dl : DLMAN->downloads) {
dls.push_back(dl.second->Status());
}
msg.SetParam("dlsize", static_cast<int>(DLMAN->downloads.size()));
msg.SetParam("dlprogress", join("\n", dls));

if (!DLMAN->DownloadQueue.empty()) {
vector<RString> cue;
for (auto& q : DLMAN->DownloadQueue) {
cue.push_back(q.first->name);
if (!DLMAN->DownloadQueue.empty()) {
vector<RString> cue;
for (auto& q : DLMAN->DownloadQueue) {
cue.push_back(q.first->name);
}
msg.SetParam("queuesize",
static_cast<int>(DLMAN->DownloadQueue.size()));
msg.SetParam("queuedpacks", join("\n", cue));
} else {
msg.SetParam("queuesize", 0);
msg.SetParam("queuedpacks", RString(""));
}
msg.SetParam("queuesize",
static_cast<int>(DLMAN->DownloadQueue.size()));
msg.SetParam("queuedpacks", join("\n", cue));
} else {
msg.SetParam("queuesize", 0);
msg.SetParam("queuedpacks", RString(""));
MESSAGEMAN->Broadcast(msg);
}
MESSAGEMAN->Broadcast(msg);


#endif
}

Expand Down

0 comments on commit 01710d7

Please sign in to comment.