mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 02:04:52 +01:00
Fix some problems with instance full conditions. BTW, Implement maxPlayers = -1 as unlimited access
--HG-- branch : trunk
This commit is contained in:
@@ -252,15 +252,19 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
//Instance is full
|
||||
if (boundedMap)
|
||||
{
|
||||
Map::PlayerList const &players = boundedMap->GetPlayers();
|
||||
uint8 count = 0;
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
++count;
|
||||
if (count == player->GetDifficulty() ? instance->maxPlayersHeroic : instance->maxPlayers)
|
||||
int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers;
|
||||
if (maxPlayers != -1) //-1: unlimited access
|
||||
{
|
||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
||||
return(false);
|
||||
Map::PlayerList const &players = boundedMap->GetPlayers();
|
||||
uint8 count = 0;
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
++count;
|
||||
if (count >= maxPlayers)
|
||||
{
|
||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user