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

Function updateReportToRelevantUnits

library/modules/EventManager.cpp:1081–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079}
1080
1081static void updateReportToRelevantUnits() {
1082 if (!df::global::world)
1083 return;
1084 if ( df::global::world->frame_counter <= reportToRelevantUnitsTime )
1085 return;
1086 reportToRelevantUnitsTime = df::global::world->frame_counter;
1087
1088 for (auto unit : df::global::world->units.all) {
1089 for ( int16_t b = df::enum_traits<df::unit_report_type>::first_item_value; b <= df::enum_traits<df::unit_report_type>::last_item_value; b++ ) {
1090 if ( b == df::unit_report_type::Sparring )
1091 continue;
1092 for ( size_t c = 0; c < unit->reports.log[b].size(); c++ ) {
1093 int32_t report = unit->reports.log[b][c];
1094 if ( std::find(reportToRelevantUnits[report].begin(), reportToRelevantUnits[report].end(), unit->id) != reportToRelevantUnits[report].end() )
1095 continue;
1096 reportToRelevantUnits[unit->reports.log[b][c]].push_back(unit->id);
1097 }
1098 }
1099 }
1100}
1101
1102static void manageReportEvent(color_ostream& out) {
1103 if (!df::global::world)

Callers 2

manageUnitAttackEventFunction · 0.85
manageInteractionEventFunction · 0.85

Calls 4

findFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected