mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
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(LARGE_CELL "Large cell size" 0)
|
||||
OPTION(CENTOS "CENTOS" 0)
|
||||
OPTION(USE_MULTI_THREAD_MAP "With Multithread maps" 0)
|
||||
|
||||
SET(GENREV_SRC
|
||||
src/tools/genrevision/genrevision.cpp
|
||||
@@ -101,10 +100,6 @@ SET(SCRIPT_LIB trinityinterface)
|
||||
SET(SCRIPT_INCLUDE src/bindings/interface)
|
||||
endif(DO_SCRIPTS)
|
||||
|
||||
IF (USE_MULTI_THREAD_MAP)
|
||||
message("* With Multithread maps")
|
||||
ENDIF (USE_MULTI_THREAD_MAP)
|
||||
|
||||
message("-- Miscellaneus options:")
|
||||
|
||||
if(DO_CLI)
|
||||
|
||||
@@ -155,19 +155,8 @@ typedef uint64 OBJECT_HANDLE;
|
||||
# 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
|
||||
#define CLIENT_VER 313
|
||||
#endif
|
||||
|
||||
#endif //TRINITY_DEFINE_H
|
||||
|
||||
|
||||
@@ -42,40 +42,38 @@ INSTANTIATE_CLASS_MUTEX(MapManager, ACE_Thread_Mutex);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
MapManager::~MapManager()
|
||||
{
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
delete iter->second;
|
||||
delete iter->second;
|
||||
|
||||
for (TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i)
|
||||
delete *i;
|
||||
delete *i;
|
||||
|
||||
Map::DeleteStateMachine();
|
||||
}
|
||||
|
||||
void
|
||||
MapManager::Initialize()
|
||||
void MapManager::Initialize()
|
||||
{
|
||||
Map::InitStateMachine();
|
||||
|
||||
// debugging code, should be deleted some day
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_GRID_STATE; ++i)
|
||||
i_GridStates[i] = si_GridStates[i];
|
||||
i_GridStates[i] = si_GridStates[i];
|
||||
|
||||
i_GridStateErrorCount = 0;
|
||||
}
|
||||
#ifdef MULTI_THREAD_MAP
|
||||
int num_threads(sWorld.getConfig(CONFIG_NUMTHREADS));
|
||||
// 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();
|
||||
#endif
|
||||
|
||||
InitMaxInstanceId();
|
||||
}
|
||||
@@ -92,7 +90,7 @@ void MapManager::checkAndCorrectGridStatesArray()
|
||||
bool ok = true;
|
||||
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 !!!");
|
||||
ok = false;
|
||||
@@ -100,23 +98,22 @@ void MapManager::checkAndCorrectGridStatesArray()
|
||||
}
|
||||
#ifdef TRINITY_DEBUG
|
||||
// inner class checking only when compiled with debug
|
||||
if(!si_GridStates[i]->checkMagic())
|
||||
if (!si_GridStates[i]->checkMagic())
|
||||
{
|
||||
ok = false;
|
||||
si_GridStates[i]->setMagic();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(!ok)
|
||||
if (!ok)
|
||||
++i_GridStateErrorCount;
|
||||
}
|
||||
|
||||
Map*
|
||||
MapManager::_createBaseMap(uint32 id)
|
||||
Map* MapManager::_createBaseMap(uint32 id)
|
||||
{
|
||||
Map *m = _findMap(id);
|
||||
|
||||
if( m == NULL )
|
||||
if (m == NULL)
|
||||
{
|
||||
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 *map = _findMap(mapid);
|
||||
if(!map)
|
||||
if (!map)
|
||||
return NULL;
|
||||
|
||||
if(!map->Instanceable())
|
||||
if (!map->Instanceable())
|
||||
return instanceId == 0 ? map : NULL;
|
||||
|
||||
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)
|
||||
{
|
||||
const MapEntry *entry = sMapStore.LookupEntry(mapid);
|
||||
if(!entry) return false;
|
||||
if(!entry)
|
||||
return false;
|
||||
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
||||
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
// Åñëè ÈÊ èëè È×, òî ïðîâåðÿòü óðîâåíü øìîòà îäåòîãî íà ïåðñå.
|
||||
//if (mapid == 649)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,13 +199,13 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
|
||||
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
|
||||
uint32 instance_map = corpse->GetMapId();
|
||||
do
|
||||
{
|
||||
if(instance_map==mapid)
|
||||
if (instance_map==mapid)
|
||||
break;
|
||||
|
||||
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(instance_map);
|
||||
@@ -236,7 +228,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
}
|
||||
|
||||
InstanceTemplate const* instance = objmgr.GetInstanceTemplate(mapid);
|
||||
if(!instance)
|
||||
if (!instance)
|
||||
return false;
|
||||
|
||||
//Get instance where player's group is bound & its map
|
||||
@@ -297,42 +289,31 @@ void MapManager::RemoveBonesFromMap(uint32 mapid, uint64 guid, float x, float y)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MapManager::Update(uint32 diff)
|
||||
void MapManager::Update(uint32 diff)
|
||||
{
|
||||
i_timer.Update(diff);
|
||||
if (!i_timer.Passed())
|
||||
return;
|
||||
|
||||
MapMapType::iterator iter = i_maps.begin();
|
||||
#ifdef MULTI_THREAD_MAP
|
||||
for(; iter != i_maps.end(); ++iter)
|
||||
{
|
||||
if (m_updater.activated())
|
||||
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
||||
else
|
||||
{
|
||||
iter->second->Update(i_timer.GetCurrent());
|
||||
}
|
||||
}
|
||||
if (m_updater.activated())
|
||||
m_updater.wait();
|
||||
#else
|
||||
for (; iter != i_maps.end(); ++iter)
|
||||
{
|
||||
iter->second->Update(i_timer.GetCurrent());
|
||||
sWorld.RecordTimeDiff("UpdateMap %u", iter->second->GetId());
|
||||
if (m_updater.activated())
|
||||
m_updater.schedule_update(*iter->second, i_timer.GetCurrent());
|
||||
else
|
||||
{
|
||||
iter->second->Update(i_timer.GetCurrent());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (m_updater.activated())
|
||||
m_updater.wait();
|
||||
|
||||
for (iter = i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
iter->second->DelayedUpdate(i_timer.GetCurrent());
|
||||
|
||||
ObjectAccessor::Instance().Update(i_timer.GetCurrent());
|
||||
sWorld.RecordTimeDiff("UpdateObjectAccessor");
|
||||
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
|
||||
(*iter)->Update(i_timer.GetCurrent());
|
||||
sWorld.RecordTimeDiff("UpdateTransports");
|
||||
|
||||
i_timer.SetCurrent(0);
|
||||
}
|
||||
@@ -369,18 +350,16 @@ void MapManager::UnloadAll()
|
||||
i_maps.erase(i_maps.begin());
|
||||
}
|
||||
|
||||
#ifdef MULTI_THREAD_MAP
|
||||
if (m_updater.activated())
|
||||
m_updater.deactivate();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MapManager::InitMaxInstanceId()
|
||||
{
|
||||
i_MaxInstanceId = 0;
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query( "SELECT MAX(id) FROM instance" );
|
||||
if( result )
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT MAX(id) FROM instance");
|
||||
if (result)
|
||||
{
|
||||
i_MaxInstanceId = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
@@ -395,7 +374,8 @@ uint32 MapManager::GetNumInstances()
|
||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
{
|
||||
Map *map = itr->second;
|
||||
if(!map->Instanceable()) continue;
|
||||
if (!map->Instanceable())
|
||||
continue;
|
||||
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
||||
for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr)
|
||||
if(mitr->second->IsDungeon()) ret++;
|
||||
@@ -411,10 +391,11 @@ uint32 MapManager::GetNumPlayersInInstances()
|
||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
{
|
||||
Map *map = itr->second;
|
||||
if(!map->Instanceable()) continue;
|
||||
if (!map->Instanceable())
|
||||
continue;
|
||||
MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps();
|
||||
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();
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
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> >
|
||||
{
|
||||
|
||||
@@ -4772,16 +4772,6 @@ void AuraEffect::HandlePeriodicTriggerSpell(bool apply, bool Real, bool /*change
|
||||
void AuraEffect::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real, bool /*changeAmount*/)
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user