diff options
| author | Krudor <erikstrandberg93@hotmail.com> | 2016-11-06 23:30:49 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-11-06 23:30:49 +0100 |
| commit | 8444ab736568667cb6425757ce5f832cb6068379 (patch) | |
| tree | 375c6a9d25b9d5a4d351f4e3a7c0b52526dd816f /src/server/game/Maps/Map.cpp | |
| parent | 9d88e78961cc92c2914ffb25333f35433a0c9682 (diff) | |
Core/Instances: Implemented base scenario system and objectives in dungeons
Closes #17905
Closes #18034
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 0a7138616e0..a40367ad7a3 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -28,6 +28,7 @@ #include "GridStates.h" #include "Group.h" #include "InstancePackets.h" +#include "InstanceScenario.h" #include "InstanceScript.h" #include "MapInstanced.h" #include "MiscPackets.h" @@ -3046,7 +3047,7 @@ template TC_GAME_API void Map::RemoveFromMap(AreaTrigger*, bool); InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _parent) : Map(id, expiry, InstanceId, SpawnMode, _parent), m_resetAfterUnload(false), m_unloadWhenEmpty(false), - i_data(NULL), i_script_id(0) + i_data(NULL), i_script_id(0), i_scenario(nullptr) { //lets initialize visibility distance for dungeons InstanceMap::InitVisibilityDistance(); @@ -3059,7 +3060,7 @@ InstanceMap::InstanceMap(uint32 id, time_t expiry, uint32 InstanceId, uint8 Spaw InstanceMap::~InstanceMap() { delete i_data; - i_data = NULL; + delete i_scenario; } void InstanceMap::InitVisibilityDistance() @@ -3224,6 +3225,9 @@ bool InstanceMap::AddPlayerToMap(Player* player, bool initPlayer /*= true*/) if (i_data) i_data->OnPlayerEnter(player); + if (i_scenario) + i_scenario->OnPlayerEnter(player); + return true; } @@ -3236,6 +3240,9 @@ void InstanceMap::Update(const uint32 t_diff) i_data->Update(t_diff); i_data->UpdateCombatResurrection(t_diff); } + + if (i_scenario) + i_scenario->Update(t_diff); } void InstanceMap::RemovePlayerFromMap(Player* player, bool remove) @@ -3244,6 +3251,8 @@ void InstanceMap::RemovePlayerFromMap(Player* player, bool remove) //if last player set unload timer if (!m_unloadTimer && m_mapRefManager.getSize() == 1) m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); + if (i_scenario) + i_scenario->OnPlayerExit(player); Map::RemovePlayerFromMap(player, remove); // for normal instances schedule the reset after all players have left SetResetSchedule(true); |
