aboutsummaryrefslogtreecommitdiff
path: root/src/game/Map.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-22 22:44:27 -0600
committermegamage <none@none>2009-01-22 22:44:27 -0600
commitab4b9160f2d1d534832372422fd1e2bc514b808a (patch)
treeee5ec121b585b419ff8ec38193ec008d930e75da /src/game/Map.cpp
parent4230318f962f5faeddf188d61a367a635a8bb81a (diff)
*Update to Mangos 7151.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Map.cpp')
-rw-r--r--src/game/Map.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 0919db4ebe1..d64a1736fe1 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -1767,10 +1767,10 @@ bool InstanceMap::CanEnter(Player *player)
}
// cannot enter if the instance is full (player cap), GMs don't count
- InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
- if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= iTemplate->maxPlayers)
+ uint32 maxPlayers = GetMaxPlayers();
+ if (!player->isGameMaster() && GetPlayersCountExceptGMs() >= maxPlayers)
{
- sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), iTemplate->maxPlayers, player->GetName());
+ sLog.outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
return false;
}
@@ -2080,6 +2080,14 @@ void InstanceMap::SetResetSchedule(bool on)
}
}
+uint32 InstanceMap::GetMaxPlayers() const
+{
+ InstanceTemplate const* iTemplate = objmgr.GetInstanceTemplate(GetId());
+ if(!iTemplate)
+ return 0;
+ return IsHeroic() ? iTemplate->maxPlayersHeroic : iTemplate->maxPlayers;
+}
+
/* ******* Battleground Instance Maps ******* */
BattleGroundMap::BattleGroundMap(uint32 id, time_t expiry, uint32 InstanceId)