mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
GetHighestWaypoint converted to QueryDatabase
This commit is contained in:
parent
2f30488cd5
commit
fe718a81f3
@ -1334,26 +1334,20 @@ uint32 ZoneDatabase::GetFreeGrid(uint16 zoneid) {
|
||||
}
|
||||
|
||||
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
|
||||
char *query = 0;
|
||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
int res = 0;
|
||||
if (RunQuery(query, MakeAnyLenString(&query,
|
||||
"SELECT COALESCE(MAX(number), 0) FROM grid_entries WHERE zoneid = %i AND gridid = %i",
|
||||
zoneid, gridid),errbuff,&result)) {
|
||||
safe_delete_array(query);
|
||||
if (mysql_num_rows(result) == 1) {
|
||||
row = mysql_fetch_row(result);
|
||||
res = atoi( row[0] );
|
||||
}
|
||||
mysql_free_result(result);
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query, errbuff);
|
||||
safe_delete_array(query);
|
||||
|
||||
std::string query = StringFormat("SELECT COALESCE(MAX(number), 0) FROM grid_entries "
|
||||
"WHERE zoneid = %i AND gridid = %i", zoneid, gridid);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(res);
|
||||
if (results.RowCount() != 1)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
void NPC::SaveGuardSpotCharm()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user