[11810] Fix a bug preventing displaying correct instance reset time

Also do some small style changes in the area

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-09-27 05:00:40 +02:00
parent d55e1b3edb
commit 7279c16533
2 changed files with 32 additions and 31 deletions

View file

@ -385,8 +385,10 @@ void DungeonResetScheduler::LoadResetTimes()
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 instance = fields[1].GetUInt32();
time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR); time_t resettime = time_t(fields[0].GetUInt64() + 2 * HOUR);
uint32 instance = fields[1].GetUInt32();
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance); InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
if(itr != instResetTime.end() && itr->second.second != resettime) if(itr != instResetTime.end() && itr->second.second != resettime)
{ {
@ -412,6 +414,7 @@ void DungeonResetScheduler::LoadResetTimes()
do do
{ {
Field* fields = result->Fetch(); Field* fields = result->Fetch();
uint32 mapid = fields[0].GetUInt32(); uint32 mapid = fields[0].GetUInt32();
Difficulty difficulty = Difficulty(fields[1].GetUInt32()); Difficulty difficulty = Difficulty(fields[1].GetUInt32());
uint64 oldresettime = fields[2].GetUInt64(); uint64 oldresettime = fields[2].GetUInt64();
@ -619,7 +622,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
MapPersistentState *state; MapPersistentState *state;
if (mapEntry->IsDungeon()) if (mapEntry->IsDungeon())
{ {
DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, completedEncountersMask, resetTime, canReset); DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, resetTime, canReset, completedEncountersMask);
if (!load) if (!load)
dungeonState->SaveToDB(); dungeonState->SaveToDB();
state = dungeonState; state = dungeonState;
@ -941,6 +944,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 6
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id"); QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id");
if (!result) if (!result)
{ {
@ -965,9 +969,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
uint32 mapId = fields[2].GetUInt32(); uint32 mapId = fields[2].GetUInt32();
uint32 instanceId = fields[3].GetUInt32(); uint32 instanceId = fields[3].GetUInt32();
uint8 difficulty = fields[4].GetUInt8(); uint8 difficulty = fields[4].GetUInt8();
time_t resetTime = (time_t)fields[5].GetUInt64(); time_t resetTime = (time_t)fields[5].GetUInt64();
uint32 completedEncounters = fields[6].GetUInt32(); uint32 completedEncounters = fields[6].GetUInt32();
CreatureData const* data = sObjectMgr.GetCreatureData(loguid); CreatureData const* data = sObjectMgr.GetCreatureData(loguid);
@ -1007,6 +1009,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
uint32 count = 0; uint32 count = 0;
// 0 1 2 3 4 5 6
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id"); QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
if (!result) if (!result)
@ -1032,9 +1035,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
uint32 mapId = fields[2].GetUInt32(); uint32 mapId = fields[2].GetUInt32();
uint32 instanceId = fields[3].GetUInt32(); uint32 instanceId = fields[3].GetUInt32();
uint8 difficulty = fields[4].GetUInt8(); uint8 difficulty = fields[4].GetUInt8();
time_t resetTime = (time_t)fields[5].GetUInt64(); time_t resetTime = (time_t)fields[5].GetUInt64();
uint32 completedEncounters = fields[6].GetUInt32(); uint32 completedEncounters = fields[6].GetUInt32();
GameObjectData const* data = sObjectMgr.GetGOData(loguid); GameObjectData const* data = sObjectMgr.GetGOData(loguid);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11809" #define REVISION_NR "11810"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__