diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index 7f351f209..4eacbe764 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -140,10 +140,6 @@ void InstanceResetScheduler::LoadResetTimes() typedef std::map InstResetTimeMapDiffType; InstResetTimeMapDiffType instResetTime; - // index instance ids by map/difficulty pairs for fast reset warning send - typedef std::multimap ResetTimeMapDiffInstances; - ResetTimeMapDiffInstances mapDiffResetInstances; - QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0"); if( result ) { @@ -155,7 +151,6 @@ void InstanceResetScheduler::LoadResetTimes() uint32 mapid = (*result)[1].GetUInt32(); uint32 difficulty = (*result)[2].GetUInt32(); instResetTime[id] = ResetTimeMapDiffType(MAKE_PAIR32(mapid,difficulty), resettime); - mapDiffResetInstances.insert(ResetTimeMapDiffInstances::value_type(MAKE_PAIR32(mapid,difficulty),id)); } } while (result->NextRow()); @@ -229,6 +224,8 @@ void InstanceResetScheduler::LoadResetTimes() uint32 mapid = PAIR32_LOPART(map_diff_pair); Difficulty difficulty = Difficulty(PAIR32_HIPART(map_diff_pair)); MapDifficulty const* mapDiff = &itr->second; + + // skip mapDiff without global reset time if (!mapDiff->resetTime) continue; @@ -262,11 +259,7 @@ void InstanceResetScheduler::LoadResetTimes() if(t - resetEventTypeDelay[type] > now) break; - for(ResetTimeMapDiffInstances::const_iterator in_itr = mapDiffResetInstances.lower_bound(map_diff_pair); - in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr) - { - ScheduleReset(true, t - resetEventTypeDelay[type], InstanceResetEvent(type, mapid, difficulty, in_itr->second)); - } + ScheduleReset(true, t - resetEventTypeDelay[type], InstanceResetEvent(type, mapid, difficulty, 0)); } } @@ -312,7 +305,7 @@ void InstanceResetScheduler::Update() while(!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now) { InstanceResetEvent &event = m_resetTimeQueue.begin()->second; - if(event.type == 0) + if(event.type == RESET_EVENT_DUNGEON) { // for individual normal instances, max creature respawn + X hours m_InstanceSaves._ResetInstance(event.mapid, event.instanceId); diff --git a/src/game/InstanceSaveMgr.h b/src/game/InstanceSaveMgr.h index fb6ee1d74..4ced07390 100644 --- a/src/game/InstanceSaveMgr.h +++ b/src/game/InstanceSaveMgr.h @@ -135,15 +135,15 @@ enum ResetEventType all instances of that map reset at the same time */ struct InstanceResetEvent { - ResetEventType type :8; - Difficulty difficulty :8; + ResetEventType type :8; // if RESET_EVENT_DUNGEON then InstanceID == 0 and applied to all instances for pair (map,diff) + Difficulty difficulty :8; // used with mapid used as for select reset for global cooldown instances (instamceid==0 for event) uint16 mapid; - uint32 instanceId; + uint32 instanceId; // used for select reset for normal dungeons InstanceResetEvent() : type(RESET_EVENT_DUNGEON), difficulty(DUNGEON_DIFFICULTY_NORMAL), mapid(0), instanceId(0) {} InstanceResetEvent(ResetEventType t, uint32 _mapid, Difficulty d, uint32 _instanceid) : type(t), difficulty(d), mapid(_mapid), instanceId(_instanceid) {} - bool operator == (const InstanceResetEvent& e) { return e.instanceId == instanceId; } + bool operator == (const InstanceResetEvent& e) { return e.mapid == mapid && e.difficulty == difficulty && e.instanceId == instanceId; } }; class InstanceSaveManager; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index efd7d3825..3e4217b1c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10197" + #define REVISION_NR "10198" #endif // __REVISION_NR_H__