MCPcopy Create free account
hub / github.com/DFHack/dfhack / manageTickEvent

Function manageTickEvent

library/modules/EventManager.cpp:445–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445static void manageTickEvent(color_ostream& out) {
446 if (!df::global::world)
447 return;
448 unordered_set<EventHandler> toRemove;
449 int32_t tick = df::global::world->frame_counter;
450 while ( !tickQueue.empty() ) {
451 if ( tick < (*tickQueue.begin()).first )
452 break;
453 EventHandler &handle = (*tickQueue.begin()).second;
454 tickQueue.erase(tickQueue.begin());
455 DEBUG(log,out).print("calling handler for tick event\n");
456 run_handler(out, EventType::TICK, handle, (void*)intptr_t(tick));
457 toRemove.insert(handle);
458 }
459 if ( toRemove.empty() )
460 return;
461 for ( auto a = handlers[EventType::TICK].begin(); a != handlers[EventType::TICK].end(); ) {
462 EventHandler &handle = (*a).second;
463 if ( toRemove.find(handle) == toRemove.end() ) {
464 a++;
465 continue;
466 }
467 a = handlers[EventType::TICK].erase(a);
468 toRemove.erase(handle);
469 if ( toRemove.empty() )
470 break;
471 }
472}
473
474static void manageJobInitiatedEvent(color_ostream& out) {
475 if (!df::global::world)

Callers

nothing calls this directly

Calls 8

run_handlerFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
eraseMethod · 0.45
printMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected