Skip to content

Commit

Permalink
[9249] Move instance call OnPlayerEnter() to after really added to map
Browse files Browse the repository at this point in the history
Also clarify log message and comment for function.

Signed-off-by: NoFantasy <nofantasy@nf.no>
  • Loading branch information
NoFantasy committed Jan 24, 2010
1 parent 2cbcef7 commit 51bdc10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/game/InstanceData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/game/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9248"
#define REVISION_NR "9249"
#endif // __REVISION_NR_H__

0 comments on commit 51bdc10

Please sign in to comment.