Fixed transport disappearing

This commit is contained in:
Yehonal
2017-11-25 01:58:45 +00:00
parent 3b22c59bec
commit 300847920a

View File

@@ -22675,19 +22675,30 @@ bool Player::IsVisibleGloballyFor(Player const* u) const
}
template<class T>
inline void UpdateVisibilityOf_helper(T* /*target*/, std::vector<Unit*>& /*v*/)
inline void UpdateVisibilityOf_helper(Player::ClientGUIDs& s64, T* target, std::vector<Unit*>& /*v*/)
{
s64.insert(target->GetGUID());
}
template<>
inline void UpdateVisibilityOf_helper(Creature* target, std::vector<Unit*>& v)
inline void UpdateVisibilityOf_helper(Player::ClientGUIDs& s64, GameObject* target, std::vector<Unit*>& /*v*/)
{
// @HACK: This is to prevent objects like deeprun tram from disappearing when player moves far from its spawn point while riding it
if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
s64.insert(target->GetGUID());
}
template<>
inline void UpdateVisibilityOf_helper(Player::ClientGUIDs& s64, Creature* target, std::vector<Unit*>& v)
{
s64.insert(target->GetGUID());
v.push_back(target);
}
template<>
inline void UpdateVisibilityOf_helper(Player* target, std::vector<Unit*>& v)
inline void UpdateVisibilityOf_helper(Player::ClientGUIDs& s64, Player* target, std::vector<Unit*>& v)
{
s64.insert(target->GetGUID());
v.push_back(target);
}
@@ -22801,9 +22812,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::vector<Unit*>&
if (CanSeeOrDetect(target, false, true))
{
target->BuildCreateUpdateBlockForPlayer(&data, this);
m_clientGUIDs.insert(target->GetGUID());
UpdateVisibilityOf_helper(target, visibleNow);
UpdateVisibilityOf_helper(m_clientGUIDs, target, visibleNow);
}
}
}