mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-11-10 21:04:26 +08:00
Merge branch 'master' into Fix-the-crash-2
This commit is contained in:
commit
7952f5105c
@ -1095,23 +1095,45 @@ void WorldObject::SetVisibilityDistanceOverride(VisibilityDistanceType type)
|
||||
if (type == GetVisibilityOverrideType())
|
||||
return;
|
||||
|
||||
if (IsPlayer())
|
||||
if (!IsCreature() && !IsGameObject() && !IsDynamicObject())
|
||||
return;
|
||||
|
||||
if (IsVisibilityOverridden())
|
||||
{
|
||||
if (IsFarVisible())
|
||||
GetMap()->RemoveWorldObjectFromFarVisibleMap(this);
|
||||
else if (IsZoneWideVisible())
|
||||
GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(GetZoneId(), this);
|
||||
}
|
||||
|
||||
if (type == VisibilityDistanceType::Large || type == VisibilityDistanceType::Gigantic)
|
||||
GetMap()->AddWorldObjectToFarVisibleMap(this);
|
||||
else if (type == VisibilityDistanceType::Infinite)
|
||||
GetMap()->AddWorldObjectToZoneWideVisibleMap(GetZoneId(), this);
|
||||
// Important to remove from old visibility override containers first
|
||||
RemoveFromMapVisibilityOverrideContainers();
|
||||
|
||||
// Always update _visibilityDistanceOverrideType, even when not in world
|
||||
_visibilityDistanceOverrideType = type;
|
||||
|
||||
// Finally, add to new visibility override containers
|
||||
AddToMapVisibilityOverrideContainers();
|
||||
}
|
||||
|
||||
void WorldObject::RemoveFromMapVisibilityOverrideContainers()
|
||||
{
|
||||
if (!IsVisibilityOverridden())
|
||||
return;
|
||||
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
if (IsFarVisible())
|
||||
GetMap()->RemoveWorldObjectFromFarVisibleMap(this);
|
||||
else if (IsZoneWideVisible())
|
||||
GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(_zoneId, this);
|
||||
}
|
||||
|
||||
void WorldObject::AddToMapVisibilityOverrideContainers()
|
||||
{
|
||||
if (!IsVisibilityOverridden())
|
||||
return;
|
||||
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
if (IsFarVisible())
|
||||
GetMap()->AddWorldObjectToFarVisibleMap(this);
|
||||
else if (IsZoneWideVisible())
|
||||
GetMap()->AddWorldObjectToZoneWideVisibleMap(_zoneId, this);
|
||||
}
|
||||
|
||||
void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
|
||||
@ -1177,6 +1199,9 @@ void WorldObject::AddToWorld()
|
||||
Object::AddToWorld();
|
||||
GetMap()->GetZoneAndAreaId(GetPhaseMask(), _zoneId, _areaId, GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
GetMap()->AddObjectToPendingUpdateList(this);
|
||||
|
||||
if (IsZoneWideVisible())
|
||||
GetMap()->AddWorldObjectToZoneWideVisibleMap(_zoneId, this);
|
||||
}
|
||||
|
||||
void WorldObject::RemoveFromWorld()
|
||||
@ -1184,8 +1209,7 @@ void WorldObject::RemoveFromWorld()
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
if (IsZoneWideVisible())
|
||||
GetMap()->RemoveWorldObjectFromZoneWideVisibleMap(GetZoneId(), this);
|
||||
RemoveFromMapVisibilityOverrideContainers();
|
||||
|
||||
DestroyForVisiblePlayers();
|
||||
|
||||
|
||||
@ -780,6 +780,9 @@ private:
|
||||
//bool CanDetectStealthOf(WorldObject const* obj) const;
|
||||
bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const;
|
||||
|
||||
void RemoveFromMapVisibilityOverrideContainers();
|
||||
void AddToMapVisibilityOverrideContainers();
|
||||
|
||||
GuidUnorderedSet _allowedLooters;
|
||||
|
||||
ObjectVisibilityContainer _objectVisibilityContainer;
|
||||
|
||||
@ -422,7 +422,9 @@ void Map::UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone)
|
||||
else
|
||||
--oldZoneCount;
|
||||
}
|
||||
++_zonePlayerCountMap[newZone];
|
||||
|
||||
if (newZone != MAP_INVALID_ZONE)
|
||||
++_zonePlayerCountMap[newZone];
|
||||
}
|
||||
|
||||
void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
|
||||
@ -696,8 +698,8 @@ struct ResetNotifier
|
||||
|
||||
void Map::RemovePlayerFromMap(Player* player, bool remove)
|
||||
{
|
||||
// Before leaving map, update zone/area for stats
|
||||
player->UpdateZone(MAP_INVALID_ZONE, 0);
|
||||
UpdatePlayerZoneStats(player->GetZoneId(), MAP_INVALID_ZONE);
|
||||
|
||||
player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix
|
||||
|
||||
player->RemoveFromWorld();
|
||||
@ -725,8 +727,6 @@ void Map::RemoveFromMap(T* obj, bool remove)
|
||||
obj->RemoveFromWorld();
|
||||
|
||||
obj->RemoveFromGrid();
|
||||
if (obj->IsFarVisible())
|
||||
RemoveWorldObjectFromFarVisibleMap(obj);
|
||||
|
||||
obj->ResetMap();
|
||||
|
||||
|
||||
@ -100,8 +100,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
canFly = handler->GetSession()->GetPlayer()->CanFly();
|
||||
target->SetCanFly(!canFly);
|
||||
canFly = !handler->GetSession()->GetPlayer()->CanFly();
|
||||
target->SetCanFly(canFly);
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target), canFly ? "on" : "off");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user