Bulk load grids at repop and zone init instead of 2 costly individual selects per NPC, create repositories to decouple database logic from business logic

This commit is contained in:
Akkadius
2020-03-30 05:49:43 -05:00
parent 128cc458fd
commit 43716332aa
7 changed files with 298 additions and 40 deletions
+9
View File
@@ -1023,6 +1023,7 @@ bool Zone::Init(bool iStaticZone) {
LogInfo("Init Finished: ZoneID = [{}], Time Offset = [{}]", zoneid, zone->zone_time.getEQTimeZone());
LoadGrids();
LoadTickItems();
//MODDING HOOK FOR ZONE INIT
@@ -1610,6 +1611,8 @@ void Zone::Repop(uint32 delay)
if (!content_db.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion(), delay))
LogDebug("Error in Zone::Repop: database.PopulateZoneSpawnList failed");
LoadGrids();
initgrids_timer.Start();
entity_list.UpdateAllTraps(true, true);
@@ -2481,3 +2484,9 @@ void Zone::SetQuestHotReloadQueued(bool in_quest_hot_reload_queued)
{
quest_hot_reload_queued = in_quest_hot_reload_queued;
}
void Zone::LoadGrids()
{
grids = GridRepository::GetZoneGrids(GetZoneID());
grid_entries = GridEntriesRepository::GetZoneGridEntries(GetZoneID());
}