[7143] Avoid selection quest taxi nodes for taxi master map.

Preper at loading more stricted taxi nodes mask for normal taxi network
with excliuded quest only nodes (used from spells with SPELL_EFFECT_SEND_TAXI.
Use prepered mask at search nearest to taxi master taxi node.
This commit is contained in:
VladimirMangos 2009-01-22 05:09:43 +03:00
parent 6bdb95dfc3
commit 3afd542de2
3 changed files with 61 additions and 25 deletions

View file

@ -4767,24 +4767,31 @@ uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, u
for(uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
{
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
if(node && node->map_id == mapid && node->MountCreatureID[team == ALLIANCE ? 1 : 0])
if(!node || node->map_id != mapid || !node->MountCreatureID[team == ALLIANCE ? 1 : 0])
continue;
uint8 field = (uint8)((i - 1) / 32);
uint32 submask = 1<<((i-1)%32);
// skip not taxi network nodes
if((sTaxiNodesMask[field] & submask)==0)
continue;
float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z);
if(found)
{
float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z);
if(found)
if(dist2 < dist)
{
if(dist2 < dist)
{
dist = dist2;
id = i;
}
}
else
{
found = true;
dist = dist2;
id = i;
}
}
else
{
found = true;
dist = dist2;
id = i;
}
}
return id;