From cf4145dad470ac146cfb3649d4682444c671f211 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Wed, 20 Aug 2014 13:02:27 -0700 Subject: [PATCH] LoadZoneFlags converted to QueryDatabase --- zone/zoning.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/zone/zoning.cpp b/zone/zoning.cpp index de1f73193..ae10ecf59 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -745,26 +745,17 @@ void Client::ClearZoneFlag(uint32 zone_id) { } void Client::LoadZoneFlags() { - char errbuf[MYSQL_ERRMSG_SIZE]; - char *query = 0; - MYSQL_RES *result; - MYSQL_ROW row; // Retrieve all waypoints for this grid - if(database.RunQuery(query,MakeAnyLenString(&query, - "SELECT zoneID from zone_flags WHERE charID=%d", - CharacterID()),errbuf,&result)) - { - while((row = mysql_fetch_row(result))) { - zone_flags.insert(atoi(row[0])); - } - mysql_free_result(result); - } - else // DB query error! - { - LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), errbuf); - } - safe_delete_array(query); + std::string query = StringFormat("SELECT zoneID from zone_flags WHERE charID=%d", CharacterID()); + auto results = database.QueryDatabase(query); + if (!results.Success()) { + LogFile->write(EQEMuLog::Error, "MySQL Error while trying to load zone flags for %s: %s", GetName(), results.ErrorMessage().c_str()); + return; + } + + for(auto row = results.begin(); row != results.end(); ++row) + zone_flags.insert(atoi(row[0])); } bool Client::HasZoneFlag(uint32 zone_id) const {