mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[10103] More cleanups in InstanceSave
* Use single function for erase element from save list. * Make lock bool checks class local (it need be replaced by normal lock object in future) * Remove redundent now friend class declarations.
This commit is contained in:
parent
f244e68c59
commit
593f1e81b9
4 changed files with 9 additions and 8 deletions
|
|
@ -115,8 +115,7 @@ bool InstanceSave::UnloadIfEmpty()
|
|||
{
|
||||
if(m_playerList.empty() && m_groupList.empty())
|
||||
{
|
||||
if(!sInstanceSaveMgr.lock_instLists)
|
||||
sInstanceSaveMgr.RemoveInstanceSave(GetInstanceId());
|
||||
sInstanceSaveMgr.RemoveInstanceSave(GetInstanceId());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
|
@ -419,14 +418,17 @@ void InstanceSaveManager::DeleteInstanceFromDB(uint32 instanceid)
|
|||
|
||||
void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
|
||||
{
|
||||
if (lock_instLists)
|
||||
return;
|
||||
|
||||
InstanceSaveHashMap::iterator itr = m_instanceSaveById.find( InstanceId );
|
||||
if(itr != m_instanceSaveById.end())
|
||||
{
|
||||
// save the resettime for normal instances only when they get unloaded
|
||||
if(time_t resettime = itr->second->GetResetTimeForDB())
|
||||
CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
|
||||
delete itr->second;
|
||||
m_instanceSaveById.erase(itr);
|
||||
|
||||
_ResetSave(itr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue