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

Function manageSyndromeEvent

library/modules/EventManager.cpp:923–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921}
922
923static void manageSyndromeEvent(color_ostream& out) {
924 if (!df::global::world)
925 return;
926 multimap<Plugin*,EventHandler> copy(handlers[EventType::SYNDROME].begin(), handlers[EventType::SYNDROME].end());
927 int32_t highestTime = -1;
928
929 std::vector<SyndromeData> new_syndrome_data;
930 for (auto unit : df::global::world->units.all) {
931
932/*
933 if ( unit->flags1.bits.inactive )
934 continue;
935*/
936 for ( size_t b = 0; b < unit->syndromes.active.size(); b++ ) {
937 df::unit_syndrome* syndrome = unit->syndromes.active[b];
938 int32_t startTime = syndrome->year*ticksPerYear + syndrome->year_time;
939 if ( startTime > highestTime )
940 highestTime = startTime;
941 if ( startTime <= lastSyndromeTime )
942 continue;
943
944 new_syndrome_data.emplace_back(unit->id, b);
945 }
946 }
947 for (auto& data : new_syndrome_data) {
948 for (auto &[_,handle] : copy) {
949 DEBUG(log,out).print("calling handler for syndrome event\n");
950 run_handler(out, EventType::SYNDROME, handle, (void*)&data);
951 }
952 }
953
954 lastSyndromeTime = highestTime;
955}
956
957static void manageInvasionEvent(color_ostream& out) {
958 if (!df::global::plotinfo)

Callers

nothing calls this directly

Calls 5

run_handlerFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected