Set use mtmaps by default, and cleanup some code in MapManager.
TODO: Set MapUpdate.Threads=0 in config, for full disable mtmaps, for correct work mtmaps, need ACE 5.7.2+, recommend 5.7.5 --HG-- branch : trunk
This commit is contained in:
@@ -23,7 +23,6 @@ OPTION(DO_DEBUG "Debug mode" 0)
|
|||||||
OPTION(DO_WARN "Enable all compile warnings" 0)
|
OPTION(DO_WARN "Enable all compile warnings" 0)
|
||||||
OPTION(LARGE_CELL "Large cell size" 0)
|
OPTION(LARGE_CELL "Large cell size" 0)
|
||||||
OPTION(CENTOS "CENTOS" 0)
|
OPTION(CENTOS "CENTOS" 0)
|
||||||
OPTION(USE_MULTI_THREAD_MAP "With Multithread maps" 0)
|
|
||||||
|
|
||||||
SET(GENREV_SRC
|
SET(GENREV_SRC
|
||||||
src/tools/genrevision/genrevision.cpp
|
src/tools/genrevision/genrevision.cpp
|
||||||
@@ -101,10 +100,6 @@ SET(SCRIPT_LIB trinityinterface)
|
|||||||
SET(SCRIPT_INCLUDE src/bindings/interface)
|
SET(SCRIPT_INCLUDE src/bindings/interface)
|
||||||
endif(DO_SCRIPTS)
|
endif(DO_SCRIPTS)
|
||||||
|
|
||||||
IF (USE_MULTI_THREAD_MAP)
|
|
||||||
message("* With Multithread maps")
|
|
||||||
ENDIF (USE_MULTI_THREAD_MAP)
|
|
||||||
|
|
||||||
message("-- Miscellaneus options:")
|
message("-- Miscellaneus options:")
|
||||||
|
|
||||||
if(DO_CLI)
|
if(DO_CLI)
|
||||||
|
|||||||
@@ -155,19 +155,8 @@ typedef uint64 OBJECT_HANDLE;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(DEBUG) && !defined(MANGOS_DEBUG) && !defined(TRINITY_DEBUG)
|
|
||||||
#if defined(USE_MULTI_THREAD_MAP)
|
|
||||||
#define MULTI_THREAD_MAP
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MULTI_THREAD_MAP
|
|
||||||
#define MAP_BASED_RAND_GEN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CLIENT_VER
|
#ifndef CLIENT_VER
|
||||||
#define CLIENT_VER 313
|
#define CLIENT_VER 313
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //TRINITY_DEFINE_H
|
#endif //TRINITY_DEFINE_H
|
||||||
|
|
||||||
|
|||||||
+26
-45
@@ -42,8 +42,9 @@ INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Thread_Mutex);
|
|||||||
|
|
||||||
extern GridState* si_GridStates[]; // debugging code, should be deleted some day
|
extern GridState* si_GridStates[]; // debugging code, should be deleted some day
|
||||||
|
|
||||||
MapManager::MapManager() : i_gridCleanUpDelay(sWorld.getConfig(CONFIG_INTERVAL_GRIDCLEAN))
|
MapManager::MapManager()
|
||||||
{
|
{
|
||||||
|
i_gridCleanUpDelay = sWorld.getConfig(CONFIG_INTERVAL_GRIDCLEAN);
|
||||||
i_timer.SetInterval(sWorld.getConfig(CONFIG_INTERVAL_MAPUPDATE));
|
i_timer.SetInterval(sWorld.getConfig(CONFIG_INTERVAL_MAPUPDATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +59,7 @@ MapManager::~MapManager()
|
|||||||
Map::DeleteStateMachine();
|
Map::DeleteStateMachine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void MapManager::Initialize()
|
||||||
MapManager::Initialize()
|
|
||||||
{
|
{
|
||||||
Map::InitStateMachine();
|
Map::InitStateMachine();
|
||||||
|
|
||||||
@@ -70,12 +70,10 @@ MapManager::Initialize()
|
|||||||
|
|
||||||
i_GridStateErrorCount = 0;
|
i_GridStateErrorCount = 0;
|
||||||
}
|
}
|
||||||
#ifdef MULTI_THREAD_MAP
|
|
||||||
int num_threads(sWorld.getConfig(CONFIG_NUMTHREADS));
|
int num_threads(sWorld.getConfig(CONFIG_NUMTHREADS));
|
||||||
// Start mtmaps if needed.
|
// Start mtmaps if needed.
|
||||||
if(num_threads > 0 && m_updater.activate(num_threads) == -1)
|
if (num_threads > 0 && m_updater.activate(num_threads) == -1)
|
||||||
abort();
|
abort();
|
||||||
#endif
|
|
||||||
|
|
||||||
InitMaxInstanceId();
|
InitMaxInstanceId();
|
||||||
}
|
}
|
||||||
@@ -92,7 +90,7 @@ void MapManager::checkAndCorrectGridStatesArray()
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
for (int i=0; i<MAX_GRID_STATE; i++)
|
for (int i=0; i<MAX_GRID_STATE; i++)
|
||||||
{
|
{
|
||||||
if(i_GridStates[i] != si_GridStates[i])
|
if (i_GridStates[i] != si_GridStates[i])
|
||||||
{
|
{
|
||||||
sLog.outError("MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
|
sLog.outError("MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
|
||||||
ok = false;
|
ok = false;
|
||||||
@@ -100,23 +98,22 @@ void MapManager::checkAndCorrectGridStatesArray()
|
|||||||
}
|
}
|
||||||
#ifdef TRINITY_DEBUG
|
#ifdef TRINITY_DEBUG
|
||||||
// inner class checking only when compiled with debug
|
// inner class checking only when compiled with debug
|
||||||
if(!si_GridStates[i]->checkMagic())
|
if (!si_GridStates[i]->checkMagic())
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
si_GridStates[i]->setMagic();
|
si_GridStates[i]->setMagic();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(!ok)
|
if (!ok)
|
||||||
++i_GridStateErrorCount;
|
++i_GridStateErrorCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map*
|
Map* MapManager::_createBaseMap(uint32 id)
|
||||||
MapManager::_createBaseMap(uint32 id)
|
|
||||||
{
|
{
|
||||||
Map *m = _findMap(id);
|
Map *m = _findMap(id);
|
||||||
|
|
||||||
if( m == NULL )
|
if (m == NULL)
|
||||||
{
|
{
|
||||||
Guard guard(*this);
|
Guard guard(*this);
|
||||||
|
|
||||||
@@ -150,23 +147,20 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 instanceId)
|
|||||||
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
||||||
{
|
{
|
||||||
Map *map = _findMap(mapid);
|
Map *map = _findMap(mapid);
|
||||||
if(!map)
|
if (!map)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if(!map->Instanceable())
|
if (!map->Instanceable())
|
||||||
return instanceId == 0 ? map : NULL;
|
return instanceId == 0 ? map : NULL;
|
||||||
|
|
||||||
return ((MapInstanced*)map)->FindMap(instanceId);
|
return ((MapInstanced*)map)->FindMap(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
checks that do not require a map to be created
|
|
||||||
will send transfer error messages on fail
|
|
||||||
*/
|
|
||||||
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||||
{
|
{
|
||||||
const MapEntry *entry = sMapStore.LookupEntry(mapid);
|
const MapEntry *entry = sMapStore.LookupEntry(mapid);
|
||||||
if(!entry) return false;
|
if(!entry)
|
||||||
|
return false;
|
||||||
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
||||||
|
|
||||||
if(entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
|
if(entry->map_type == MAP_INSTANCE || entry->map_type == MAP_RAID)
|
||||||
@@ -174,7 +168,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
if (entry->map_type == MAP_RAID)
|
if (entry->map_type == MAP_RAID)
|
||||||
{
|
{
|
||||||
// GMs can avoid raid limitations
|
// GMs can avoid raid limitations
|
||||||
if(!player->isGameMaster() && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_RAID))
|
if (!player->isGameMaster() && !sWorld.getConfig(CONFIG_INSTANCE_IGNORE_RAID))
|
||||||
{
|
{
|
||||||
// can only enter in a raid group
|
// can only enter in a raid group
|
||||||
Group* group = player->GetGroup();
|
Group* group = player->GetGroup();
|
||||||
@@ -186,8 +180,6 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
sLog.outDebug("MAP: Player '%s' must be in a raid group to enter instance of '%s'", player->GetName(), mapName);
|
sLog.outDebug("MAP: Player '%s' must be in a raid group to enter instance of '%s'", player->GetName(), mapName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Åñëè ÈÊ èëè È×, òî ïðîâåðÿòü óðîâåíü øìîòà îäåòîãî íà ïåðñå.
|
|
||||||
//if (mapid == 649)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,13 +199,13 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
|
|
||||||
if (!player->isAlive())
|
if (!player->isAlive())
|
||||||
{
|
{
|
||||||
if(Corpse *corpse = player->GetCorpse())
|
if (Corpse *corpse = player->GetCorpse())
|
||||||
{
|
{
|
||||||
// let enter in ghost mode in instance that connected to inner instance with corpse
|
// let enter in ghost mode in instance that connected to inner instance with corpse
|
||||||
uint32 instance_map = corpse->GetMapId();
|
uint32 instance_map = corpse->GetMapId();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(instance_map==mapid)
|
if (instance_map==mapid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(instance_map);
|
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(instance_map);
|
||||||
@@ -236,7 +228,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
|||||||
}
|
}
|
||||||
|
|
||||||
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
|
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
|
||||||
if(!instance)
|
if (!instance)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Get instance where player's group is bound & its map
|
//Get instance where player's group is bound & its map
|
||||||
@@ -297,16 +289,14 @@ void MapManager::RemoveBonesFromMap(uint32 mapid, uint64 guid, float x, float y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void MapManager::Update(uint32 diff)
|
||||||
MapManager::Update(uint32 diff)
|
|
||||||
{
|
{
|
||||||
i_timer.Update(diff);
|
i_timer.Update(diff);
|
||||||
if (!i_timer.Passed())
|
if (!i_timer.Passed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MapMapType::iterator iter = i_maps.begin();
|
MapMapType::iterator iter = i_maps.begin();
|
||||||
#ifdef MULTI_THREAD_MAP
|
for (; iter != i_maps.end(); ++iter)
|
||||||
for(; iter != i_maps.end(); ++iter)
|
|
||||||
{
|
{
|
||||||
if (m_updater.activated())
|
if (m_updater.activated())
|
||||||
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
||||||
@@ -317,22 +307,13 @@ MapManager::Update(uint32 diff)
|
|||||||
}
|
}
|
||||||
if (m_updater.activated())
|
if (m_updater.activated())
|
||||||
m_updater.wait();
|
m_updater.wait();
|
||||||
#else
|
|
||||||
for (; iter != i_maps.end(); ++iter)
|
|
||||||
{
|
|
||||||
iter->second->Update(i_timer.GetCurrent());
|
|
||||||
sWorld.RecordTimeDiff("UpdateMap %u", iter->second->GetId());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
|
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||||
iter->second->DelayedUpdate(i_timer.GetCurrent());
|
iter->second->DelayedUpdate(i_timer.GetCurrent());
|
||||||
|
|
||||||
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
|
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
|
||||||
sWorld.RecordTimeDiff("UpdateObjectAccessor");
|
|
||||||
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
|
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
|
||||||
(*iter)->Update(i_timer.GetCurrent());
|
(*iter)->Update(i_timer.GetCurrent());
|
||||||
sWorld.RecordTimeDiff("UpdateTransports");
|
|
||||||
|
|
||||||
i_timer.SetCurrent(0);
|
i_timer.SetCurrent(0);
|
||||||
}
|
}
|
||||||
@@ -369,18 +350,16 @@ void MapManager::UnloadAll()
|
|||||||
i_maps.erase(i_maps.begin());
|
i_maps.erase(i_maps.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MULTI_THREAD_MAP
|
|
||||||
if (m_updater.activated())
|
if (m_updater.activated())
|
||||||
m_updater.deactivate();
|
m_updater.deactivate();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapManager::InitMaxInstanceId()
|
void MapManager::InitMaxInstanceId()
|
||||||
{
|
{
|
||||||
i_MaxInstanceId = 0;
|
i_MaxInstanceId = 0;
|
||||||
|
|
||||||
QueryResult *result = CharacterDatabase.Query( "SELECT MAX(id) FROM instance" );
|
QueryResult *result = CharacterDatabase.Query("SELECT MAX(id) FROM instance");
|
||||||
if( result )
|
if (result)
|
||||||
{
|
{
|
||||||
i_MaxInstanceId = result->Fetch()[0].GetUInt32();
|
i_MaxInstanceId = result->Fetch()[0].GetUInt32();
|
||||||
delete result;
|
delete result;
|
||||||
@@ -395,7 +374,8 @@ uint32 MapManager::GetNumInstances()
|
|||||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||||
{
|
{
|
||||||
Map *map = itr->second;
|
Map *map = itr->second;
|
||||||
if(!map->Instanceable()) continue;
|
if (!map->Instanceable())
|
||||||
|
continue;
|
||||||
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
||||||
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
|
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
|
||||||
if(mitr->second->IsDungeon()) ret++;
|
if(mitr->second->IsDungeon()) ret++;
|
||||||
@@ -411,10 +391,11 @@ uint32 MapManager::GetNumPlayersInInstances()
|
|||||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||||
{
|
{
|
||||||
Map *map = itr->second;
|
Map *map = itr->second;
|
||||||
if(!map->Instanceable()) continue;
|
if (!map->Instanceable())
|
||||||
|
continue;
|
||||||
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
||||||
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
|
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
|
||||||
if(mitr->second->IsDungeon())
|
if (mitr->second->IsDungeon())
|
||||||
ret += ((InstanceMap*)mitr->second)->GetPlayers().getSize();
|
ret += ((InstanceMap*)mitr->second)->GetPlayers().getSize();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
class Transport;
|
class Transport;
|
||||||
|
|
||||||
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD 1000
|
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD 1100
|
||||||
|
|
||||||
class TRINITY_DLL_DECL MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLockable<MapManager, ACE_Thread_Mutex> >
|
class TRINITY_DLL_DECL MapManager : public Trinity::Singleton<MapManager, Trinity::ClassLevelLockable<MapManager, ACE_Thread_Mutex> >
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4772,16 +4772,6 @@ void AuraEffect::HandlePeriodicTriggerSpell(bool apply, bool Real, bool /*change
|
|||||||
void AuraEffect::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real, bool /*changeAmount*/)
|
void AuraEffect::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real, bool /*changeAmount*/)
|
||||||
{
|
{
|
||||||
m_isPeriodic = apply;
|
m_isPeriodic = apply;
|
||||||
|
|
||||||
SpellEntry const* spell = GetSpellProto();
|
|
||||||
switch (spell->Id)
|
|
||||||
{
|
|
||||||
case 58730: // No fly zone - Wintergrasp (3.1.3 only 3.2.2 Does not call this aura)
|
|
||||||
if (apply)
|
|
||||||
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
((Player *)m_target)->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuraEffect::HandlePeriodicEnergize(bool apply, bool Real, bool changeAmount)
|
void AuraEffect::HandlePeriodicEnergize(bool apply, bool Real, bool changeAmount)
|
||||||
|
|||||||
Reference in New Issue
Block a user