Fix some problems with instance full conditions. BTW, Implement maxPlayers = -1 as unlimited access
--HG-- branch : trunk
This commit is contained in:
+12
-8
@@ -252,15 +252,19 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
//Instance is full
|
//Instance is full
|
||||||
if (boundedMap)
|
if (boundedMap)
|
||||||
{
|
{
|
||||||
Map::PlayerList const &players = boundedMap->GetPlayers();
|
int8 maxPlayers = (player->GetDifficulty() == DIFFICULTY_HEROIC) ? instance->maxPlayersHeroic : instance->maxPlayers;
|
||||||
uint8 count = 0;
|
if (maxPlayers != -1) //-1: unlimited access
|
||||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
|
||||||
++count;
|
|
||||||
if (count == player->GetDifficulty() ? instance->maxPlayersHeroic : instance->maxPlayers)
|
|
||||||
{
|
{
|
||||||
sLog.outDebug("MAP: Player '%s' can't enter instance '%s' because it's full.", player->GetName(), mapName);
|
Map::PlayerList const &players = boundedMap->GetPlayers();
|
||||||
player->SendTransferAborted(mapid, TRANSFER_ABORT_MAX_PLAYERS);
|
uint8 count = 0;
|
||||||
return(false);
|
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