| 148 | } |
| 149 | |
| 150 | command_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 | |
| 170 | command_result spotclean (color_ostream &out, vector <string> & parameters) |
| 171 | { |