Skip to content

Commit

Permalink
[11226] More strict checks for insatance data load.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Mar 6, 2011
1 parent 967c47c commit 2902c34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/game/MapPersistentStateMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,20 @@ void DungeonResetScheduler::LoadResetTimes()
{
do
{
if(time_t resettime = time_t((*result)[3].GetUInt64()))
if (time_t resettime = time_t((*result)[3].GetUInt64()))
{
uint32 id = (*result)[0].GetUInt32();
uint32 mapid = (*result)[1].GetUInt32();
uint32 difficulty = (*result)[2].GetUInt32();

MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);

if (!mapEntry || !mapEntry->IsDungeon() || !GetMapDifficultyData(mapid, Difficulty(difficulty)))
{
sMapPersistentStateMgr.DeleteInstanceFromDB(id);
continue;
}

instResetTime[id] = ResetTimeMapDiffType(MAKE_PAIR32(mapid,difficulty), resettime);
}
}
Expand Down Expand Up @@ -362,8 +371,9 @@ void DungeonResetScheduler::LoadResetTimes()
Difficulty difficulty = Difficulty(fields[1].GetUInt32());
uint64 oldresettime = fields[2].GetUInt64();

MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
if(!mapDiff)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);

if (!mapEntry || !mapEntry->IsDungeon() || !GetMapDifficultyData(mapid,difficulty))
{
sLog.outError("MapPersistentStateManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid,difficulty);
Expand Down Expand Up @@ -397,6 +407,10 @@ void DungeonResetScheduler::LoadResetTimes()
if (!mapDiff->resetTime)
continue;

MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if (!mapEntry || !mapEntry->IsDungeon())
continue;

uint32 period = GetMaxResetTimeFor(mapDiff);
time_t t = GetResetTimeFor(mapid,difficulty);
if(!t)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11225"
#define REVISION_NR "11226"
#endif // __REVISION_NR_H__

0 comments on commit 2902c34

Please sign in to comment.