*Try to fix some crash.
--HG-- branch : trunk
This commit is contained in:
@@ -1485,6 +1485,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
||||
if(!pCreature->IsPositionValid())
|
||||
{
|
||||
sLog.outError("Creature (guidlow %d, entry %d) not added to battleground. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
|
||||
delete pCreature;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -82,16 +82,16 @@ Object::Object( )
|
||||
|
||||
Object::~Object( )
|
||||
{
|
||||
if(m_objectUpdated)
|
||||
ObjectAccessor::Instance().RemoveUpdateObject(this);
|
||||
//if(m_objectUpdated)
|
||||
// ObjectAccessor::Instance().RemoveUpdateObject(this);
|
||||
|
||||
if(m_uint32Values)
|
||||
{
|
||||
if(IsInWorld())
|
||||
{
|
||||
///- Do NOT call RemoveFromWorld here, if the object is a player it will crash
|
||||
sLog.outError("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId());
|
||||
//assert(0);
|
||||
sLog.outCrash("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId());
|
||||
assert(false);
|
||||
}
|
||||
|
||||
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
|
||||
@@ -1893,7 +1893,10 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
|
||||
Map *map = GetMap();
|
||||
GameObject *go = new GameObject();
|
||||
if(!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x,y,z,ang,rotation0,rotation1,rotation2,rotation3,100,1))
|
||||
{
|
||||
delete go;
|
||||
return NULL;
|
||||
}
|
||||
go->SetRespawnTime(respawnTime);
|
||||
if(GetTypeId()==TYPEID_PLAYER || GetTypeId()==TYPEID_UNIT) //not sure how to handle this
|
||||
((Unit*)this)->AddGameObject(go);
|
||||
|
||||
+5
-3
@@ -133,6 +133,8 @@ class TRINITY_DLL_SPEC Object
|
||||
if(m_inWorld)
|
||||
return;
|
||||
|
||||
assert(m_uint32Values);
|
||||
|
||||
m_inWorld = true;
|
||||
|
||||
// synchronize values mirror with values array (changes will send in updatecreate opcode any way
|
||||
@@ -143,10 +145,10 @@ class TRINITY_DLL_SPEC Object
|
||||
if(!m_inWorld)
|
||||
return;
|
||||
|
||||
// if we remove from world then sending changes not required
|
||||
if(m_uint32Values)
|
||||
ClearUpdateMask(true);
|
||||
m_inWorld = false;
|
||||
|
||||
// if we remove from world then sending changes not required
|
||||
ClearUpdateMask(true);
|
||||
}
|
||||
|
||||
const uint64& GetGUID() const { return GetUInt64Value(0); }
|
||||
|
||||
@@ -259,30 +259,10 @@ ObjectAccessor::UpdateObject(Object* obj, Player* exceptPlayer)
|
||||
void
|
||||
ObjectAccessor::_buildUpdateObject(Object *obj, UpdateDataMapType &update_players)
|
||||
{
|
||||
bool build_for_all = true;
|
||||
Player *pl = NULL;
|
||||
if( obj->isType(TYPEMASK_ITEM) )
|
||||
{
|
||||
Item *item = static_cast<Item *>(obj);
|
||||
pl = item->GetOwner();
|
||||
build_for_all = false;
|
||||
}
|
||||
|
||||
if( pl != NULL )
|
||||
_buildPacket(pl, obj, update_players);
|
||||
|
||||
// Capt: okey for all those fools who think its a real fix
|
||||
// THIS IS A TEMP FIX
|
||||
if( build_for_all )
|
||||
{
|
||||
WorldObject * temp = dynamic_cast<WorldObject*>(obj);
|
||||
|
||||
//assert(dynamic_cast<WorldObject*>(obj)!=NULL);
|
||||
if (temp)
|
||||
_buildChangeObjectForPlayer(temp, update_players);
|
||||
else
|
||||
sLog.outDebug("ObjectAccessor: Ln 405 Temp bug fix");
|
||||
}
|
||||
if(obj->isType(TYPEMASK_ITEM))
|
||||
_buildPacket(((Item*)obj)->GetOwner(), obj, update_players);
|
||||
else
|
||||
_buildChangeObjectForPlayer((WorldObject*)obj, update_players);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -472,9 +452,8 @@ ObjectAccessor::Update(uint32 diff)
|
||||
while(!i_objects.empty())
|
||||
{
|
||||
Object* obj = *i_objects.begin();
|
||||
assert(obj && obj->IsInWorld());
|
||||
i_objects.erase(i_objects.begin());
|
||||
if (!obj || !obj->IsInWorld())
|
||||
continue;
|
||||
_buildUpdateObject(obj, update_players);
|
||||
obj->ClearUpdateMask(false);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ bool OutdoorPvPObjective::AddCreature(uint32 type, uint32 entry, uint32 teamval,
|
||||
{
|
||||
sLog.outError("Can't create creature entry: %u",entry);
|
||||
delete pCreature;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
pCreature->Relocate(x, y, z, o);
|
||||
@@ -168,6 +168,7 @@ bool OutdoorPvPObjective::AddCreature(uint32 type, uint32 entry, uint32 teamval,
|
||||
if(!pCreature->IsPositionValid())
|
||||
{
|
||||
sLog.outError("ERROR: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
|
||||
delete pCreature;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -271,6 +272,7 @@ bool OutdoorPvPObjective::AddCapturePoint(uint32 entry, uint32 map, float x, flo
|
||||
{
|
||||
sLog.outError("Can't create creature entry: %u",entry);
|
||||
delete pCreature;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -279,6 +281,7 @@ bool OutdoorPvPObjective::AddCapturePoint(uint32 entry, uint32 map, float x, flo
|
||||
if(!pCreature->IsPositionValid())
|
||||
{
|
||||
sLog.outError("ERROR: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
|
||||
delete pCreature;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user