[Cleanup] Remove unused Grid methods (#3944)

# Notes
- Remove `AssignGrid()`, `GetGridType()`, `GetGridType2()`, and `GetWaypoints()` as they are unused.
This commit is contained in:
Alex King
2024-01-13 00:41:06 -05:00
committed by GitHub
parent d7dc717249
commit 47968774d9
3 changed files with 0 additions and 91 deletions
-71
View File
@@ -1067,77 +1067,6 @@ int ZoneDatabase::GetHighestGrid(uint32 zoneid) {
return Strings::ToInt(row[0]);
}
uint8 ZoneDatabase::GetGridType2(uint32 grid, uint16 zoneid) {
int type2 = 0;
std::string query = StringFormat("SELECT type2 FROM grid WHERE id = %i AND zoneid = %i", grid, zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
return 0;
}
if (results.RowCount() != 1)
return 0;
auto row = results.begin();
return Strings::ToInt(row[0]);
}
bool ZoneDatabase::GetWaypoints(uint32 grid, uint16 zoneid, uint32 num, wplist* wp) {
if (wp == nullptr)
return false;
std::string query = StringFormat("SELECT x, y, z, pause, heading FROM grid_entries "
"WHERE gridid = %i AND number = %i AND zoneid = %i", grid, num, zoneid);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowCount() != 1)
return false;
auto row = results.begin();
wp->x = Strings::ToFloat(row[0]);
wp->y = Strings::ToFloat(row[1]);
wp->z = Strings::ToFloat(row[2]);
wp->pause = Strings::ToInt(row[3]);
wp->heading = Strings::ToFloat(row[4]);
return true;
}
void ZoneDatabase::AssignGrid(Client *client, uint32 grid_id, uint32 entity_id) {
auto target_npc = entity_list.GetNPCByID(entity_id);
auto spawn2_id = target_npc ? target_npc->GetSpawnPointID() : 0;
if (spawn2_id) {
std::string query = fmt::format(
"UPDATE spawn2 SET pathgrid = {} WHERE id = {}",
grid_id,
spawn2_id
);
auto results = QueryDatabase(query);
if (!results.Success() || results.RowsAffected() != 1) {
return;
}
client->Message(
Chat::White,
fmt::format(
"{} (Spawn2 ID {}) will now use Grid ID {}.",
target_npc->GetCleanName(),
spawn2_id,
grid_id
).c_str()
);
}
}
/******************
* ModifyGrid - Either adds an empty grid, or removes a grid and all its waypoints, for a particular zone.
* remove: TRUE if we are deleting the specified grid, FALSE if we are adding it