Fixes mistake in EventManager::manageTickEvent

develop
Josh Cooper 2021-08-28 13:06:56 -07:00 committed by Myk
parent b8ad0131ea
commit 6ace4b2cf8
1 changed files with 4 additions and 1 deletions

@ -380,13 +380,16 @@ static void manageTickEvent(color_ostream& out) {
return;
for (auto iter = handlers[EventType::TICK].begin(); iter != handlers[EventType::TICK].end(); ) {
EventHandler &handle = iter->second;
//check if we find a handler registered
if ( toRemove.find(handle) == toRemove.end() ) {
//the event is from registerTick, so things are already cleaned up
++iter;
continue;
}
iter = handlers[EventType::TICK].erase(iter);
toRemove.erase(handle);
registerTick(handle, handle.freq, iter->first);
//the handler is registered with the listeners, so we want it to keep listening
registerListener(DFHack::EventManager::EventType::TICK, handle, iter->first);
if ( toRemove.empty() )
break;
}