Skip to content

Commit

Permalink
use ccinteger in leaderboard loading code
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Aug 24, 2023
1 parent 44ca1af commit 4ad5a8e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/managers/BetterInfoOnline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ void BetterInfoOnline::loadScores(int accountID, bool force){
request->setRequestData(
postData->getCString(), strlen(postData->getCString())
);
request->setUserData((void*) accountID);
auto ccInt = CCInteger::create(accountID);
ccInt->retain();
request->setUserData(ccInt);
CCHttpClient::getInstance()->send(request);
//request->release();
}
Expand All @@ -46,7 +48,9 @@ void BetterInfoOnline::onScoresFinished(CCHttpClient* client, CCHttpResponse* re
gd::vector<char>* responseData = response->getResponseData();
std::string responseString(responseData->begin(), responseData->end());

int accountID = (int) (response->getHttpRequest()->getUserData());
auto ccInt = (CCInteger*) (response->getHttpRequest()->getUserData());
int accountID = ccInt->getValue();
ccInt->release();
generateScores(responseString, accountID);

sendScores(m_scoreDict[accountID], accountID);
Expand Down

0 comments on commit 4ad5a8e

Please sign in to comment.