mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-24 14:06:22 +00:00
Create Flightmastercache to handle finding the nearest flight master. (#1979)
Refactor the flightmastercache the bots use for finding the nearest available flight master. I made a small change to how the original function worked by storing the database position for the flightmaster in the cache itself. This allows us to calculate the distance from bot before accessing the creature object, should be faster overall.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Define.h"
|
||||
#include "FleeManager.h"
|
||||
#include "FlightMasterCache.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -2002,14 +2003,12 @@ void RandomPlayerbotMgr::PrepareTeleportCache()
|
||||
bool forAlliance = !(entry->hostileMask & 2);
|
||||
if (tNpcflag & UNIT_NPC_FLAG_FLIGHTMASTER)
|
||||
{
|
||||
WorldPosition pos(mapId, x, y, z, orient);
|
||||
if (forHorde)
|
||||
{
|
||||
hordeFlightMasterCache.push_back(guid);
|
||||
}
|
||||
sFlightMasterCache->AddHordeFlightMaster(guid, pos);
|
||||
|
||||
if (forAlliance)
|
||||
{
|
||||
allianceFlightMasterCache.push_back(guid);
|
||||
}
|
||||
sFlightMasterCache->AddAllianceFlightMaster(guid, pos);
|
||||
}
|
||||
const AreaTableEntry* area = sAreaTableStore.LookupEntry(map->GetAreaId(PHASEMASK_NORMAL, x, y, z));
|
||||
uint32 zoneId = area->zone ? area->zone : area->ID;
|
||||
|
||||
Reference in New Issue
Block a user