2008-10-02 16:23:55 -05:00
/*
2009-02-04 12:42:26 +01:00
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
2008-10-14 11:57:03 -05:00
*
2010-01-16 20:19:18 +03:00
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
2008-10-02 16:23:55 -05:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2008-11-18 19:40:06 -06:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2008-10-02 16:23:55 -05:00
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2008-11-18 19:40:06 -06:00
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2008-10-02 16:23:55 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include "MapManager.h"
#include "InstanceSaveMgr.h"
#include "Policies/SingletonImp.h"
#include "Database/DatabaseEnv.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Transports.h"
#include "GridDefines.h"
#include "MapInstanced.h"
2009-10-22 13:05:52 +02:00
#include "InstanceData.h"
2008-10-02 16:23:55 -05:00
#include "DestinationHolderImp.h"
2009-12-17 07:34:00 +01:00
#include "Config/ConfigEnv.h"
2008-10-02 16:23:55 -05:00
#include "World.h"
#include "CellImpl.h"
#include "Corpse.h"
#include "ObjectMgr.h"
2009-04-07 18:01:22 +02:00
#include "Language.h"
2010-04-27 09:45:43 +02:00
#include "WorldPacket.h"
2009-10-17 15:51:44 -07:00
2009-12-20 15:20:04 +01:00
#define CLASS_LOCK Trinity::ClassLevelLockable<MapManager, ACE_Thread_Mutex>
2008-10-02 16:23:55 -05:00
INSTANTIATE_SINGLETON_2 ( MapManager , CLASS_LOCK );
2009-05-13 18:22:21 -05:00
INSTANTIATE_CLASS_MUTEX ( MapManager , ACE_Thread_Mutex );
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
extern GridState * si_GridStates []; // debugging code, should be deleted some day
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
MapManager :: MapManager ()
2008-10-02 16:23:55 -05:00
{
2009-12-21 07:58:19 +01:00
i_gridCleanUpDelay = sWorld . getConfig ( CONFIG_INTERVAL_GRIDCLEAN );
2008-10-02 16:23:55 -05:00
i_timer . SetInterval ( sWorld . getConfig ( CONFIG_INTERVAL_MAPUPDATE ));
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
MapManager ::~ MapManager ()
{
2009-10-17 16:20:24 -07:00
for ( MapMapType :: iterator iter = i_maps . begin (); iter != i_maps . end (); ++ iter )
2009-12-21 07:58:19 +01:00
delete iter -> second ;
2009-10-17 15:51:44 -07:00
2009-10-17 16:20:24 -07:00
for ( TransportSet :: iterator i = m_Transports . begin (); i != m_Transports . end (); ++ i )
2009-12-21 07:58:19 +01:00
delete * i ;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
Map :: DeleteStateMachine ();
}
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
void MapManager :: Initialize ()
2008-10-02 16:23:55 -05:00
{
Map :: InitStateMachine ();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// debugging code, should be deleted some day
{
2009-11-22 19:56:48 -08:00
for ( uint8 i = 0 ; i < MAX_GRID_STATE ; ++ i )
2009-12-21 07:58:19 +01:00
i_GridStates [ i ] = si_GridStates [ i ];
2009-11-22 19:56:48 -08:00
2008-10-02 16:23:55 -05:00
i_GridStateErrorCount = 0 ;
}
2009-12-17 07:34:00 +01:00
int num_threads ( sWorld . getConfig ( CONFIG_NUMTHREADS ));
// Start mtmaps if needed.
2009-12-21 07:58:19 +01:00
if ( num_threads > 0 && m_updater . activate ( num_threads ) == - 1 )
2009-12-17 07:34:00 +01:00
abort ();
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
InitMaxInstanceId ();
}
2009-10-17 15:51:44 -07:00
2009-09-27 02:24:25 -07:00
void MapManager :: InitializeVisibilityDistanceInfo ()
{
2009-12-17 11:30:18 +01:00
for ( MapMapType :: iterator iter = i_maps . begin (); iter != i_maps . end (); ++ iter )
2009-09-27 02:24:25 -07:00
( * iter ). second -> InitVisibilityDistance ();
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
// debugging code, should be deleted some day
void MapManager :: checkAndCorrectGridStatesArray ()
{
bool ok = true ;
2009-12-17 11:30:18 +01:00
for ( int i = 0 ; i < MAX_GRID_STATE ; i ++ )
2008-10-02 16:23:55 -05:00
{
2009-12-21 07:58:19 +01:00
if ( i_GridStates [ i ] != si_GridStates [ i ])
2008-10-02 16:23:55 -05:00
{
sLog . outError ( "MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!" );
ok = false ;
si_GridStates [ i ] = i_GridStates [ i ];
}
2008-10-14 11:57:03 -05:00
#ifdef TRINITY_DEBUG
2008-10-02 16:23:55 -05:00
// inner class checking only when compiled with debug
2009-12-21 07:58:19 +01:00
if ( ! si_GridStates [ i ] -> checkMagic ())
2008-10-02 16:23:55 -05:00
{
ok = false ;
si_GridStates [ i ] -> setMagic ();
}
#endif
}
2009-12-21 07:58:19 +01:00
if ( ! ok )
2008-10-02 16:23:55 -05:00
++ i_GridStateErrorCount ;
}
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
Map * MapManager :: _createBaseMap ( uint32 id )
2008-10-02 16:23:55 -05:00
{
Map * m = _findMap ( id );
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
if ( m == NULL )
2008-10-02 16:23:55 -05:00
{
Guard guard ( * this );
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
const MapEntry * entry = sMapStore . LookupEntry ( id );
2008-10-05 08:48:32 -05:00
if ( entry && entry -> Instanceable ())
2008-10-02 16:23:55 -05:00
{
2008-11-18 19:40:06 -06:00
m = new MapInstanced ( id , i_gridCleanUpDelay );
2008-10-02 16:23:55 -05:00
}
2009-08-03 12:52:31 +02:00
else
{
2009-12-17 11:30:18 +01:00
m = new Map ( id , i_gridCleanUpDelay , 0 , REGULAR_DIFFICULTY );
2009-08-03 12:52:31 +02:00
}
2008-10-02 16:23:55 -05:00
i_maps [ id ] = m ;
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
assert ( m != NULL );
return m ;
}
2009-10-17 15:51:44 -07:00
2010-04-19 09:26:37 +02:00
Map * MapManager :: CreateMap ( uint32 id , const WorldObject * obj , uint32 /*instanceId*/ )
2008-10-02 16:23:55 -05:00
{
2009-06-16 11:19:59 -05:00
ASSERT ( obj );
2010-04-07 19:14:10 +02:00
//if (!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
2009-06-16 11:19:59 -05:00
Map * m = _createBaseMap ( id );
2009-10-17 15:51:44 -07:00
2009-12-17 11:30:18 +01:00
if ( m && ( obj -> GetTypeId () == TYPEID_PLAYER ) && m -> Instanceable ()) m = (( MapInstanced * ) m ) -> CreateInstance ( id , ( Player * ) obj );
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
return m ;
}
2009-10-17 15:51:44 -07:00
2009-06-16 11:19:59 -05:00
Map * MapManager :: FindMap ( uint32 mapid , uint32 instanceId ) const
2008-10-02 16:23:55 -05:00
{
2009-06-16 11:19:59 -05:00
Map * map = _findMap ( mapid );
2009-12-21 07:58:19 +01:00
if ( ! map )
2009-06-16 11:19:59 -05:00
return NULL ;
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
if ( ! map -> Instanceable ())
2009-06-16 11:19:59 -05:00
return instanceId == 0 ? map : NULL ;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
return (( MapInstanced * ) map ) -> FindMap ( instanceId );
}
2009-10-17 15:51:44 -07:00
2010-05-04 18:25:30 +02:00
bool MapManager :: CanPlayerEnter ( uint32 mapid , Player * player , bool loginCheck )
2008-10-02 16:23:55 -05:00
{
const MapEntry * entry = sMapStore . LookupEntry ( mapid );
2010-04-07 19:14:10 +02:00
if ( ! entry )
2009-12-21 07:58:19 +01:00
return false ;
2010-05-04 19:21:01 +02:00
if ( ! entry -> IsDungeon ())
return true ;
2008-10-02 16:23:55 -05:00
const char * mapName = entry -> name [ player -> GetSession () -> GetSessionDbcLocale ()];
2009-10-17 15:51:44 -07:00
2010-05-04 19:21:01 +02:00
Group * pGroup = player -> GetGroup ();
if ( entry -> IsRaid ())
2008-10-02 16:23:55 -05:00
{
2010-05-04 19:21:01 +02:00
// can only enter in a raid group
// GMs can avoid raid limitations
if (( ! pGroup || ! pGroup -> isRaidGroup ()) && ! player -> isGameMaster () && ! sWorld . getConfig ( CONFIG_INSTANCE_IGNORE_RAID ))
2008-10-02 16:23:55 -05:00
{
2010-05-04 19:21:01 +02:00
// probably there must be special opcode, because client has this string constant in GlobalStrings.lua
// TODO: this is not a good place to send the message
player -> GetSession () -> SendAreaTriggerMessage ( player -> GetSession () -> GetTrinityString ( LANG_INSTANCE_RAID_GROUP_ONLY ), mapName );
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "MAP: Player '%s' must be in a raid group to enter instance '%s'" , player -> GetName (), mapName );
2008-10-02 16:23:55 -05:00
return false ;
}
2010-05-04 19:21:01 +02:00
}
//The player has a heroic mode and tries to enter into instance which has no a heroic mode
MapDifficulty const * mapDiff = GetMapDifficultyData ( entry -> MapID , player -> GetDifficulty ( entry -> IsRaid ()));
if ( ! mapDiff )
{
bool isNormalTargetMap = entry -> IsRaid ()
? ( player -> GetRaidDifficulty () == RAID_DIFFICULTY_10MAN_NORMAL )
: ( player -> GetDungeonDifficulty () == DUNGEON_DIFFICULTY_NORMAL );
// Send aborted message
// FIX ME: what about absent normal/heroic mode with specific players limit...
player -> SendTransferAborted ( mapid , TRANSFER_ABORT_DIFFICULTY , isNormalTargetMap ? DUNGEON_DIFFICULTY_NORMAL : DUNGEON_DIFFICULTY_HEROIC );
return false ;
}
2009-10-17 15:51:44 -07:00
2010-05-04 19:21:01 +02:00
if ( ! player -> isAlive ())
{
if ( Corpse * corpse = player -> GetCorpse ())
2008-10-02 16:23:55 -05:00
{
2010-05-04 19:21:01 +02:00
// let enter in ghost mode in instance that connected to inner instance with corpse
uint32 instance_map = corpse -> GetMapId ();
do
2008-10-02 16:23:55 -05:00
{
2010-05-04 19:21:01 +02:00
if ( instance_map == mapid )
break ;
2009-10-17 15:51:44 -07:00
2010-05-04 19:21:01 +02:00
InstanceTemplate const * instance = objmgr . GetInstanceTemplate ( instance_map );
instance_map = instance ? instance -> parent : 0 ;
2008-10-02 16:23:55 -05:00
}
2010-05-04 19:21:01 +02:00
while ( instance_map );
if ( ! instance_map )
2008-10-02 16:23:55 -05:00
{
2010-05-04 19:21:01 +02:00
WorldPacket data ( SMSG_CORPSE_NOT_IN_INSTANCE );
player -> GetSession () -> SendPacket ( & data );
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter." , player -> GetName (), mapName );
2010-05-04 19:21:01 +02:00
return false ;
2008-10-02 16:23:55 -05:00
}
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "MAP: Player '%s' has corpse in instance '%s' and can enter." , player -> GetName (), mapName );
2008-10-02 16:23:55 -05:00
}
2010-05-04 19:21:01 +02:00
else
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!" , player -> GetName ());
2010-05-04 19:21:01 +02:00
}
2009-12-18 13:41:30 -08:00
2010-05-04 19:21:01 +02:00
InstanceTemplate const * instance = objmgr . GetInstanceTemplate ( mapid );
if ( ! instance )
return false ;
2009-10-17 15:51:44 -07:00
2010-05-04 19:21:01 +02:00
//Get instance where player's group is bound & its map
if ( pGroup )
{
InstanceGroupBind * boundedInstance = pGroup -> GetBoundInstance ( player );
if ( boundedInstance && boundedInstance -> save )
2009-10-22 13:05:52 +02:00
{
2010-05-04 19:21:01 +02:00
if ( Map * boundedMap = MapManager :: Instance (). FindMap ( mapid , boundedInstance -> save -> GetInstanceId ()))
2009-10-22 13:05:52 +02:00
{
2010-05-04 19:21:01 +02:00
// Player permanently bounded to different instance than groups one
InstancePlayerBind * playerBoundedInstance = player -> GetBoundInstance ( mapid , player -> GetDungeonDifficulty ());
if ( playerBoundedInstance && playerBoundedInstance -> perm && playerBoundedInstance -> save &&
boundedInstance -> save -> GetInstanceId () != playerBoundedInstance -> save -> GetInstanceId ())
2009-10-22 13:05:52 +02:00
{
2010-05-04 19:21:01 +02:00
//TODO: send some kind of error message to the player
return false ;
}
2009-12-18 13:41:30 -08:00
2010-05-04 19:21:01 +02:00
// Encounters in progress
2010-05-04 20:47:58 +02:00
if ( ! loginCheck && entry -> IsRaid () && (( InstanceMap * ) boundedMap ) -> GetInstanceData () && (( InstanceMap * ) boundedMap ) -> GetInstanceData () -> IsEncounterInProgress ())
2010-05-04 19:21:01 +02:00
{
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "MAP: Player '%s' cannot enter instance '%s' while an encounter is in progress." , player -> GetName (), mapName );
2010-05-04 19:21:01 +02:00
player -> SendTransferAborted ( mapid , TRANSFER_ABORT_ZONE_IN_COMBAT );
return false ;
}
2009-12-18 13:41:30 -08:00
2010-05-04 19:21:01 +02:00
// Instance is full
MapDifficulty const * mapDiff = (( InstanceMap * ) boundedMap ) -> GetMapDifficulty ();
int8 maxPlayers = mapDiff ? mapDiff -> maxPlayers : 0 ;
if ( maxPlayers != - 1 ) //-1: unlimited access
{
if ( boundedMap -> GetPlayersCountExceptGMs () >= ( loginCheck ? maxPlayers + 1 : maxPlayers ))
2009-10-22 13:05:52 +02:00
{
2010-05-18 14:22:51 -02:30
sLog . outDebug ( "MAP: Player '%s' cannot enter instance '%s' because it is full." , player -> GetName (), mapName );
2010-05-04 19:21:01 +02:00
player -> SendTransferAborted ( mapid , TRANSFER_ABORT_MAX_PLAYERS );
return false ;
2009-10-22 13:05:52 +02:00
}
}
}
}
2008-10-02 16:23:55 -05:00
}
2010-05-04 19:21:01 +02:00
//Other requirements
return player -> Satisfy ( objmgr . GetAccessRequirement ( instance -> access_id ), mapid , true );
2008-10-02 16:23:55 -05:00
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void MapManager :: RemoveBonesFromMap ( uint32 mapid , uint64 guid , float x , float y )
{
2009-06-16 11:19:59 -05:00
bool remove_result = _createBaseMap ( mapid ) -> RemoveBones ( guid , x , y );
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
if ( ! remove_result )
{
sLog . outDebug ( "Bones %u not found in world. Delete from DB also." , GUID_LOPART ( guid ));
}
}
2009-10-17 15:51:44 -07:00
2009-12-21 07:58:19 +01:00
void MapManager :: Update ( uint32 diff )
2008-10-02 16:23:55 -05:00
{
i_timer . Update ( diff );
2009-10-30 22:52:37 -07:00
if ( ! i_timer . Passed ())
2008-10-02 16:23:55 -05:00
return ;
2009-10-17 15:51:44 -07:00
2009-10-30 22:52:37 -07:00
MapMapType :: iterator iter = i_maps . begin ();
2009-10-30 22:56:20 -07:00
for (; iter != i_maps . end (); ++ iter )
2009-06-18 19:27:17 -05:00
{
2010-01-10 02:12:02 +01:00
if ( m_updater . activated ())
2009-12-21 07:58:19 +01:00
m_updater . schedule_update ( * iter -> second , i_timer . GetCurrent ());
2010-01-10 02:12:02 +01:00
else
2009-12-21 07:58:19 +01:00
{
2010-01-10 02:12:02 +01:00
iter -> second -> Update ( i_timer . GetCurrent ());
}
2008-10-02 16:23:55 -05:00
}
2009-12-21 07:58:19 +01:00
if ( m_updater . activated ())
2010-01-10 02:12:02 +01:00
m_updater . wait ();
2009-10-17 15:51:44 -07:00
2009-10-30 22:57:25 -07:00
for ( iter = i_maps . begin (); iter != i_maps . end (); ++ iter )
2009-08-25 15:12:22 -05:00
iter -> second -> DelayedUpdate ( i_timer . GetCurrent ());
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
ObjectAccessor :: Instance (). Update ( i_timer . GetCurrent ());
for ( TransportSet :: iterator iter = m_Transports . begin (); iter != m_Transports . end (); ++ iter )
( * iter ) -> Update ( i_timer . GetCurrent ());
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
i_timer . SetCurrent ( 0 );
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void MapManager :: DoDelayedMovesAndRemoves ()
{
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
bool MapManager :: ExistMapAndVMap ( uint32 mapid , float x , float y )
{
2008-10-14 11:57:03 -05:00
GridPair p = Trinity :: ComputeGridPair ( x , y );
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
int gx = 63 - p . x_coord ;
int gy = 63 - p . y_coord ;
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
return Map :: ExistMap ( mapid , gx , gy ) && Map :: ExistVMap ( mapid , gx , gy );
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
bool MapManager :: IsValidMAP ( uint32 mapid )
{
MapEntry const * mEntry = sMapStore . LookupEntry ( mapid );
2008-12-24 09:58:26 -06:00
return mEntry && ( ! mEntry -> IsDungeon () || objmgr . GetInstanceTemplate ( mapid ));
// TODO: add check for battleground template
2008-10-02 16:23:55 -05:00
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void MapManager :: UnloadAll ()
{
2009-10-17 16:20:24 -07:00
for ( MapMapType :: iterator iter = i_maps . begin (); iter != i_maps . end (); ++ iter )
2009-02-25 17:53:05 -06:00
iter -> second -> UnloadAll ();
2009-10-17 15:51:44 -07:00
2010-04-07 19:13:19 +02:00
while ( ! i_maps . empty ())
2008-10-02 16:23:55 -05:00
{
delete i_maps . begin () -> second ;
i_maps . erase ( i_maps . begin ());
}
2009-12-17 07:34:00 +01:00
if ( m_updater . activated ())
m_updater . deactivate ();
2008-10-02 16:23:55 -05:00
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
void MapManager :: InitMaxInstanceId ()
{
i_MaxInstanceId = 0 ;
2009-10-17 15:51:44 -07:00
2010-01-23 14:45:58 +01:00
QueryResult_AutoPtr result = CharacterDatabase . Query ( "SELECT MAX(id) FROM instance" );
2009-12-21 07:58:19 +01:00
if ( result )
2008-10-02 16:23:55 -05:00
i_MaxInstanceId = result -> Fetch ()[ 0 ]. GetUInt32 ();
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
uint32 MapManager :: GetNumInstances ()
{
2009-12-17 07:34:00 +01:00
Guard guard ( * this );
2008-10-02 16:23:55 -05:00
uint32 ret = 0 ;
2009-10-17 16:20:24 -07:00
for ( MapMapType :: iterator itr = i_maps . begin (); itr != i_maps . end (); ++ itr )
2008-10-02 16:23:55 -05:00
{
Map * map = itr -> second ;
2009-12-21 07:58:19 +01:00
if ( ! map -> Instanceable ())
continue ;
2008-10-02 16:23:55 -05:00
MapInstanced :: InstancedMaps & maps = (( MapInstanced * ) map ) -> GetInstancedMaps ();
2009-10-17 16:20:24 -07:00
for ( MapInstanced :: InstancedMaps :: iterator mitr = maps . begin (); mitr != maps . end (); ++ mitr )
2010-04-07 19:14:10 +02:00
if ( mitr -> second -> IsDungeon ()) ret ++ ;
2008-10-02 16:23:55 -05:00
}
return ret ;
}
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
uint32 MapManager :: GetNumPlayersInInstances ()
{
2009-12-17 07:34:00 +01:00
Guard guard ( * this );
2008-10-02 16:23:55 -05:00
uint32 ret = 0 ;
2009-10-17 16:20:24 -07:00
for ( MapMapType :: iterator itr = i_maps . begin (); itr != i_maps . end (); ++ itr )
2008-10-02 16:23:55 -05:00
{
Map * map = itr -> second ;
2009-12-21 07:58:19 +01:00
if ( ! map -> Instanceable ())
continue ;
2008-10-02 16:23:55 -05:00
MapInstanced :: InstancedMaps & maps = (( MapInstanced * ) map ) -> GetInstancedMaps ();
2009-10-17 16:20:24 -07:00
for ( MapInstanced :: InstancedMaps :: iterator mitr = maps . begin (); mitr != maps . end (); ++ mitr )
2009-12-21 07:58:19 +01:00
if ( mitr -> second -> IsDungeon ())
2008-11-18 19:40:06 -06:00
ret += (( InstanceMap * ) mitr -> second ) -> GetPlayers (). getSize ();
2008-10-02 16:23:55 -05:00
}
return ret ;
}