Skip to content

Commit

Permalink
Merge pull request #16839 from chaodhib/spell_facing_fix
Browse files Browse the repository at this point in the history
Adjustments to spell facing
  • Loading branch information
Treeston committed Mar 29, 2016
2 parents 396498b + c136af8 commit 8a050c5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/server/game/Entities/Creature/Creature.cpp
Expand Up @@ -2786,17 +2786,17 @@ bool Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target)
)
)
{
const MapRefManager& mapPlayers = GetMap()->GetPlayers();
for (MapRefManager::const_iterator it = mapPlayers.begin(); it != mapPlayers.end(); ++it)
if (Player* player = (*it).GetSource())
std::list<Player*> playersNearby;
GetPlayerListInGrid(playersNearby, GetVisibilityRange());
for (Player* player : playersNearby)
{
// only update players that are known to the client (have already been created)
if (player->HaveAtClient(this))
{
// only update players that can both see us, and are actually in combat with us (this is a performance tradeoff)
if (player->CanSeeOrDetect(this, false, true) && IsInCombatWith(player))
{
SendUpdateToPlayer(player);
shouldDelay = true;
}
SendUpdateToPlayer(player);
shouldDelay = true;
}
}
if (shouldDelay)
shouldDelay = !(focusSpell->IsTriggered() || focusSpell->GetCastTime() || focusSpell->GetSpellInfo()->IsChanneled());

Expand Down
5 changes: 4 additions & 1 deletion src/server/game/Entities/Object/Object.cpp
Expand Up @@ -221,7 +221,10 @@ void Object::SendUpdateToPlayer(Player* player)
UpdateData upd;
WorldPacket packet;

BuildCreateUpdateBlockForPlayer(&upd, player);
if (player->HaveAtClient(this))
BuildValuesUpdateBlockForPlayer(&upd, player);
else
BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.cpp
Expand Up @@ -21942,7 +21942,7 @@ WorldLocation Player::GetStartPosition() const
return WorldLocation(mapId, info->positionX, info->positionY, info->positionZ, 0);
}

bool Player::HaveAtClient(WorldObject const* u) const
bool Player::HaveAtClient(Object const* u) const
{
return u == this || m_clientGUIDs.find(u->GetGUID()) != m_clientGUIDs.end();
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.h
Expand Up @@ -2097,7 +2097,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
// currently visible objects at player client
GuidUnorderedSet m_clientGUIDs;

bool HaveAtClient(WorldObject const* u) const;
bool HaveAtClient(Object const* u) const;

bool IsNeverVisible() const override;

Expand Down

0 comments on commit 8a050c5

Please sign in to comment.