diff options
author | Spp <none@none> | 2010-04-28 21:41:22 +0200 |
---|---|---|
committer | Spp <none@none> | 2010-04-28 21:41:22 +0200 |
commit | 6014f6e583fc387a93d7e783ea03178c9e955e07 (patch) | |
tree | a291d459becccc933e776d5fe2e320af585bd72d /src/game/BattleGroundMgr.cpp | |
parent | 453e3e89761abf3632b731d454281323f8b2788b (diff) |
Fix arena point distribution time initialization.
If timer in the past update to current time
Thanks to "p.alexej" for pointing it out.
--HG--
branch : trunk
Diffstat (limited to 'src/game/BattleGroundMgr.cpp')
-rw-r--r-- | src/game/BattleGroundMgr.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 82b4a1c619f..1bb25606870 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1770,21 +1770,20 @@ void BattleGroundMgr::CreateInitialBattleGrounds() void BattleGroundMgr::InitAutomaticArenaPointDistribution() { - if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) - { - sLog.outDebug("Initializing Automatic Arena Point Distribution"); - uint64 wstime = sWorld.getWorldState(WS_ARENA_DISTRIBUTION_TIME); + if (!sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS)) + return; - if (!wstime) - { - sLog.outDebug("Battleground: Next arena point distribution time not found, reseting it now."); - m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); - sWorld.setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime)); - } - else - m_NextAutoDistributionTime = time_t(wstime); - sLog.outDebug("Automatic Arena Point Distribution initialized."); + uint64 wstime = sWorld.getWorldState(WS_ARENA_DISTRIBUTION_TIME); + time_t curtime = time(NULL); + sLog.outDebug("Initializing Automatic Arena Point Distribution"); + if (wstime < curtime) + { + m_NextAutoDistributionTime = curtime; // reset will be called in the next update + sLog.outDebug("Battleground: Next arena point distribution time in the past, reseting it now."); } + else + m_NextAutoDistributionTime = time_t(wstime); + sLog.outDebug("Automatic Arena Point Distribution initialized."); } void BattleGroundMgr::DistributeArenaPoints() |