mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
GetWaypoints converted to QueryDatabase
This commit is contained in:
parent
b654729383
commit
5f2db0d1cb
@ -1048,31 +1048,29 @@ uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp) {
|
bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp) {
|
||||||
char *query = 0;
|
|
||||||
char errbuff[MYSQL_ERRMSG_SIZE];
|
std::string query = StringFormat("SELECT x, y, z, pause, heading FROM grid_entries "
|
||||||
MYSQL_RES *result;
|
"WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid);
|
||||||
MYSQL_ROW row;
|
auto results = QueryDatabase(query);
|
||||||
if (RunQuery(query, MakeAnyLenString(&query,"SELECT x, y, z, pause, heading from grid_entries where gridid = %i and number = %i and zoneid = %i",grid,num,zoneid),errbuff,&result)) {
|
if (!results.Success()) {
|
||||||
safe_delete_array(query);
|
LogFile->write(EQEMuLog::Error, "Error in GetWaypoints query '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
if (mysql_num_rows(result) == 1) {
|
return false;
|
||||||
row = mysql_fetch_row(result);
|
}
|
||||||
if ( wp ) {
|
|
||||||
wp->x = atof( row[0] );
|
if (results.RowCount() != 1)
|
||||||
wp->y = atof( row[1] );
|
return false;
|
||||||
wp->z = atof( row[2] );
|
|
||||||
wp->pause = atoi( row[3] );
|
auto row = results.begin();
|
||||||
wp->heading = atof( row[4] );
|
|
||||||
}
|
if (wp) {
|
||||||
mysql_free_result(result);
|
wp->x = atof( row[0] );
|
||||||
return true;
|
wp->y = atof( row[1] );
|
||||||
}
|
wp->z = atof( row[2] );
|
||||||
mysql_free_result(result);
|
wp->pause = atoi( row[3] );
|
||||||
}
|
wp->heading = atof( row[4] );
|
||||||
else {
|
}
|
||||||
LogFile->write(EQEMuLog::Error, "Error in GetWaypoints query '%s': %s", query, errbuff);
|
|
||||||
safe_delete_array(query);
|
return true;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
void ZoneDatabase::AssignGrid(Client *client, float x, float y, uint32 grid)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user