mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7826] Avoid use GetDistance* that used slow sqrt call where possible, other related speedups.
This commit is contained in:
parent
ff80f14d2d
commit
788cdf9b3a
21 changed files with 158 additions and 93 deletions
|
|
@ -567,7 +567,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
continue;
|
||||
if ( i->AllowedForPlayer(member) )
|
||||
{
|
||||
if (member->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (member->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
{
|
||||
r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
|
|
@ -617,7 +617,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
|
||||
if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) )
|
||||
{
|
||||
if (playerToRoll->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (playerToRoll->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
{
|
||||
r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
|
|
@ -665,7 +665,7 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
|
|||
if (!looter->IsInWorld())
|
||||
continue;
|
||||
|
||||
if (looter->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
{
|
||||
data << looter->GetGUID();
|
||||
++real_count;
|
||||
|
|
@ -677,7 +677,7 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
|
|||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *looter = itr->getSource();
|
||||
if (looter->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
looter->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -1334,7 +1334,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
// not update if only update if need and ok
|
||||
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
|
||||
if(looter && looter->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if(looter && looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
return;
|
||||
}
|
||||
++guid_itr;
|
||||
|
|
@ -1347,7 +1347,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
{
|
||||
if (pl->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
{
|
||||
bool refresh = pl->GetLootGUID()==creature->GetGUID();
|
||||
|
||||
|
|
@ -1368,7 +1368,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
{
|
||||
if (pl->GetDistance2d(creature) < sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE))
|
||||
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
{
|
||||
bool refresh = pl->GetLootGUID()==creature->GetGUID();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue