diff options
Diffstat (limited to 'src/server/game/Maps/MapInstanced.cpp')
-rw-r--r-- | src/server/game/Maps/MapInstanced.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index c48b616788e..473e3163216 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -26,6 +26,7 @@ #include "World.h" #include "Group.h" #include "Player.h" +#include "GarrisonMap.h" MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DIFFICULTY_NORMAL) { @@ -138,7 +139,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) } } } - else + else if (!IsGarrison()) { InstancePlayerBind* pBind = player->GetBoundInstance(GetId(), player->GetDifficultyID(GetEntry())); InstanceSave* pSave = pBind ? pBind->save : NULL; @@ -180,6 +181,13 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) map = CreateInstance(newInstanceId, NULL, diff); } } + else + { + newInstanceId = player->GetGUID().GetCounter(); + map = FindInstanceMap(newInstanceId); + if (!map) + map = CreateGarrison(newInstanceId, player); + } return map; } @@ -237,6 +245,17 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun return map; } +GarrisonMap* MapInstanced::CreateGarrison(uint32 instanceId, Player* owner) +{ + std::lock_guard<std::mutex> lock(_mapLock); + + GarrisonMap* map = new GarrisonMap(GetId(), GetGridExpiry(), instanceId, this, owner->GetGUID()); + ASSERT(map->IsGarrison()); + + m_InstancedMaps[instanceId] = map; + return map; +} + // increments the iterator after erase bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) { |