[11398] Get rid of 2 useless timers and drop a problematic diff in session update

Signed-off-by: Neo2003 <Neo.2003@Hotmail.fr)>
This commit is contained in:
unknown 2011-04-26 18:39:00 +02:00
parent 66598c8815
commit 82367bbdea
6 changed files with 17 additions and 31 deletions

View file

@ -443,7 +443,7 @@ void Map::Update(const uint32 &t_diff)
WorldSession * pSession = plr->GetSession(); WorldSession * pSession = plr->GetSession();
MapSessionFilter updater(pSession); MapSessionFilter updater(pSession);
pSession->Update(t_diff, updater); pSession->Update(updater);
} }
} }

View file

@ -1305,8 +1305,6 @@ void World::SetInitialWorldSettings()
LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)", LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)",
realmID, uint64(m_startTime), isoDate); realmID, uint64(m_startTime), isoDate);
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS); m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILLISECONDS);
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS); m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILLISECONDS);
m_timers[WUPDATE_UPTIME].SetInterval(getConfig(CONFIG_UINT32_UPTIME_UPDATE)*MINUTE*IN_MILLISECONDS); m_timers[WUPDATE_UPTIME].SetInterval(getConfig(CONFIG_UINT32_UPTIME_UPDATE)*MINUTE*IN_MILLISECONDS);
@ -1456,13 +1454,8 @@ void World::Update(uint32 diff)
sAuctionMgr.Update(); sAuctionMgr.Update();
} }
/// <li> Handle session updates when the timer has passed /// <li> Handle session updates
if (m_timers[WUPDATE_SESSIONS].Passed()) UpdateSessions(diff);
{
m_timers[WUPDATE_SESSIONS].Reset();
UpdateSessions(diff);
}
/// <li> Handle weather updates when the timer has passed /// <li> Handle weather updates when the timer has passed
if (m_timers[WUPDATE_WEATHERS].Passed()) if (m_timers[WUPDATE_WEATHERS].Passed())
@ -1494,14 +1487,9 @@ void World::Update(uint32 diff)
} }
/// <li> Handle all other objects /// <li> Handle all other objects
if (m_timers[WUPDATE_OBJECTS].Passed()) ///- Update objects (maps, transport, creatures,...)
{ sMapMgr.Update(diff);
m_timers[WUPDATE_OBJECTS].Reset(); sBattleGroundMgr.Update(diff);
///- Update objects when the timer has passed (maps, transport, creatures,...)
sMapMgr.Update(diff); // As interval = 0
sBattleGroundMgr.Update(diff);
}
///- Delete all characters which have been deleted X days before ///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed()) if (m_timers[WUPDATE_DELETECHARS].Passed())
@ -1917,7 +1905,7 @@ void World::UpdateSessions( uint32 diff )
WorldSession * pSession = itr->second; WorldSession * pSession = itr->second;
WorldSessionFilter updater(pSession); WorldSessionFilter updater(pSession);
if(!pSession->Update(diff, updater)) // As interval = 0 if(!pSession->Update(updater))
{ {
RemoveQueuedSession(pSession); RemoveQueuedSession(pSession);
m_sessions.erase(itr); m_sessions.erase(itr);

View file

@ -71,15 +71,13 @@ enum ShutdownExitCode
/// Timers for different object refresh rates /// Timers for different object refresh rates
enum WorldTimers enum WorldTimers
{ {
WUPDATE_OBJECTS = 0, WUPDATE_AUCTIONS = 0,
WUPDATE_SESSIONS = 1, WUPDATE_WEATHERS = 1,
WUPDATE_AUCTIONS = 2, WUPDATE_UPTIME = 2,
WUPDATE_WEATHERS = 3, WUPDATE_CORPSES = 3,
WUPDATE_UPTIME = 4, WUPDATE_EVENTS = 4,
WUPDATE_CORPSES = 5, WUPDATE_DELETECHARS = 5,
WUPDATE_EVENTS = 6, WUPDATE_COUNT = 6
WUPDATE_DELETECHARS = 7,
WUPDATE_COUNT = 8
}; };
/// Configuration elements /// Configuration elements

View file

@ -197,7 +197,7 @@ void WorldSession::LogUnprocessedTail(WorldPacket *packet)
} }
/// Update the WorldSession (triggered by World update) /// Update the WorldSession (triggered by World update)
bool WorldSession::Update(uint32 diff, PacketFilter& updater) bool WorldSession::Update(PacketFilter& updater)
{ {
///- Retrieve packets from the receive queue and call the appropriate handlers ///- Retrieve packets from the receive queue and call the appropriate handlers
/// not process packets if socket already closed /// not process packets if socket already closed

View file

@ -285,7 +285,7 @@ class MANGOS_DLL_SPEC WorldSession
void QueuePacket(WorldPacket* new_packet); void QueuePacket(WorldPacket* new_packet);
bool Update(uint32 diff, PacketFilter& updater); bool Update(PacketFilter& updater);
/// Handle the authentication waiting queue (to be completed) /// Handle the authentication waiting queue (to be completed)
void SendAuthWaitQue(uint32 position); void SendAuthWaitQue(uint32 position);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11397" #define REVISION_NR "11398"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__