diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 90b4773f1..f0a04515b 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -348,37 +348,40 @@ void ZoneDatabase::UpdateBug(PetitionBug_Struct* bug){ } -bool ZoneDatabase::GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin, char* account_name, uint32* lsaccountid, uint8* gmspeed, bool* revoked,bool* gmhideme, uint32* account_creation) { - MYSQL_ROW row; - if (mysql_num_rows(result) == 1) { - row = mysql_fetch_row(result); - if (admin) - *admin = atoi(row[0]); - if (account_name) - strcpy(account_name, row[1]); - if (lsaccountid) { +bool ZoneDatabase::GetAccountInfoForLogin_result(MySQLRequestResult results, int16* admin, char* account_name, uint32* lsaccountid, uint8* gmspeed, bool* revoked,bool* gmhideme, uint32* account_creation) { - if (row[2]) - *lsaccountid = atoi(row[2]); - else - *lsaccountid = 0; + if (results.RowCount() != 1) + return false; + auto row = results.begin(); - } - if (gmspeed) - *gmspeed = atoi(row[3]); - if (revoked) - *revoked = atoi(row[4]); - if(gmhideme) - *gmhideme = atoi(row[5]); - if(account_creation) - *account_creation = atoul(row[6]); + if (admin) + *admin = atoi(row[0]); + + if (account_name) + strcpy(account_name, row[1]); + + if (lsaccountid) { + if (row[2]) + *lsaccountid = atoi(row[2]); + else + *lsaccountid = 0; + } + + if (gmspeed) + *gmspeed = atoi(row[3]); + + if (revoked) + *revoked = atoi(row[4]); + + if(gmhideme) + *gmhideme = atoi(row[5]); + + if(account_creation) + *account_creation = atoul(row[6]); + + return true; - return true; - } - else { - return false; - } } diff --git a/zone/zonedb.h b/zone/zonedb.h index dae8c6490..3e5785987 100644 --- a/zone/zonedb.h +++ b/zone/zonedb.h @@ -246,7 +246,7 @@ public: /* * General Character Related Stuff */ - bool GetAccountInfoForLogin_result(MYSQL_RES* result, int16* admin = 0, char* account_name = 0, + bool GetAccountInfoForLogin_result(MySQLRequestResult results, int16* admin = 0, char* account_name = 0, uint32* lsaccountid = 0, uint8* gmspeed = 0, bool* revoked = 0, bool* gmhideme = nullptr, uint32* account_creation = 0); bool GetCharacterInfoForLogin_result(MYSQL_RES* result, uint32* character_id = 0, char* current_zone = 0,