aboutsummaryrefslogtreecommitdiff
path: root/src/game/InstanceSaveMgr.cpp
diff options
context:
space:
mode:
authorAstellar <none@none>2010-01-06 20:43:41 +0300
committerAstellar <none@none>2010-01-06 20:43:41 +0300
commit3c3197ae71efffe723fa4b252f98d6f500d73ce4 (patch)
tree9ebc48e2aa27c804722d21be493b1c8ab0228efb /src/game/InstanceSaveMgr.cpp
parent15618563ef38f06c758d660cf94c9baf02f350c1 (diff)
Reverted commit ba4294dec1. n0n4m3 asked me to do it.
--HG-- branch : trunk
Diffstat (limited to 'src/game/InstanceSaveMgr.cpp')
-rw-r--r--src/game/InstanceSaveMgr.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index dbb4414949f..eb0368875b6 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -535,12 +535,10 @@ void InstanceSaveManager::LoadResetTimes()
// schedule the global reset/warning
uint8 type = 1;
static int tim[4] = {3600, 900, 300, 60};
- for(type; type < 4; type++)
+ for(; type < 4; type++)
if(t - tim[type-1] > now)
break;
- ScheduleReset(true, t - tim[type-1], InstResetEvent(type, mapid, difficulty, -1));
-
for(ResetTimeMapDiffInstances::const_iterator in_itr = mapDiffResetInstances.lower_bound(map_diff_pair);
in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
{
@@ -645,8 +643,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
if (!mapEntry->Instanceable())
return;
- time_t now = time(NULL);
- time_t today = (now / DAY) * DAY;
+ uint64 now = (uint64)time(NULL);
if(!warn)
{
@@ -675,12 +672,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
// calculate the next reset time
uint32 diff = sWorld.getConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
- uint32 period = (mapDiff->resetTime / DAY * sWorld.getRate(RATE_INSTANCE_RESET_TIME)) * DAY;
- time_t next_reset = today + period + diff;
+ uint32 period = mapDiff->resetTime * DAY;
+ uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff;
// update it in the DB
- CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", (uint64)next_reset, mapid, difficulty);
- SetResetTimeFor(mapid,difficulty,(uint64)next_reset);
- ScheduleReset(true, next_reset-3600, InstResetEvent(1, mapid, difficulty, -1));
+ CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", next_reset, mapid, difficulty);
}
// note: this isn't fast but it's meant to be executed very rarely