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

Function ListSquads

library/RemoteTools.cpp:614–640  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612}
613
614static command_result ListSquads(color_ostream &stream,
615 const ListSquadsIn *in, ListSquadsOut *out)
616{
617 auto entity = df::historical_entity::find(df::global::plotinfo->group_id);
618 if (!entity)
619 return CR_NOT_FOUND;
620
621 for (size_t i = 0; i < entity->squads.size(); i++)
622 {
623 auto squad = df::squad::find(entity->squads[i]);
624 if (!squad)
625 continue;
626
627 auto item = out->add_value();
628 item->set_squad_id(squad->id);
629
630 if (squad->name.has_name)
631 describeName(item->mutable_name(), &squad->name);
632 if (!squad->alias.empty())
633 item->set_alias(squad->alias);
634
635 for (size_t j = 0; j < squad->positions.size(); j++)
636 item->add_members(squad->positions[j]->occupant);
637 }
638
639 return CR_OK;
640}
641
642static command_result SetUnitLabors(color_ostream &stream, const SetUnitLaborsIn *in)
643{

Callers

nothing calls this directly

Calls 5

add_valueMethod · 0.80
findFunction · 0.50
sizeMethod · 0.45
mutable_nameMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected