Skip to content

Commit

Permalink
Fix score uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Nov 27, 2017
1 parent 71716fe commit 530a57d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ bool DownloadManager::ShouldUploadScores()
{
return LoggedIn() && automaticSync;
}
inline void SetCURLPOSTScore(CURL* curlHandle, curl_httppost* form, curl_httppost* lastPtr, HighScore* hs)
inline void SetCURLPOSTScore(CURL*& curlHandle, curl_httppost*& form, curl_httppost*& lastPtr, HighScore*& hs)
{
SetCURLFormPostField(curlHandle, form, lastPtr, "scorekey", hs->GetScoreKey());
FOREACH_ENUM(Skillset, ss)
Expand Down Expand Up @@ -585,15 +585,7 @@ void DownloadManager::UploadScore(HighScore* hs)
curl_httppost *form = nullptr;
curl_httppost *lastPtr = nullptr;
SetCURLPOSTScore(curlHandle, form, lastPtr, hs);
string replayString = "[";
vector<float> timestamps = hs->timeStamps;
vector<float> offsets = hs->GetOffsetVector();
for (int i = 0; i < offsets.size(); i++) {
replayString += "[" + to_string(timestamps[i]) + "," + to_string(1000.f * offsets[i]) + "],";
}
replayString = replayString.substr(0, replayString.size() - 1); //remove ","
replayString += "]";
SetCURLFormPostField(curlHandle, form, lastPtr, "replay_data", replayString);
CURLFormPostField(curlHandle, form, lastPtr, "replay_data", "");
SetCURLPostToURL(curlHandle, url);
AddSessionCookieToCURL(curlHandle);
curl_easy_setopt(curlHandle, CURLOPT_HTTPPOST, form);
Expand Down
2 changes: 1 addition & 1 deletion src/StageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static HighScore FillInHighScore(const PlayerStageStats &pss, const PlayerState
auto td = steps->GetTimingData();
SCOREMAN->SetAllTopScores(); // this is super lazy and a chart specific function should be made -mina
hs.timeStamps = td->ConvertReplayNoteRowsToTimestamps(pss.GetNoteRowVector(), hs.GetMusicRate());
DLMAN->UploadScore(&hs);
DLMAN->UploadScoreWithReplayData(&hs);
hs.timeStamps.clear();
hs.timeStamps.shrink_to_fit();
}
Expand Down

0 comments on commit 530a57d

Please sign in to comment.