mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Garrisons: Basics for garrisons
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user