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

Function cleanunits

plugins/cleaners.cpp:130–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130command_result cleanunits (color_ostream &out)
131{
132 // Invoked from clean(), already suspended
133 int cleaned_units = 0, cleaned_total = 0;
134 for (auto unit : world->units.active)
135 {
136 if (unit->body.spatters.size())
137 {
138 for (size_t j = 0; j < unit->body.spatters.size(); j++)
139 delete unit->body.spatters[j];
140 cleaned_units++;
141 cleaned_total += unit->body.spatters.size();
142 unit->body.spatters.clear();
143 }
144 }
145 if (cleaned_total)
146 out.print("Removed {} contaminants from {} creatures.\n", cleaned_total, cleaned_units);
147 return CR_OK;
148}
149
150command_result cleanplants (color_ostream &out)
151{

Callers 1

cleanFunction · 0.85

Calls 3

sizeMethod · 0.45
clearMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected