Fix some problems with instance full conditions. BTW, Implement maxPlayers = -1 as unlimited access

--HG--
branch : trunk
This commit is contained in:
tartalo
2009-10-22 18:35:52 +02:00
parent 9c81b3e51d
commit 9e8961bc4c

View File

@@ -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);
}
}
}
}