From 850478d38f268c0c5fc590e4e96e1e5b911dd686 Mon Sep 17 00:00:00 2001 From: megamage Date: Tue, 13 Jan 2009 23:49:38 -0600 Subject: *Try to fix the bug that ~Creature causes crash. --HG-- branch : trunk --- src/game/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e6661145439..e8ba2b815ab 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12542,6 +12542,8 @@ bool Unit::HandleMeandingAuraProc( Aura* triggeredByAura ) void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo) { uint64 target_guid = GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); + if(target_guid == GetGUID()) + return; if(!IS_UNIT_GUID(target_guid)) return; -- cgit v1.2.3 From fcd3a315422c629b313033f9530ba89773c2b332 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 14 Jan 2009 19:54:55 -0600 Subject: *Fix a bug in removeaura. --HG-- branch : trunk --- src/game/Unit.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index e8ba2b815ab..c828aa30129 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4596,6 +4596,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) Aura* Aur = i->second; SpellEntry const* AurSpellInfo = Aur->GetSpellProto(); + // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura + // remove aura from list before to prevent deleting it before + m_Auras.erase(i); + ++m_removedAuras; // internal count used by unit update + Unit* caster = NULL; if (IsSingleTargetSpell(AurSpellInfo)) { @@ -4615,22 +4620,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order) if (Aur->GetModifier()->m_auraname < TOTAL_AURAS) { - m_modAuras[(*i).second->GetModifier()->m_auraname].remove((*i).second); - if((*i).second->GetSpellProto()->AuraInterruptFlags) + m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur); + + if(Aur->GetSpellProto()->AuraInterruptFlags) { - m_interruptableAuras.remove((*i).second); + m_interruptableAuras.remove(Aur); UpdateInterruptMask(); } - if((*i).second->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) - m_ccAuras.remove((*i).second); + + if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE) + m_ccAuras.remove(Aur); } // Set remove mode Aur->SetRemoveMode(mode); - // some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura - // remove aura from list before to prevent deleting it before - m_Auras.erase(i); - ++m_removedAuras; // internal count used by unit update // Statue unsummoned at aura remove Totem* statue = NULL; @@ -4651,12 +4654,12 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(const std::vector *spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id)) { - for(std::vector::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i) + for(std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) { if(spell_triggered < 0) - RemoveAurasDueToSpell(-(*i)); + RemoveAurasDueToSpell(-(*itr)); else if(Unit* caster = Aur->GetCaster()) - CastSpell(this, *i, true, 0, 0, caster->GetGUID()); + CastSpell(this, *itr, true, 0, 0, caster->GetGUID()); } } -- cgit v1.2.3 From 4ce857b400770023afb45ffdab09a3a1a5db83e0 Mon Sep 17 00:00:00 2001 From: raczman Date: Thu, 15 Jan 2009 22:01:47 -0500 Subject: Cleanup of log output --HG-- branch : trunk --- src/game/BattleGroundAV.cpp | 2 +- src/game/CharacterHandler.cpp | 4 ++-- src/game/GameEvent.cpp | 2 +- src/game/Item.cpp | 8 ++++---- src/game/NPCHandler.cpp | 4 ++-- src/game/Pet.cpp | 4 ++-- src/game/Unit.cpp | 6 +++--- src/game/World.cpp | 4 ++-- src/game/WorldSocket.cpp | 2 +- src/trinitycore/Master.cpp | 8 ++++---- 10 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/game/Unit.cpp') diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index 27cd169ffc3..6b892a0fa5d 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -125,7 +125,7 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) return;//maybe we should log this, cause this must be a cheater or a big bug uint8 team = GetTeamIndexByTeamId(player->GetTeam()); //TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor - sLog.outError("BG_AV Quest %i completed",questid); + sLog.outDebug("BG_AV Quest %i completed",questid); switch(questid) { case AV_QUEST_A_SCRAPS1: diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 170f425022c..ccc6594a72c 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -389,7 +389,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) SendPacket( &data ); std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); + sLog.outDetail("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str()); } @@ -439,7 +439,7 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data ) return; std::string IP_str = GetRemoteAddress(); - sLog.outBasic("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); + sLog.outDetail("Account: %d (IP: %s) Delete Character:[%s] (guid:%u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); sLog.outChar("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)",GetAccountId(),IP_str.c_str(),name.c_str(),GUID_LOPART(guid)); if(sLog.IsOutCharDump()) // optimize GetPlayerDump call diff --git a/src/game/GameEvent.cpp b/src/game/GameEvent.cpp index 17084dd3ebf..9ceed9024c4 100644 --- a/src/game/GameEvent.cpp +++ b/src/game/GameEvent.cpp @@ -1016,7 +1016,7 @@ uint32 GameEvent::Update() // return the next e nextEventDelay = 0; for(std::set::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr) StopEvent(*itr); - sLog.outBasic("Next game event check in %u seconds.", nextEventDelay + 1); + sLog.outDetail("Next game event check in %u seconds.", nextEventDelay + 1); return (nextEventDelay + 1) * 1000; // Add 1 second to be sure event has started/stopped at next call } diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 0c264a76d8b..b0c2109a5b5 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -641,14 +641,14 @@ void Item::AddToUpdateQueueOf(Player *player) player = GetOwner(); if (!player) { - sLog.outError("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); + sLog.outDebug("Item::AddToUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); return; } } if (player->GetGUID() != GetOwnerGUID()) { - sLog.outError("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + sLog.outDebug("Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } @@ -667,14 +667,14 @@ void Item::RemoveFromUpdateQueueOf(Player *player) player = GetOwner(); if (!player) { - sLog.outError("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); + sLog.outDebug("Item::RemoveFromUpdateQueueOf - GetPlayer didn't find a player matching owner's guid (%u)!", GUID_LOPART(GetOwnerGUID())); return; } } if (player->GetGUID() != GetOwnerGUID()) { - sLog.outError("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + sLog.outDebug("Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 6bb916d9fe0..edf58fd762e 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -322,9 +322,9 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data ) { // recheck CHECK_PACKET_SIZE(recv_data,8+4+1); - sLog.outBasic("reading string"); + sLog.outDebug("reading string"); recv_data >> code; - sLog.outBasic("string read: %s", code.c_str()); + sLog.outDebug("string read: %s", code.c_str()); } Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_NONE); diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index fe532428251..cafebf45f3f 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -927,10 +927,10 @@ bool Pet::CreateBaseAtCreature(Creature* creature) } uint32 guid=objmgr.GenerateLowGuid(HIGHGUID_PET); - sLog.outBasic("SetInstanceID()"); + sLog.outDebug("SetInstanceID()"); SetInstanceId(creature->GetInstanceId()); - sLog.outBasic("Create pet"); + sLog.outDebug("Create pet"); uint32 pet_number = objmgr.GeneratePetNumber(); if(!Create(guid, creature->GetMap(), creature->GetEntry(), pet_number)) return false; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index c828aa30129..900c7526fad 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -457,9 +457,9 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float combat_reach = GetCombatReach(); if(combat_reach < 0.1) // sometimes bugged for players { - sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); - if(GetTypeId() == TYPEID_UNIT) - sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); + //sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); + // if(GetTypeId() == TYPEID_UNIT) + // sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); combat_reach = DEFAULT_COMBAT_REACH; } uint32 attacker_number = getAttackers().size(); diff --git a/src/game/World.cpp b/src/game/World.cpp index 99ca7c185f8..80f995834a9 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1308,7 +1308,7 @@ void World::SetInitialWorldSettings() exit(1); ///- Initialize game time and timers - sLog.outString( "DEBUG:: Initialize game time and timers" ); + sLog.outDebug( "DEBUG:: Initialize game time and timers" ); m_gameTime = time(NULL); m_startTime=m_gameTime; @@ -1453,7 +1453,7 @@ void World::Update(time_t diff) { if(m_updateTimeSum > m_configs[CONFIG_INTERVAL_LOG_UPDATE]) { - sLog.outString("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); + sLog.outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); m_updateTimeSum = m_updateTime; m_updateTimeCount = 1; } diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index 847fd2e8384..2551f1d07da 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -830,7 +830,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket (packet); - sLog.outBasic ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + sLog.outDetail ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index c1484fede8e..ed526f497c3 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2005-2008 MaNGOS * * Copyright (C) 2008 Trinity @@ -408,7 +408,7 @@ bool Master::_StartDB() sLog.outError("Database not specified in configuration file"); return false; } - sLog.outString("World Database: %s", dbstring.c_str()); + sLog.outDetail("World Database: %s", dbstring.c_str()); ///- Initialise the world database if(!WorldDatabase.Initialize(dbstring.c_str())) @@ -422,7 +422,7 @@ bool Master::_StartDB() sLog.outError("Character Database not specified in configuration file"); return false; } - sLog.outString("Character Database: %s", dbstring.c_str()); + sLog.outDetail("Character Database: %s", dbstring.c_str()); ///- Initialise the Character database if(!CharacterDatabase.Initialize(dbstring.c_str())) @@ -439,7 +439,7 @@ bool Master::_StartDB() } ///- Initialise the login database - sLog.outString("Login Database: %s", dbstring.c_str() ); + sLog.outDetail("Login Database: %s", dbstring.c_str() ); if(!LoginDatabase.Initialize(dbstring.c_str())) { sLog.outError("Cannot connect to login database %s",dbstring.c_str()); -- cgit v1.2.3