Fixed quest server timers cancellation

This commit is contained in:
Exynox 2022-12-24 20:46:00 +02:00
parent f56d5028da
commit a04cd735de

View File

@ -1724,14 +1724,20 @@ namespace quest
void CQuestManager::CancelServerTimers(DWORD arg) void CQuestManager::CancelServerTimers(DWORD arg)
{ {
itertype(m_mapServerTimer) it = m_mapServerTimer.begin(); vector<pair<string, DWORD>> timersToDelete;
for ( ; it != m_mapServerTimer.end(); ++it) {
if (it->first.second == arg) { // Find server timers that need deleting
LPEVENT event = it->second; for (auto& kv: m_mapServerTimer) {
event_cancel(&event); if (kv.first.second == arg) {
m_mapServerTimer.erase(it); LPEVENT event = kv.second;
} event_cancel(&event);
} timersToDelete.push_back(kv.first);
}
}
// Delete all the required server timers
for (const auto &timer: timersToDelete)
m_mapServerTimer.erase(timer);
} }
void CQuestManager::SetServerTimerArg(DWORD dwArg) void CQuestManager::SetServerTimerArg(DWORD dwArg)