From f2e88cae5188b4b1d0451c4a760793a3d881b0b0 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 2 Apr 2009 20:27:10 -0600 Subject: *Fix some visibility bug. --HG-- branch : trunk --- .../magisters_terrace/boss_priestess_delrissa.cpp | 3 +- src/game/Map.cpp | 64 ++++++++++++---------- src/game/Map.h | 3 +- src/game/Player.cpp | 2 + src/game/Unit.cpp | 3 + 5 files changed, 43 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp index b9f60813ee5..371af670a10 100644 --- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp +++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp @@ -353,7 +353,8 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI boss_priestess_guestAI(Creature* c) : ScriptedAI(c) { Group.clear(); - pInstance = ((ScriptedInstance*)c->GetInstanceData()); AcquireGUIDs(); + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + AcquireGUIDs(); } ScriptedInstance* pInstance; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 4c7e1471d4a..ebe6c8c3061 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -211,7 +211,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode) : i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), i_gridExpiry(expiry), m_activeNonPlayersIter(m_activeNonPlayers.end()) - , i_lock(false) + , i_lock(true) { for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) { @@ -507,8 +507,7 @@ Map::Add(T *obj) DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); - if(obj->GetTypeId() != TYPEID_UNIT) - UpdateObjectVisibility(obj,cell,p); + UpdateObjectVisibility(obj,cell,p); AddNotifier(obj); } @@ -610,19 +609,25 @@ bool Map::loaded(const GridPair &p) const void Map::RelocationNotify() { - //creatures may be added to the list during update - i_lock = true; + //Move backlog to notify list + for(std::vector::iterator iter = i_unitsToNotifyBacklog.begin(); iter != i_unitsToNotifyBacklog.end(); ++iter) + { + if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL)) + { + i_unitsToNotify.push_back(unit); + unit->m_Notified = false; + } + } + i_unitsToNotifyBacklog.clear(); //Notify - for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) + for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) { - Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL); - if(!unit || !unit->IsInWorld() || unit->GetMapId() != GetId()) - { - *iter = 0; + Unit *unit = *iter; + if(!unit->IsInWorld() || unit->GetMapId() != GetId()) continue; - } + unit->m_IsInNotifyList = false; unit->m_Notified = true; if(unit->GetTypeId() == TYPEID_PLAYER) @@ -637,23 +642,29 @@ void Map::RelocationNotify() VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); } } + i_unitsToNotify.clear(); +} - //Clear list - for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) +void Map::AddUnitToNotify(Unit* u) +{ + if(u->m_IsInNotifyList) + return; + + u->m_IsInNotifyList = true; + + if(i_lock) + i_unitsToNotifyBacklog.push_back(u->GetGUID()); + else { - if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL)) - { - unit->m_IsInNotifyList = false; - unit->m_Notified = false; - } + i_unitsToNotify.push_back(u); + u->m_Notified = false; } - i_unitsToNotify.clear(); - - i_lock = false; } void Map::Update(const uint32 &t_diff) { + i_lock = false; + resetMarkedCells(); Trinity::ObjectUpdater updater(t_diff); @@ -782,6 +793,8 @@ void Map::Update(const uint32 &t_diff) } } + i_lock = true; + RelocationNotify(); // Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load ! @@ -2186,12 +2199,3 @@ void BattleGroundMap::UnloadAll() /*--------------------------TRINITY-------------------------*/ -void Map::AddUnitToNotify(Unit* u) -{ - if(!i_lock && !u->m_IsInNotifyList) - { - i_unitsToNotify.push_back(u->GetGUID()); - u->m_IsInNotifyList = true; - } -} - diff --git a/src/game/Map.h b/src/game/Map.h index c5acedab174..82136a0cc7e 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -339,7 +339,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager, public Trinity::O time_t i_gridExpiry; bool i_lock; - std::vector i_unitsToNotify; + std::vector i_unitsToNotifyBacklog; + std::vector i_unitsToNotify; std::set i_objectsToRemove; std::map i_objectsToSwitch; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 764cb20c88c..6f78d95e079 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17828,6 +17828,8 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 900f060931f..50a8748329d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -12810,6 +12810,9 @@ void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * cast void Unit::SetToNotify() { + if(m_IsInNotifyList) + return; + if(Map *map = GetMap()) map->AddUnitToNotify(this); } -- cgit v1.2.3 From dd2a8443d58aa770d91c31bbb4bf12d456a9d351 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 2 Apr 2009 22:23:51 -0600 Subject: *Also call combatstart when applying areaaura/persistant aura --HG-- branch : trunk --- src/game/GridNotifiersImpl.h | 4 ++++ src/game/SpellAuras.cpp | 3 +++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 5f4fe8cb05b..a43a97cd898 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -190,11 +190,15 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target) { if (i_check->IsFriendlyTo( target )) return; + + i_check->CombatStart(target); } else { if (!i_check->IsHostileTo( target )) return; + + i_check->CombatStart(target); } // Check target immune to spell or aura diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4b868812b16..80ac2165a30 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -658,6 +658,9 @@ void AreaAura::Update(uint32 diff) else aur = new AreaAura(actualSpellInfo, m_effIndex, NULL, (*tIter), caster, NULL); (*tIter)->AddAura(aur); + + if(m_areaAuraType == AREA_AURA_ENEMY) + caster->CombatStart(*tIter); } } } -- cgit v1.2.3 From e84fd0e1f83ef89064e4b8b5673cbd0b68f48c0a Mon Sep 17 00:00:00 2001 From: Chaz Brown Date: Fri, 3 Apr 2009 00:24:01 -0400 Subject: backport genrevision fix from TC2 that allows old and new versions of HG to be used in revision generation --HG-- branch : trunk --- src/tools/genrevision/genrevision.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index a41ba2d86e1..1c22655c782 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 MaNGOS + * Copyright (C) 2005-2009 MaNGOS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -330,6 +330,10 @@ int main(int argc, char **argv) res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); if (!res) res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); // GIT data if (!res) res = extractDataFromGit(path+".git/FETCH_HEAD",path,use_url,data); @@ -347,6 +351,10 @@ int main(int argc, char **argv) res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); if (!res) res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); /// SVN data if (!res) res = extractDataFromSvn(path+".svn/entries",use_url,data); @@ -360,6 +368,10 @@ int main(int argc, char **argv) res = extractDataFromHG(path+".hg/branchheads.cache",path,use_url,data); if (!res) res = extractDataFromHG(path+"_hg/branchheads.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+".hg/branch.cache",path,use_url,data); + if (!res) + res = extractDataFromHG(path+"_hg/branch.cache",path,use_url,data); /// SVN data if (!res) res = extractDataFromSvn(path+".svn/entries",use_url,data); -- cgit v1.2.3 From 335c04b79156e4262e91894141bf5fa687d4c926 Mon Sep 17 00:00:00 2001 From: Rat Date: Fri, 3 Apr 2009 17:57:57 +0200 Subject: *added new escortAI functions (does not effect already coded escort scripts) --HG-- branch : trunk --- src/bindings/scripts/scripts/npc/npc_escortAI.cpp | 52 ++++++++++++++--------- src/bindings/scripts/scripts/npc/npc_escortAI.h | 15 ++++++- 2 files changed, 45 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp index 97f3f088a31..9699505f293 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp @@ -13,7 +13,6 @@ EndScriptData */ #include "npc_escortAI.h" #define WP_LAST_POINT -1 -#define MAX_PLAYER_DISTANCE 50 bool npc_escortAI::IsVisible(Unit* who) const { @@ -132,21 +131,29 @@ void npc_escortAI::UpdateAI(const uint32 diff) //End of the line, Despawn self then immediatly respawn if (CurrentWP == WaypointList.end()) { - debug_log("SD2: EscortAI reached end of waypoints"); + if(DespawnAtEnd) + { + debug_log("SD2: EscortAI reached end of waypoints"); - m_creature->setDeathState(JUST_DIED); - m_creature->SetHealth(0); - m_creature->CombatStop(); - m_creature->DeleteThreatList(); - m_creature->Respawn(); - m_creature->GetMotionMaster()->Clear(true); + m_creature->setDeathState(JUST_DIED); + m_creature->SetHealth(0); + m_creature->CombatStop(); + m_creature->DeleteThreatList(); + m_creature->Respawn(); + m_creature->GetMotionMaster()->Clear(true); - //Re-Enable gossip - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + //Re-Enable gossip + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - IsBeingEscorted = false; - WaitTimer = 0; - return; + IsBeingEscorted = false; + WaitTimer = 0; + return; + }else{ + debug_log("SD2: EscortAI reached end of waypoints with Despawn off"); + IsBeingEscorted = false; + WaitTimer = 0; + return; + } } if( !IsOnHold ) @@ -165,7 +172,7 @@ void npc_escortAI::UpdateAI(const uint32 diff) { Unit* p = Unit::GetUnit(*m_creature, PlayerGUID); - if (!p || m_creature->GetDistance(p) > MAX_PLAYER_DISTANCE) + if (DespawnAtFar && (!p || m_creature->GetDistance(p) > GetMaxPlayerDistance())) { JustDied(m_creature); IsBeingEscorted = false; @@ -187,16 +194,19 @@ void npc_escortAI::UpdateAI(const uint32 diff) }else PlayerTimer -= diff; } - //Check if we have a current target - if( m_creature->isAlive() && UpdateVictim()) + if(CanMelee) { - //If we are within range melee the target - if( m_creature->IsWithinMeleeRange(m_creature->getVictim())) + //Check if we have a current target + if( m_creature->isAlive() && UpdateVictim()) { - if( m_creature->isAttackReady() ) + //If we are within range melee the target + if( m_creature->IsWithinMeleeRange(m_creature->getVictim())) { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); + if( m_creature->isAttackReady() ) + { + m_creature->AttackerStateUpdate(m_creature->getVictim()); + m_creature->resetAttackTimer(); + } } } } diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h index 906726dd0c2..79365f7129b 100644 --- a/src/bindings/scripts/scripts/npc/npc_escortAI.h +++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h @@ -5,6 +5,8 @@ #ifndef SC_ESCORTAI_H #define SC_ESCORTAI_H +#define DEFAULT_MAX_PLAYER_DISTANCE 50 + struct Escort_Waypoint { Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) @@ -35,7 +37,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI virtual void Reset() = 0; // CreatureAI functions - npc_escortAI(Creature *c) : ScriptedAI(c), IsBeingEscorted(false), PlayerTimer(1000) {m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z);} + npc_escortAI(Creature *c) : ScriptedAI(c), IsBeingEscorted(false), PlayerTimer(1000), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), DespawnAtEnd(true), DespawnAtFar(true) {m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z);} bool IsVisible(Unit*) const; @@ -58,6 +60,13 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI void Start(bool bAttack, bool bDefend, bool bRun, uint64 pGUID = 0); + void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } + float GetMaxPlayerDistance() { return MaxPlayerDistance; } + + void SetCanMelee(bool usemelee) { CanMelee = usemelee; } + void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } + void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } + // EscortAI variables protected: uint64 PlayerGUID; @@ -67,6 +76,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI private: uint32 WaitTimer; uint32 PlayerTimer; + float MaxPlayerDistance; struct { @@ -83,6 +93,9 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool Returning; bool ReconnectWP; bool Run; + bool CanMelee; + bool DespawnAtEnd; + bool DespawnAtFar; }; #endif -- cgit v1.2.3 From b449693f1737894b9be4d836a9a35abf6b38d4cc Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 3 Apr 2009 12:01:50 -0600 Subject: *Fix a crash of warbringer_omrogg script. --HG-- branch : trunk --- .../zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp index 4c053bcc133..c565d6ab08e 100644 --- a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp +++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_warbringer_omrogg.cpp @@ -286,13 +286,13 @@ struct TRINITY_DLL_DECL boss_warbringer_omroggAI : public ScriptedAI { Delay_Timer = 3500; - if (!LeftHead && !RightHead) + if (!LeftHead || !RightHead) return; Unit *Left = Unit::GetUnit(*m_creature,LeftHead); Unit *Right = Unit::GetUnit(*m_creature,RightHead); - if (!Left && !Right) + if (!Left || !Right) return; if (AggroYell) -- cgit v1.2.3 From 893eb77a07f8c51351999174d5e7bd339099c1c9 Mon Sep 17 00:00:00 2001 From: Rat Date: Fri, 3 Apr 2009 22:20:19 +0200 Subject: *hopefuly fix Thrall reset bug --HG-- branch : trunk --- .../old_hillsbrad/old_hillsbrad.cpp | 55 +++++++++++++--------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 7c035699a49..b720eb946d6 100644 --- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -211,6 +211,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) { pInstance = ((ScriptedInstance*)c->GetInstanceData()); + m_creature->setActive(true); } ScriptedInstance *pInstance; @@ -357,32 +358,39 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI //trigger epoch Yell("Thrall! Come outside and face your fate! ....") //from here, thrall should not never be allowed to move to point 106 which he currently does. break; - case 106: - if (!PlayerGUID) - break; - //trigger taretha to run down outside - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + case 106: { - if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID))) - ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID); - } + if (!PlayerGUID) + break; - //kill credit creature for quest - Map *map = m_creature->GetMap(); - Map::PlayerList const& players = map->GetPlayers(); - if (!players.isEmpty() && map->IsDungeon()) - { - for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + //trigger taretha to run down outside + if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonster(20156,m_creature->GetGUID()); + if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID))) + ((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID); } - } - //alot will happen here, thrall and taretha talk, erozion appear at spot to explain - m_creature->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); - break; + //kill credit creature for quest + Map *map = m_creature->GetMap(); + Map::PlayerList const& players = map->GetPlayers(); + if (!players.isEmpty() && map->IsDungeon()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonster(20156,m_creature->GetGUID()); + } + } + + //alot will happen here, thrall and taretha talk, erozion appear at spot to explain + m_creature->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); + } + break; + case 108: + //last waypoint, just set Thrall invisible, respawn is turned off + m_creature->SetVisibility(VISIBILITY_OFF); + break; } } @@ -711,6 +719,9 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature, DoScriptText(SAY_TH_START_EVENT_PART1, _Creature); ((npc_escortAI*)(_Creature->AI()))->Start(true, true, true, player->GetGUID()); + ((npc_escortAI*)(_Creature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far + ((npc_escortAI*)(_Creature->AI()))->SetDespawnAtEnd(false); + ((npc_escortAI*)(_Creature->AI()))->SetDespawnAtFar(false); break; case GOSSIP_ACTION_INFO_DEF+2: @@ -817,8 +828,8 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender if( pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS ) { pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); - if(pInstance->GetData64(DATA_EPOCH) == 0) - _Creature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + if(pInstance->GetData64(DATA_EPOCH) == 0) + _Creature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) { -- cgit v1.2.3 From 19f725cd5127a565850d9de28ec5f12bf5af4e33 Mon Sep 17 00:00:00 2001 From: megamage Date: Fri, 3 Apr 2009 14:44:34 -0600 Subject: *Try to fix the bug of visibility update. --HG-- branch : trunk --- src/game/Map.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game/Map.cpp b/src/game/Map.cpp index ebe6c8c3061..669baf275f8 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -377,12 +377,14 @@ void Map::AddNotifier(T*) template<> void Map::AddNotifier(Player* obj) { + obj->m_IsInNotifyList = false; AddUnitToNotify(obj); } template<> void Map::AddNotifier(Creature* obj) { + obj->m_IsInNotifyList = false; AddUnitToNotify(obj); } @@ -468,8 +470,6 @@ bool Map::Add(Player *player) SendInitSelf(player); SendInitTransports(player); - player->m_IsInNotifyList = false; - player->m_Notified = false; player->m_clientGUIDs.clear(); AddNotifier(player); @@ -624,10 +624,11 @@ void Map::RelocationNotify() for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) { Unit *unit = *iter; + unit->m_IsInNotifyList = false; + if(!unit->IsInWorld() || unit->GetMapId() != GetId()) continue; - unit->m_IsInNotifyList = false; unit->m_Notified = true; if(unit->GetTypeId() == TYPEID_PLAYER) -- cgit v1.2.3