mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9808] Simplify TaxiPathNodes data use, specially for transport case.
This commit is contained in:
parent
de3192b2f5
commit
4910add486
8 changed files with 29 additions and 92 deletions
|
|
@ -18209,32 +18209,32 @@ void Player::ContinueTaxiFlight()
|
|||
|
||||
float distPrev = MAP_SIZE*MAP_SIZE;
|
||||
float distNext =
|
||||
(nodeList[0].x-GetPositionX())*(nodeList[0].x-GetPositionX())+
|
||||
(nodeList[0].y-GetPositionY())*(nodeList[0].y-GetPositionY())+
|
||||
(nodeList[0].z-GetPositionZ())*(nodeList[0].z-GetPositionZ());
|
||||
(nodeList[0]->x-GetPositionX())*(nodeList[0]->x-GetPositionX())+
|
||||
(nodeList[0]->y-GetPositionY())*(nodeList[0]->y-GetPositionY())+
|
||||
(nodeList[0]->z-GetPositionZ())*(nodeList[0]->z-GetPositionZ());
|
||||
|
||||
for(uint32 i = 1; i < nodeList.size(); ++i)
|
||||
{
|
||||
TaxiPathNode const& node = nodeList[i];
|
||||
TaxiPathNode const& prevNode = nodeList[i-1];
|
||||
TaxiPathNodeEntry const* node = nodeList[i];
|
||||
TaxiPathNodeEntry const* prevNode = nodeList[i-1];
|
||||
|
||||
// skip nodes at another map
|
||||
if(node.mapid != GetMapId())
|
||||
if (node->mapid != GetMapId())
|
||||
continue;
|
||||
|
||||
distPrev = distNext;
|
||||
|
||||
distNext =
|
||||
(node.x-GetPositionX())*(node.x-GetPositionX())+
|
||||
(node.y-GetPositionY())*(node.y-GetPositionY())+
|
||||
(node.z-GetPositionZ())*(node.z-GetPositionZ());
|
||||
(node->x-GetPositionX())*(node->x-GetPositionX())+
|
||||
(node->y-GetPositionY())*(node->y-GetPositionY())+
|
||||
(node->z-GetPositionZ())*(node->z-GetPositionZ());
|
||||
|
||||
float distNodes =
|
||||
(node.x-prevNode.x)*(node.x-prevNode.x)+
|
||||
(node.y-prevNode.y)*(node.y-prevNode.y)+
|
||||
(node.z-prevNode.z)*(node.z-prevNode.z);
|
||||
(node->x-prevNode->x)*(node->x-prevNode->x)+
|
||||
(node->y-prevNode->y)*(node->y-prevNode->y)+
|
||||
(node->z-prevNode->z)*(node->z-prevNode->z);
|
||||
|
||||
if(distNext + distPrev < distNodes)
|
||||
if (distNext + distPrev < distNodes)
|
||||
{
|
||||
startNode = i;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue