From 2b3971ed26a0236778b15f41ab06a027d3656e42 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 24 Jan 2010 16:09:49 +0100 Subject: [PATCH] [9249] Move instance call OnPlayerEnter() to after really added to map Also clarify log message and comment for function. Signed-off-by: NoFantasy --- src/game/InstanceData.h | 2 +- src/game/Map.cpp | 7 +++++-- src/shared/revision_nr.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h index c647fa8cc..cf1e1f2a9 100644 --- a/src/game/InstanceData.h +++ b/src/game/InstanceData.h @@ -54,7 +54,7 @@ class MANGOS_DLL_SPEC InstanceData //This is to prevent players from entering during boss encounters. virtual bool IsEncounterInProgress() const { return false; }; - //Called when a player successfully enters the instance. + //Called when a player successfully enters the instance (after really added to map) virtual void OnPlayerEnter(Player *) {} //Called when a gameobject is created diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 335e6aae9..351bcd663 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -2464,12 +2464,11 @@ bool InstanceMap::Add(Player *player) } } - if(i_data) i_data->OnPlayerEnter(player); // for normal instances cancel the reset schedule when the // first player enters (no players yet) SetResetSchedule(false); - sLog.outDetail("MAP: Player '%s' entered the instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName()); + sLog.outDetail("MAP: Player '%s' is entering instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName()); // initialize unload state m_unloadTimer = 0; m_resetAfterUnload = false; @@ -2478,6 +2477,10 @@ bool InstanceMap::Add(Player *player) // this will acquire the same mutex so it cannot be in the previous block Map::Add(player); + + if (i_data) + i_data->OnPlayerEnter(player); + return true; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index fa0bdfbce..a7dcd08b1 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9248" + #define REVISION_NR "9249" #endif // __REVISION_NR_H__