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:
n0n4m3
2009-12-21 07:58:19 +01:00
parent 865e97729f
commit c3ee3f537d
5 changed files with 37 additions and 82 deletions
-5
View File
@@ -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)
-11
View File
@@ -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
+11 -30
View File
@@ -42,8 +42,9 @@ 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));
}
@@ -58,8 +59,7 @@ MapManager::~MapManager()
Map::DeleteStateMachine();
}
void
MapManager::Initialize()
void MapManager::Initialize()
{
Map::InitStateMachine();
@@ -70,12 +70,10 @@ MapManager::Initialize()
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)
abort();
#endif
InitMaxInstanceId();
}
@@ -111,8 +109,7 @@ void MapManager::checkAndCorrectGridStatesArray()
++i_GridStateErrorCount;
}
Map*
MapManager::_createBaseMap(uint32 id)
Map* MapManager::_createBaseMap(uint32 id)
{
Map *m = _findMap(id);
@@ -159,14 +156,11 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
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)
@@ -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)
}
}
@@ -297,15 +289,13 @@ 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())
@@ -317,22 +307,13 @@ MapManager::Update(uint32 diff)
}
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());
}
#endif
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,10 +350,8 @@ void MapManager::UnloadAll()
i_maps.erase(i_maps.begin());
}
#ifdef MULTI_THREAD_MAP
if (m_updater.activated())
m_updater.deactivate();
#endif
}
void MapManager::InitMaxInstanceId()
@@ -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,7 +391,8 @@ 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())
+1 -1
View File
@@ -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> >
{
-10
View File
@@ -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)