Various Cleanups (game L-M)

This commit is contained in:
Schmoozerd 2012-07-19 21:46:40 +02:00
parent 2bd41afb3e
commit 8d0c106aa4
29 changed files with 2201 additions and 2163 deletions

View file

@ -36,14 +36,14 @@
#include "InstanceData.h"
#include "ProgressBar.h"
INSTANTIATE_SINGLETON_1( MapPersistentStateManager );
INSTANTIATE_SINGLETON_1(MapPersistentStateManager);
static uint32 resetEventTypeDelay[MAX_RESET_EVENT_TYPE] = { 0, 3600, 900, 300, 60 };
//== MapPersistentState functions ==========================
MapPersistentState::MapPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty)
: m_instanceid(InstanceId), m_mapid(MapId),
m_difficulty(difficulty), m_usedByMap(NULL)
: m_instanceid(InstanceId), m_mapid(MapId),
m_difficulty(difficulty), m_usedByMap(NULL)
{
}
@ -84,7 +84,7 @@ void MapPersistentState::SaveCreatureRespawnTime(uint32 loguid, time_t t)
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM creature_respawn WHERE guid = ? AND instance = ?");
stmt.PExecute(loguid, m_instanceid);
if(t > sWorld.GetGameTime())
if (t > sWorld.GetGameTime())
{
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO creature_respawn VALUES ( ?, ?, ? )");
stmt.PExecute(loguid, uint64(t), m_instanceid);
@ -109,7 +109,7 @@ void MapPersistentState::SaveGORespawnTime(uint32 loguid, time_t t)
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM gameobject_respawn WHERE guid = ? AND instance = ?");
stmt.PExecute(loguid, m_instanceid);
if(t > sWorld.GetGameTime())
if (t > sWorld.GetGameTime())
{
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO gameobject_respawn VALUES ( ?, ?, ? )");
stmt.PExecute(loguid, uint64(t), m_instanceid);
@ -118,7 +118,7 @@ void MapPersistentState::SaveGORespawnTime(uint32 loguid, time_t t)
CharacterDatabase.CommitTransaction();
}
void MapPersistentState::SetCreatureRespawnTime( uint32 loguid, time_t t )
void MapPersistentState::SetCreatureRespawnTime(uint32 loguid, time_t t)
{
if (t > sWorld.GetGameTime())
m_creatureRespawnTimes[loguid] = t;
@ -129,7 +129,7 @@ void MapPersistentState::SetCreatureRespawnTime( uint32 loguid, time_t t )
}
}
void MapPersistentState::SetGORespawnTime( uint32 loguid, time_t t )
void MapPersistentState::SetGORespawnTime(uint32 loguid, time_t t)
{
if (t > sWorld.GetGameTime())
m_goRespawnTimes[loguid] = t;
@ -148,7 +148,7 @@ void MapPersistentState::ClearRespawnTimes()
UnloadIfEmpty();
}
void MapPersistentState::AddCreatureToGrid( uint32 guid, CreatureData const* data )
void MapPersistentState::AddCreatureToGrid(uint32 guid, CreatureData const* data)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@ -156,7 +156,7 @@ void MapPersistentState::AddCreatureToGrid( uint32 guid, CreatureData const* dat
m_gridObjectGuids[cell_id].creatures.insert(guid);
}
void MapPersistentState::RemoveCreatureFromGrid( uint32 guid, CreatureData const* data )
void MapPersistentState::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@ -164,7 +164,7 @@ void MapPersistentState::RemoveCreatureFromGrid( uint32 guid, CreatureData const
m_gridObjectGuids[cell_id].creatures.erase(guid);
}
void MapPersistentState::AddGameobjectToGrid( uint32 guid, GameObjectData const* data )
void MapPersistentState::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@ -172,7 +172,7 @@ void MapPersistentState::AddGameobjectToGrid( uint32 guid, GameObjectData const*
m_gridObjectGuids[cell_id].gameobjects.insert(guid);
}
void MapPersistentState::RemoveGameobjectFromGrid( uint32 guid, GameObjectData const* data )
void MapPersistentState::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
@ -206,21 +206,21 @@ bool WorldPersistentState::CanBeUnload() const
//== DungeonPersistentState functions =====================
DungeonPersistentState::DungeonPersistentState( uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask)
: MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset), m_completedEncountersMask(completedEncountersMask)
DungeonPersistentState::DungeonPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask)
: MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset), m_completedEncountersMask(completedEncountersMask)
{
}
DungeonPersistentState::~DungeonPersistentState()
{
while(!m_playerList.empty())
while (!m_playerList.empty())
{
Player *player = *(m_playerList.begin());
Player* player = *(m_playerList.begin());
player->UnbindInstance(GetMapId(), GetDifficulty(), true);
}
while(!m_groupList.empty())
while (!m_groupList.empty())
{
Group *group = *(m_groupList.begin());
Group* group = *(m_groupList.begin());
group->UnbindInstance(GetMapId(), GetDifficulty(), true);
}
}
@ -239,10 +239,10 @@ void DungeonPersistentState::SaveToDB()
// state instance data too
std::string data;
if (Map *map = GetMap())
if (Map* map = GetMap())
{
InstanceData *iData = map->GetInstanceData();
if(iData && iData->Save())
InstanceData* iData = map->GetInstanceData();
if (iData && iData->Save())
{
data = iData->Save();
CharacterDatabase.escape_string(data);
@ -276,8 +276,8 @@ InstanceTemplate const* DungeonPersistentState::GetTemplate() const
time_t DungeonPersistentState::GetResetTimeForDB() const
{
// only state the reset time for normal instances
const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
const MapEntry* entry = sMapStore.LookupEntry(GetMapId());
if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
return 0;
else
return GetResetTime();
@ -353,8 +353,8 @@ void DungeonResetScheduler::LoadResetTimes()
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
InstResetTimeMapDiffType instResetTime;
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
if( result )
QueryResult* result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
if (result)
{
do
{
@ -380,7 +380,7 @@ void DungeonResetScheduler::LoadResetTimes()
// update reset time for normal instances with the max creature respawn time + X hours
result = CharacterDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
if( result )
if (result)
{
do
{
@ -390,7 +390,7 @@ void DungeonResetScheduler::LoadResetTimes()
uint32 instance = fields[1].GetUInt32();
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
if(itr != instResetTime.end() && itr->second.second != resettime)
if (itr != instResetTime.end() && itr->second.second != resettime)
{
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
itr->second.second = resettime;
@ -401,15 +401,15 @@ void DungeonResetScheduler::LoadResetTimes()
}
// schedule the reset times
for(InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
if(itr->second.second > now)
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
if (itr->second.second > now)
ScheduleReset(true, itr->second.second, DungeonResetEvent(RESET_EVENT_NORMAL_DUNGEON, PAIR32_LOPART(itr->second.first),Difficulty(PAIR32_HIPART(itr->second.first)),itr->first));
}
// load the global respawn times for raid/heroic instances
uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR;
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
if(result)
if (result)
{
do
{
@ -430,11 +430,12 @@ void DungeonResetScheduler::LoadResetTimes()
// update the reset time if the hour in the configs changes
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
if(oldresettime != newresettime)
if (oldresettime != newresettime)
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
SetResetTimeFor(mapid,difficulty,newresettime);
} while(result->NextRow());
}
while (result->NextRow());
delete result;
}
@ -444,7 +445,7 @@ void DungeonResetScheduler::LoadResetTimes()
// calculate new global reset times for expired instances and those that have never been reset yet
// add the global reset times to the priority queue
for(MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
for (MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
{
uint32 map_diff_pair = itr->first;
uint32 mapid = PAIR32_LOPART(map_diff_pair);
@ -461,14 +462,14 @@ void DungeonResetScheduler::LoadResetTimes()
uint32 period = GetMaxResetTimeFor(mapDiff);
time_t t = GetResetTimeFor(mapid,difficulty);
if(!t)
if (!t)
{
// initialize the reset time
t = today + period + diff;
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
}
if(t < now)
if (t < now)
{
// assume that expired instances have already been cleaned
// calculate the next reset time
@ -481,8 +482,8 @@ void DungeonResetScheduler::LoadResetTimes()
// schedule the global reset/warning
ResetEventType type = RESET_EVENT_INFORM_1;
for(; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type+1))
if(t - resetEventTypeDelay[type] > now)
for (; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type+1))
if (t - resetEventTypeDelay[type] > now)
break;
ScheduleReset(true, t - resetEventTypeDelay[type], DungeonResetEvent(type, mapid, difficulty, 0));
@ -499,7 +500,7 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
ResetTimeQueue::iterator itr;
std::pair<ResetTimeQueue::iterator, ResetTimeQueue::iterator> range;
range = m_resetTimeQueue.equal_range(time);
for(itr = range.first; itr != range.second; ++itr)
for (itr = range.first; itr != range.second; ++itr)
{
if (itr->second == event)
{
@ -508,18 +509,18 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
}
}
// in case the reset time changed (should happen very rarely), we search the whole queue
if(itr == range.second)
if (itr == range.second)
{
for(itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
for (itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
{
if(itr->second == event)
if (itr->second == event)
{
m_resetTimeQueue.erase(itr);
return;
}
}
if(itr == m_resetTimeQueue.end())
if (itr == m_resetTimeQueue.end())
sLog.outError("DungeonResetScheduler::ScheduleReset: cannot cancel the reset, the event(%d,%d,%d) was not found!", event.type, event.mapid, event.instanceId);
}
}
@ -528,9 +529,9 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
void DungeonResetScheduler::Update()
{
time_t now = time(NULL), t;
while(!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
while (!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
{
DungeonResetEvent &event = m_resetTimeQueue.begin()->second;
DungeonResetEvent& event = m_resetTimeQueue.begin()->second;
if (event.type == RESET_EVENT_NORMAL_DUNGEON)
{
// for individual normal instances, max creature respawn + X hours
@ -597,7 +598,7 @@ MapPersistentStateManager::~MapPersistentStateManager()
*/
MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load /*=false*/, bool initPools /*= true*/, uint32 completedEncountersMask /*= 0*/)
{
if (MapPersistentState *old_save = GetPersistentState(mapEntry->MapID, instanceId))
if (MapPersistentState* old_save = GetPersistentState(mapEntry->MapID, instanceId))
return old_save;
if (mapEntry->IsDungeon())
@ -619,7 +620,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
DEBUG_LOG("MapPersistentStateManager::AddPersistentState: mapid = %d, instanceid = %d, reset time = %u, canRset = %u", mapEntry->MapID, instanceId, resetTime, canReset ? 1 : 0);
MapPersistentState *state;
MapPersistentState* state;
if (mapEntry->IsDungeon())
{
DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, resetTime, canReset, completedEncountersMask);
@ -644,7 +645,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
return state;
}
MapPersistentState *MapPersistentStateManager::GetPersistentState(uint32 mapId, uint32 instanceId)
MapPersistentState* MapPersistentStateManager::GetPersistentState(uint32 mapId, uint32 instanceId)
{
if (instanceId)
{
@ -698,7 +699,7 @@ void MapPersistentStateManager::RemovePersistentState(uint32 mapId, uint32 insta
}
}
void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...)
void MapPersistentStateManager::_DelHelper(DatabaseType& db, const char* fields, const char* table, const char* queryTail,...)
{
Tokens fieldTokens = StrSplit(fields, ", ");
MANGOS_ASSERT(fieldTokens.size() != 0);
@ -706,24 +707,25 @@ void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields,
va_list ap;
char szQueryTail [MAX_QUERY_LEN];
va_start(ap, queryTail);
vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap );
vsnprintf(szQueryTail, MAX_QUERY_LEN, queryTail, ap);
va_end(ap);
QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
if(result)
QueryResult* result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
if (result)
{
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
std::ostringstream ss;
for(size_t i = 0; i < fieldTokens.size(); i++)
for (size_t i = 0; i < fieldTokens.size(); i++)
{
std::string fieldValue = fields[i].GetCppString();
db.escape_string(fieldValue);
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
}
db.PExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
} while (result->NextRow());
}
while (result->NextRow());
delete result;
}
}
@ -756,7 +758,7 @@ void MapPersistentStateManager::CleanupInstances()
bar.step();
sLog.outString();
sLog.outString( ">> Instances cleaned up");
sLog.outString(">> Instances cleaned up");
}
void MapPersistentStateManager::PackInstances()
@ -770,12 +772,12 @@ void MapPersistentStateManager::PackInstances()
// all valid ids are in the instance table
// any associations to ids not in this table are assumed to be
// cleaned already in CleanupInstances
QueryResult *result = CharacterDatabase.Query("SELECT id FROM instance");
if( result )
QueryResult* result = CharacterDatabase.Query("SELECT id FROM instance");
if (result)
{
do
{
Field *fields = result->Fetch();
Field* fields = result->Fetch();
InstanceSet.insert(fields[0].GetUInt32());
}
while (result->NextRow());
@ -807,11 +809,11 @@ void MapPersistentStateManager::PackInstances()
bar.step();
}
sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber );
sLog.outString(">> Instance numbers remapped, next instance id is %u", InstanceNumber);
sLog.outString();
}
void MapPersistentStateManager::_ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator &itr)
void MapPersistentStateManager::_ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator& itr)
{
// unbind all players bound to the instance
// do not allow UnbindInstance to automatically unload the InstanceSaves
@ -829,7 +831,7 @@ void MapPersistentStateManager::_ResetInstance(uint32 mapid, uint32 instanceId)
if (itr != m_instanceSaveByInstanceId.end())
{
// delay reset until map unload for loaded map
if (Map * iMap = itr->second->GetMap())
if (Map* iMap = itr->second->GetMap())
{
MANGOS_ASSERT(iMap->IsDungeon());
@ -847,7 +849,7 @@ void MapPersistentStateManager::_ResetInstance(uint32 mapid, uint32 instanceId)
void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, uint32 timeLeft)
{
// global reset for all instances of the given map
MapEntry const *mapEntry = sMapStore.LookupEntry(mapid);
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
if (!mapEntry->Instanceable())
return;
@ -863,7 +865,7 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
}
// remove all binds to instances of the given map
for(PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
{
if (itr->second->GetMapId() == mapid && itr->second->GetDifficulty() == difficulty)
_ResetSave(m_instanceSaveByInstanceId, itr);
@ -888,10 +890,10 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
const MapManager::MapMapType& maps = sMapMgr.Maps();
MapManager::MapMapType::const_iterator iter_last = maps.lower_bound(MapID(mapid + 1));
for(MapManager::MapMapType::const_iterator mitr = maps.lower_bound(MapID(mapid)); mitr != iter_last; ++mitr)
for (MapManager::MapMapType::const_iterator mitr = maps.lower_bound(MapID(mapid)); mitr != iter_last; ++mitr)
{
Map *map2 = mitr->second;
if(map2->GetId() != mapid)
Map* map2 = mitr->second;
if (map2->GetId() != mapid)
break;
if (warn)
@ -908,7 +910,7 @@ void MapPersistentStateManager::GetStatistics(uint32& numStates, uint32& numBoun
numBoundGroups = 0;
// only instanceable maps have bounds
for(PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
{
if (!itr->second->GetMapEntry()->IsDungeon())
continue;
@ -919,16 +921,16 @@ void MapPersistentStateManager::GetStatistics(uint32& numStates, uint32& numBoun
}
}
void MapPersistentStateManager::_CleanupExpiredInstancesAtTime( time_t t )
void MapPersistentStateManager::_CleanupExpiredInstancesAtTime(time_t t)
{
_DelHelper(CharacterDatabase, "id, map, instance.difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map AND instance.difficulty = instance_reset.difficulty WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)t, (uint64)t);
_DelHelper(CharacterDatabase, "id, map, instance.difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map AND instance.difficulty = instance_reset.difficulty WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)t, (uint64)t);
}
void MapPersistentStateManager::InitWorldMaps()
{
MapPersistentState* state = NULL; // need any from created for shared pool state
for(uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid)
for (uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid)
if (MapEntry const* entry = sMapStore.LookupEntry(mapid))
if (!entry->Instanceable())
state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, true, false);
@ -945,7 +947,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
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)
{
BarGoLink bar(1);
@ -994,7 +996,8 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;
@ -1010,7 +1013,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
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)
{
@ -1060,7 +1063,8 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
++count;
} while (result->NextRow());
}
while (result->NextRow());
delete result;