[11226] More strict checks for insatance data load.

This commit is contained in:
VladimirMangos 2011-03-06 17:11:57 +03:00
parent a3f9d3a4dc
commit 275928e504
2 changed files with 18 additions and 4 deletions

View file

@ -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);
}
}
@ -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);
@ -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)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11225"
#define REVISION_NR "11226"
#endif // __REVISION_NR_H__