[9249] Move instance call OnPlayerEnter() to after really added to map

Also clarify log message and comment for function.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-01-24 16:09:49 +01:00
parent 64bd59a11b
commit 2b3971ed26
3 changed files with 7 additions and 4 deletions

View file

@ -54,7 +54,7 @@ class MANGOS_DLL_SPEC InstanceData
//This is to prevent players from entering during boss encounters. //This is to prevent players from entering during boss encounters.
virtual bool IsEncounterInProgress() const { return false; }; 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 *) {} virtual void OnPlayerEnter(Player *) {}
//Called when a gameobject is created //Called when a gameobject is created

View file

@ -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 // for normal instances cancel the reset schedule when the
// first player enters (no players yet) // first player enters (no players yet)
SetResetSchedule(false); 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 // initialize unload state
m_unloadTimer = 0; m_unloadTimer = 0;
m_resetAfterUnload = false; 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 // this will acquire the same mutex so it cannot be in the previous block
Map::Add(player); Map::Add(player);
if (i_data)
i_data->OnPlayerEnter(player);
return true; return true;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9248" #define REVISION_NR "9249"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__