forked from metin2/server
1
0
Fork 0

Fixed quest server timers cancellation

This commit is contained in:
Exynox 2022-12-24 20:46:00 +02:00
parent f56d5028da
commit a04cd735de
1 changed files with 14 additions and 8 deletions

View File

@ -1724,14 +1724,20 @@ namespace quest
void CQuestManager::CancelServerTimers(DWORD arg)
{
itertype(m_mapServerTimer) it = m_mapServerTimer.begin();
for ( ; it != m_mapServerTimer.end(); ++it) {
if (it->first.second == arg) {
LPEVENT event = it->second;
vector<pair<string, DWORD>> timersToDelete;
// Find server timers that need deleting
for (auto& kv: m_mapServerTimer) {
if (kv.first.second == arg) {
LPEVENT event = kv.second;
event_cancel(&event);
m_mapServerTimer.erase(it);
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)