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

Function cleanplants

plugins/cleaners.cpp:150–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150command_result cleanplants (color_ostream &out)
151{
152 // Invoked from clean(), already suspended
153 int cleaned_plants = 0, cleaned_total = 0;
154 for (auto plant : world->plants.all)
155 {
156 if (plant->contaminants.size())
157 {
158 for (size_t j = 0; j < plant->contaminants.size(); j++)
159 delete plant->contaminants[j];
160 cleaned_plants++;
161 cleaned_total += plant->contaminants.size();
162 plant->contaminants.clear();
163 }
164 }
165 if (cleaned_total)
166 out.print("Removed {} contaminants from {} plants.\n", cleaned_total, cleaned_plants);
167 return CR_OK;
168}
169
170command_result spotclean (color_ostream &out, vector <string> & parameters)
171{

Callers 1

cleanFunction · 0.85

Calls 3

sizeMethod · 0.45
clearMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected