fix(Core\OpCode): HandleFarSightOpcode (#9965)
* Change TO ThreadUNSAFE This will process the far sight packet as a is not thread-safe - process it in World::UpdateSessions() compared to the former packet is thread-safe - process it in Map::Update(). This matches up with tc in everything we have with the HandleFarSightOpcode. * Further Adjustments * Move to Debug Loggin TC has it as move to Debug Logging. Stating its a weird opcode handling issue which is not really known why.
This commit is contained in:
@@ -12385,13 +12385,6 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
// target must be in world
|
||||
if (!target->IsInWorld())
|
||||
return;
|
||||
|
||||
if (!IsInWorld() || IsDuringRemoveFromWorld())
|
||||
return;
|
||||
|
||||
LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId());
|
||||
|
||||
if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
|
||||
@@ -12405,6 +12398,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
((Unit*)target)->AddPlayerToVision(this);
|
||||
SetSeer(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -12413,15 +12407,18 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
|
||||
|
||||
LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str());
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
((Unit*)target)->RemovePlayerFromVision(this);
|
||||
|
||||
if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
|
||||
{
|
||||
LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (target->isType(TYPEMASK_UNIT) && !GetVehicle())
|
||||
static_cast<Unit*>(target)->RemovePlayerFromVision(this);
|
||||
|
||||
// must immediately set seer back otherwise may crash
|
||||
SetSeer(this);
|
||||
|
||||
//WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
|
||||
//GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -351,19 +351,6 @@ Unit::~Unit()
|
||||
ASSERT(!m_attacking);
|
||||
ASSERT(m_attackers.empty());
|
||||
|
||||
// pussywizard: clear m_sharedVision along with back references
|
||||
if (!m_sharedVision.empty())
|
||||
{
|
||||
LOG_INFO("misc", "Unit::~Unit (B1)");
|
||||
do
|
||||
{
|
||||
LOG_INFO("misc", "Unit::~Unit (B2)");
|
||||
Player* p = *(m_sharedVision.begin());
|
||||
p->m_isInSharedVisionOf.erase(this);
|
||||
m_sharedVision.erase(p);
|
||||
} while (!m_sharedVision.empty());
|
||||
}
|
||||
|
||||
ASSERT(m_Controlled.empty());
|
||||
ASSERT(m_appliedAuras.empty());
|
||||
ASSERT(m_ownedAuras.empty());
|
||||
@@ -10624,15 +10611,13 @@ void Unit::AddPlayerToVision(Player* player)
|
||||
setActive(true);
|
||||
SetWorldObject(true);
|
||||
}
|
||||
m_sharedVision.insert(player);
|
||||
player->m_isInSharedVisionOf.insert(this);
|
||||
m_sharedVision.push_back(player);
|
||||
}
|
||||
|
||||
// only called in Player::SetSeer
|
||||
void Unit::RemovePlayerFromVision(Player* player)
|
||||
{
|
||||
m_sharedVision.erase(player);
|
||||
player->m_isInSharedVisionOf.erase(this);
|
||||
m_sharedVision.remove(player);
|
||||
if (m_sharedVision.empty())
|
||||
{
|
||||
setActive(false);
|
||||
|
||||
@@ -1196,7 +1196,7 @@ struct UnitActionBarEntry
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<Player*> SharedVisionList;
|
||||
typedef std::list<Player*> SharedVisionList;
|
||||
|
||||
enum CharmType
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user