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

Method registerTick

library/modules/EventManager.cpp:81–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81int32_t DFHack::EventManager::registerTick(EventHandler handler, int32_t when, bool absolute) {
82 if ( !absolute ) {
83 df::world* world = df::global::world;
84 if ( world ) {
85 when += world->frame_counter;
86 } else {
87 if ( Once::doOnce("EventManager registerTick unhonored absolute=false") )
88 Core::getInstance().getConsole().print("EventManager::registerTick: warning! absolute flag=false not honored.\n");
89 }
90 }
91 handler.freq = when;
92 tickQueue.insert(pair<int32_t, EventHandler>(handler.freq, handler));
93 DEBUG(log).print("registering handler {} from plugin {} for event TICK\n",
94 reinterpret_cast<void*>(handler.eventHandler),
95 handler.plugin ? handler.plugin->getName() : "<null>");
96 handlers[EventType::TICK].insert(pair<Plugin*,EventHandler>(handler.plugin,handler));
97 return when;
98}
99
100static void removeFromTickQueue(EventHandler getRidOf) {
101 for ( auto j = tickQueue.find(getRidOf.freq); j != tickQueue.end(); ) {

Callers

nothing calls this directly

Calls 3

printMethod · 0.45
insertMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected