Skip to content

Commit

Permalink
[10718] Partly revert "[10687] UInt32 timer class copies instead usin…
Browse files Browse the repository at this point in the history
…g time_t timers for mstime cases."

This reverts commit 967877f
in part MapManager/World timers.

Main reason: unclear source cases wrong mstime diff generation at WorldRunnable level at *nix systems.
So need have existed in past hacks that skip its.
  • Loading branch information
VladimirMangos authored and tomrus88 committed Nov 15, 2010
1 parent ed66cc5 commit eab2e4b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/game/MapManager.cpp
Expand Up @@ -246,10 +246,10 @@ MapManager::Update(uint32 diff)
return;

for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
iter->second->Update(i_timer.GetCurrent());
iter->second->Update((uint32)i_timer.GetCurrent());

for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
(*iter)->Update(i_timer.GetCurrent());
(*iter)->Update((uint32)i_timer.GetCurrent());

i_timer.SetCurrent(0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/MapManager.h
Expand Up @@ -171,7 +171,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
typedef MaNGOS::ClassLevelLockable<MapManager, ACE_Thread_Mutex>::Lock Guard;
uint32 i_gridCleanUpDelay;
MapMapType i_maps;
ShortIntervalTimer i_timer;
IntervalTimer i_timer;
};

#define sMapMgr MapManager::Instance()
Expand Down
9 changes: 7 additions & 2 deletions src/game/World.cpp
Expand Up @@ -1287,7 +1287,7 @@ void World::SetInitialWorldSettings()
//one second is 1000 -(tested on win system)
mail_timer = uint32((((localtime( &m_gameTime )->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval() );
//1440
mail_timer_expires = (DAY * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval();
mail_timer_expires = uint32( (DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
DEBUG_LOG("Mail timer set to: %u, mail return is called every %u minutes", mail_timer, mail_timer_expires);

///- Initialize static helper structures
Expand Down Expand Up @@ -1385,7 +1385,12 @@ void World::Update(uint32 diff)
{
///- Update the different timers
for(int i = 0; i < WUPDATE_COUNT; ++i)
m_timers[i].Update(diff);
{
if (m_timers[i].GetCurrent()>=0)
m_timers[i].Update(diff);
else
m_timers[i].SetCurrent(0);
}

///- Update the game time and check for shutdown time
_UpdateGameTime();
Expand Down
2 changes: 1 addition & 1 deletion src/game/World.h
Expand Up @@ -620,7 +620,7 @@ class World

time_t m_startTime;
time_t m_gameTime;
ShortIntervalTimer m_timers[WUPDATE_COUNT];
IntervalTimer m_timers[WUPDATE_COUNT];
uint32 mail_timer;
uint32 mail_timer_expires;

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10717"
#define REVISION_NR "10718"
#endif // __REVISION_NR_H__

0 comments on commit eab2e4b

Please sign in to comment.