mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "GridNotifiers.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
@@ -26,9 +25,7 @@
|
||||
#include "Map.h"
|
||||
#include "Transports.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
||||
using namespace Trinity;
|
||||
|
||||
void
|
||||
VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
@@ -36,9 +33,7 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||
{
|
||||
if(iter->getSource() == &i_object)
|
||||
continue;
|
||||
|
||||
iter->getSource()->UpdateVisibilityOf(&i_object);
|
||||
|
||||
if(!iter->getSource()->GetSharedVisionList().empty())
|
||||
for(SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
|
||||
i != iter->getSource()->GetSharedVisionList().end(); ++i)
|
||||
@@ -46,7 +41,6 @@ VisibleChangesNotifier::Visit(PlayerMapType &m)
|
||||
(*i)->UpdateVisibilityOf(&i_object);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
VisibleChangesNotifier::Visit(CreatureMapType &m)
|
||||
{
|
||||
@@ -57,7 +51,6 @@ VisibleChangesNotifier::Visit(CreatureMapType &m)
|
||||
if((*i)->m_seer == iter->getSource())
|
||||
(*i)->UpdateVisibilityOf(&i_object);
|
||||
}
|
||||
|
||||
void
|
||||
VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
|
||||
{
|
||||
@@ -67,7 +60,6 @@ VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
|
||||
if(caster->m_seer == iter->getSource())
|
||||
caster->UpdateVisibilityOf(&i_object);
|
||||
}
|
||||
|
||||
void
|
||||
PlayerVisibilityNotifier::Notify()
|
||||
{
|
||||
@@ -85,19 +77,16 @@ PlayerVisibilityNotifier::Notify()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// generate outOfRange for not iterate objects
|
||||
i_data.AddOutOfRangeGUID(i_clientGUIDs);
|
||||
for(Player::ClientGUIDs::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
|
||||
{
|
||||
i_player.m_clientGUIDs.erase(*itr);
|
||||
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_VISIBILITY_CHANGES)==0)
|
||||
sLog.outDebug("Object %u (Type: %u) is out of range (no in active cells set) now for player %u",GUID_LOPART(*itr),GuidHigh2TypeId(GUID_HIPART(*itr)),i_player.GetGUIDLow());
|
||||
#endif
|
||||
}
|
||||
|
||||
if( i_data.HasData() )
|
||||
{
|
||||
/*uint32 entry = 0, map;
|
||||
@@ -110,37 +99,30 @@ PlayerVisibilityNotifier::Notify()
|
||||
y = (*i_visibleNow.begin())->GetPositionY();
|
||||
sLog.outError("notify %u %u %f %f", entry, map, x, y);
|
||||
}*/
|
||||
|
||||
// send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer)
|
||||
WorldPacket packet;
|
||||
i_data.BuildPacket(&packet);
|
||||
i_player.GetSession()->SendPacket(&packet);
|
||||
|
||||
// send out of range to other players if need
|
||||
std::set<uint64> const& oor = i_data.GetOutOfRangeGUIDs();
|
||||
for(std::set<uint64>::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
|
||||
{
|
||||
if(!IS_PLAYER_GUID(*iter))
|
||||
continue;
|
||||
|
||||
Player* plr = ObjectAccessor::GetPlayer(i_player,*iter);
|
||||
if(plr)
|
||||
plr->UpdateVisibilityOf(&i_player);
|
||||
}
|
||||
}
|
||||
|
||||
// Now do operations that required done at object visibility change to visible
|
||||
|
||||
// send data at target visibility change (adding to client)
|
||||
for(std::set<WorldObject*>::const_iterator vItr = i_visibleNow.begin(); vItr != i_visibleNow.end(); ++vItr)
|
||||
// target aura duration for caster show only if target exist at caster client
|
||||
if((*vItr)!=&i_player && (*vItr)->isType(TYPEMASK_UNIT))
|
||||
i_player.SendInitialVisiblePackets((Unit*)(*vItr));
|
||||
|
||||
if(i_visibleNow.size() >= 30)
|
||||
i_player.SetToNotify();
|
||||
}
|
||||
|
||||
void
|
||||
MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||
{
|
||||
@@ -149,10 +131,8 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||
Player *target = iter->getSource();
|
||||
if(!target->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(target->GetExactDistSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
// Send packet to all who are sharing the player's vision
|
||||
if (!target->GetSharedVisionList().empty())
|
||||
{
|
||||
@@ -161,12 +141,10 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||
if((*i)->m_seer == target)
|
||||
SendPacket(*i);
|
||||
}
|
||||
|
||||
if(target->m_seer == target || target->GetVehicle())
|
||||
SendPacket(target);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
{
|
||||
@@ -174,10 +152,8 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
{
|
||||
if(!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
// Send packet to all who are sharing the creature's vision
|
||||
if (!iter->getSource()->GetSharedVisionList().empty())
|
||||
{
|
||||
@@ -188,7 +164,6 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
{
|
||||
@@ -196,10 +171,8 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
{
|
||||
if(!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(iter->getSource()->GetExactDistSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
|
||||
{
|
||||
// Send packet back to the caster if the caster has vision of dynamic object
|
||||
@@ -209,7 +182,6 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void
|
||||
MessageDistDeliverer::VisitObject(Player* plr)
|
||||
@@ -220,7 +192,6 @@ MessageDistDeliverer::VisitObject(Player* plr)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
template<class T> void
|
||||
ObjectUpdater::Visit(GridRefManager<T> &m)
|
||||
{
|
||||
@@ -230,23 +201,17 @@ ObjectUpdater::Visit(GridRefManager<T> &m)
|
||||
iter->getSource()->Update(i_timeDiff);
|
||||
}
|
||||
}
|
||||
|
||||
bool CannibalizeObjectCheck::operator()(Corpse* u)
|
||||
{
|
||||
// ignore bones
|
||||
if(u->GetType()==CORPSE_BONES)
|
||||
return false;
|
||||
|
||||
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
|
||||
|
||||
if( !owner || i_funit->IsFriendlyTo(owner))
|
||||
return false;
|
||||
|
||||
if(i_funit->IsWithinDistInMap(u, i_range) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType &);
|
||||
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType &);
|
||||
|
||||
Reference in New Issue
Block a user