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

Function add_assigned_noble_units

library/modules/Units.cpp:696–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694}
695
696static void add_assigned_noble_units(vector<df::unit *> &units,
697 const df::historical_entity::T_positions &positions, int32_t noble_position_id, size_t limit)
698{
699 for (auto assignment : positions.assignments) {
700 if (assignment->position_id != noble_position_id)
701 continue;
702 auto histfig = df::historical_figure::find(assignment->histfig);
703 if (!histfig)
704 continue;
705 auto unit = df::unit::find(histfig->unit_id);
706 if (!unit)
707 continue;
708 units.emplace_back(unit);
709 if (limit > 0 && units.size() >= limit)
710 break;
711 }
712}
713
714static void add_entity_nobles(vector<df::unit *> &units,
715 string noble, size_t limit, df::historical_entity *he)

Callers 1

add_entity_noblesFunction · 0.85

Calls 2

findFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected