Fix some problems with instance full conditions. BTW, Implement maxPlayers = -1 as unlimited access
--HG-- branch : trunk
This commit is contained in:
@@ -251,12 +251,15 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
|
|
||||||
//Instance is full
|
//Instance is full
|
||||||
if (boundedMap)
|
if (boundedMap)
|
||||||
|
{
|
||||||
|
int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers;
|
||||||
|
if (maxPlayers != -1) //-1: unlimited access
|
||||||
{
|
{
|
||||||
Map::PlayerList const &players = boundedMap->GetPlayers();
|
Map::PlayerList const &players = boundedMap->GetPlayers();
|
||||||
uint8 count = 0;
|
uint8 count = 0;
|
||||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||||
++count;
|
++count;
|
||||||
if (count == player->GetDifficulty() ? instance->maxPlayersHeroic : instance->maxPlayers)
|
if (count >= maxPlayers)
|
||||||
{
|
{
|
||||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
||||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
||||||
@@ -265,6 +268,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Other requirements
|
//Other requirements
|
||||||
return player->Satisfy(objmgr.GetAccessRequirement(instance->access_id), mapid, true);
|
return player->Satisfy(objmgr.GetAccessRequirement(instance->access_id), mapid, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user