mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21: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) {
|
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, uint32 gridid) {
|
||||||
char *query = 0;
|
|
||||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT COALESCE(MAX(number), 0) FROM grid_entries "
|
||||||
MYSQL_RES *result;
|
"WHERE zoneid = %i AND gridid = %i", zoneid, gridid);
|
||||||
MYSQL_ROW row;
|
auto results = QueryDatabase(query);
|
||||||
int res = 0;
|
if (!results.Success()) {
|
||||||
if (RunQuery(query, MakeAnyLenString(&query,
|
LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
"SELECT COALESCE(MAX(number), 0) FROM grid_entries WHERE zoneid = %i AND gridid = %i",
|
return 0;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(res);
|
if (results.RowCount() != 1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NPC::SaveGuardSpotCharm()
|
void NPC::SaveGuardSpotCharm()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user