Skip to content

Commit

Permalink
fix std::stoi usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvolton committed Dec 2, 2024
1 parent 5eee766 commit d4db7ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/managers/BetterInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ void BetterInfoCache::cacheRatedListsFromMegaResponse(const std::string& megaRes
while(getline(userStream, currentUser, '|')) {
auto info = utils::string::split(currentUser, ":");

int userID = std::stoi(info[0]);
int accountID = std::stoi(info[2]);
int userID = BetterInfo::stoi(info[0]);
int accountID = BetterInfo::stoi(info[2]);

if(userID > 0) GLM->storeUserName(userID, accountID, info[1]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ void BetterInfo::loadImportantNotices(Ref<CCLayer> layer) {
biCache->cacheVaultCode(value.getKey().value_or(""), value.asString().unwrap());
}

if(auto res = info["additional"]["rated_lists"]["content"].asString()) {
if(auto res = info["additional"]["rated_lists_test"]["content"].asString()) {
log::debug("Attempting to cache rated lists from megaresponse");
biCache->cacheRatedListsFromMegaResponse(res.unwrap());
} else {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/ServerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void ServerUtils::getLevelLists(GJSearchObject* searchObject, std::function<void

if(!response->ok()) {
if(response->header("retry-after").has_value()) {
showRateLimitError(std::stoi(response->header("retry-after").value()));
showRateLimitError(BetterInfo::stoi(response->header("retry-after").value()));
} else {
showCFError(response->string().unwrapOr(""));
}
Expand Down Expand Up @@ -172,8 +172,8 @@ void ServerUtils::getLevelLists(GJSearchObject* searchObject, std::function<void
while(getline(userStream, currentUser, '|')) {
auto info = utils::string::split(currentUser, ":");

int userID = std::stoi(info[0]);
int accountID = std::stoi(info[2]);
int userID = BetterInfo::stoi(info[0]);
int accountID = BetterInfo::stoi(info[2]);

if(userID > 0) GLM->storeUserName(userID, accountID, info[1]);
}
Expand Down Expand Up @@ -258,7 +258,7 @@ void ServerUtils::getOnlineLevels(GJSearchObject* searchObject, std::function<vo

if(!response->ok()) {
if(response->header("retry-after").has_value()) {
showRateLimitError(std::stoi(response->header("retry-after").value()));
showRateLimitError(BetterInfo::stoi(response->header("retry-after").value()));
} else {
showCFError(response->string().unwrapOr(""));
}
Expand Down Expand Up @@ -303,8 +303,8 @@ void ServerUtils::getOnlineLevels(GJSearchObject* searchObject, std::function<vo
while(getline(userStream, currentUser, '|')) {
auto info = utils::string::split(currentUser, ":");

int userID = std::stoi(info[0]);
int accountID = std::stoi(info[2]);
int userID = BetterInfo::stoi(info[0]);
int accountID = BetterInfo::stoi(info[2]);

if(userID > 0) GameLevelManager::sharedState()->storeUserName(userID, accountID, info[1]);
}
Expand Down

0 comments on commit d4db7ab

Please sign in to comment.