Skip to content

Commit

Permalink
these were out of place and it was making me mad
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 4, 2018
1 parent 4689f71 commit 7692d4e
Showing 1 changed file with 71 additions and 72 deletions.
143 changes: 71 additions & 72 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,77 @@ DownloadManager::UpdateOnlineScoreReplayData(const string& sk,
return;
}
void
UpdateReplayDataSequentially(deque<HighScore*> toUpload)
{
auto it = toUpload.begin();
if (it != toUpload.end()) {
toUpload.pop_front();
auto& hs = (*it);
DLMAN->UpdateOnlineScoreReplayData(hs->GetScoreKey(), [hs, toUpload]() {
hs->AddUploadedServer("nru");
UpdateReplayDataSequentially(toUpload);
});
}
return;
}
bool
DownloadManager::UpdateOnlineScoreReplayData()
{
if (!LoggedIn())
return false;
// we dont care if the chart is loaded for this function, only that there is
// a score that is already uploaded and already has replaydata, and that the
// source data is on disk to update it -mina
auto& scores = SCOREMAN->GetAllScores();
deque<HighScore*> toUpload;
for (auto& scorePtr : scores) {
auto ts = scorePtr->GetTopScore(); // still need to do this?
if ((ts == 1 || ts == 2)) {
if (scorePtr->HasReplayData() &&
scorePtr->IsUploadedToServer(serverURL.Get()) &&
!scorePtr->IsUploadedToServer("nru"))
toUpload.emplace_back(scorePtr);
}
}
UpdateReplayDataSequentially(toUpload);
return true;
}
void
uploadSequentially(deque<HighScore*> toUpload)
{
auto it = toUpload.begin();
if (it != toUpload.end()) {
toUpload.pop_front();
auto& hs = (*it);
DLMAN->UploadScoreWithReplayDataFromDisk(
hs->GetScoreKey(), [hs, toUpload]() {
hs->AddUploadedServer(serverURL.Get());
uploadSequentially(toUpload);
});
}
return;
}
bool
DownloadManager::UploadScores()
{
if (!LoggedIn())
return false;
auto scores = SCOREMAN->GetAllPBPtrs();
deque<HighScore*> toUpload;
for (auto& vec : scores) {
for (auto& scorePtr : vec) {
auto ts = scorePtr->GetTopScore();
if ((ts == 1 || ts == 2) &&
!scorePtr->IsUploadedToServer(serverURL.Get())) {
if (scorePtr->HasReplayData())
toUpload.emplace_back(scorePtr);
}
}
}
uploadSequentially(toUpload);
return true;
}
void
DownloadManager::EndSessionIfExists()
{
if (!LoggedIn())
Expand Down Expand Up @@ -1894,78 +1965,6 @@ DownloadManager::StartSession(string user,
curl_multi_add_handle(mHTTPHandle, req->handle);
HTTPRequests.push_back(req);
}

void
UpdateReplayDataSequentially(deque<HighScore*> toUpload)
{
auto it = toUpload.begin();
if (it != toUpload.end()) {
toUpload.pop_front();
auto& hs = (*it);
DLMAN->UpdateOnlineScoreReplayData(hs->GetScoreKey(), [hs, toUpload]() {
hs->AddUploadedServer("nru");
UpdateReplayDataSequentially(toUpload);
});
}
return;
}
bool
DownloadManager::UpdateOnlineScoreReplayData()
{
if (!LoggedIn())
return false;
// we dont care if the chart is loaded for this function, only that there is
// a score that is already uploaded and already has replaydata, and that the
// source data is on disk to update it -mina
auto& scores = SCOREMAN->GetAllScores();
deque<HighScore*> toUpload;
for (auto& scorePtr : scores) {
auto ts = scorePtr->GetTopScore(); // still need to do this?
if ((ts == 1 || ts == 2) ){
if (scorePtr->HasReplayData() &&
scorePtr->IsUploadedToServer(serverURL.Get()) &&
!scorePtr->IsUploadedToServer("nru"))
toUpload.emplace_back(scorePtr);
}
}
UpdateReplayDataSequentially(toUpload);
return true;
}
void
uploadSequentially(deque<HighScore*> toUpload)
{
auto it = toUpload.begin();
if (it != toUpload.end()) {
toUpload.pop_front();
auto& hs = (*it);
DLMAN->UploadScoreWithReplayDataFromDisk(
hs->GetScoreKey(), [hs, toUpload]() {
hs->AddUploadedServer(serverURL.Get());
uploadSequentially(toUpload);
});
}
return;
}
bool
DownloadManager::UploadScores()
{
if (!LoggedIn())
return false;
auto scores = SCOREMAN->GetAllPBPtrs();
deque<HighScore*> toUpload;
for (auto& vec : scores) {
for (auto& scorePtr : vec) {
auto ts = scorePtr->GetTopScore();
if ((ts == 1 || ts == 2) &&
!scorePtr->IsUploadedToServer(serverURL.Get())) {
if (scorePtr->HasReplayData())
toUpload.emplace_back(scorePtr);
}
}
}
uploadSequentially(toUpload);
return true;
}
int
DownloadManager::GetSkillsetRank(Skillset ss)
{
Expand Down

0 comments on commit 7692d4e

Please sign in to comment.