Skip to content

Commit 9ac1ded

Browse files
authored
Update cleaners.cpp - Remove plant cleaning (just rainwater)
1 parent a4ccb44 commit 9ac1ded

1 file changed

Lines changed: 2 additions & 35 deletions

File tree

plugins/cleaners.cpp

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include "df/builtin_mats.h"
2020
#include "df/item_actual.h"
2121
#include "df/map_block.h"
22-
#include "df/plant.h"
23-
#include "df/plant_spatter.h"
2422
#include "df/spatter.h"
2523
#include "df/unit.h"
2624
#include "df/unit_spatter.h"
@@ -50,7 +48,6 @@ struct clean_options
5048
bool only = false; // Ignore blood/other when doing map, only do specified options
5149
bool units = false; // Clean spatter from units
5250
bool items = false; // Clean spatter from items
53-
bool plants = false; // Clean spatter from plants
5451
bool zlevel = false; // Operate on entire z-levels
5552

5653
static struct_identity _identity;
@@ -66,7 +63,6 @@ static const struct_field_info clean_options_fields[] =
6663
{ struct_field_info::PRIMITIVE, "only", offsetof(clean_options, only), &df::identity_traits<bool>::identity, 0, 0 },
6764
{ struct_field_info::PRIMITIVE, "units", offsetof(clean_options, units), &df::identity_traits<bool>::identity, 0, 0 },
6865
{ struct_field_info::PRIMITIVE, "items", offsetof(clean_options, items), &df::identity_traits<bool>::identity, 0, 0 },
69-
{ struct_field_info::PRIMITIVE, "plants", offsetof(clean_options, plants), &df::identity_traits<bool>::identity, 0, 0 },
7066
{ struct_field_info::PRIMITIVE, "zlevel", offsetof(clean_options, zlevel), &df::identity_traits<bool>::identity, 0, 0 },
7167
{ struct_field_info::END }
7268
};
@@ -340,33 +336,6 @@ command_result cleanunits(color_ostream &out, const cuboid &bounds)
340336
return CR_OK;
341337
}
342338

343-
command_result cleanplants(color_ostream &out, const cuboid &bounds)
344-
{ // Invoked from clean(), already suspended
345-
DEBUG(log, out).print("Cleaning plants...\n");
346-
bool valid_cuboid = bounds.isValid(); // Skip pos check if false
347-
int cleaned_plants = 0, cleaned_total = 0;
348-
for (auto plant : world->plants.all)
349-
{
350-
TRACE(log, out).print("Considering plant <%p>\n", plant);
351-
if (valid_cuboid && !Maps::isPlantInBox(plant, bounds))
352-
continue;
353-
TRACE(log, out).print("Selected\n");
354-
355-
if (!plant->contaminants.empty())
356-
{
357-
for (size_t j = 0; j < plant->contaminants.size(); j++)
358-
delete plant->contaminants[j];
359-
cleaned_plants++;
360-
cleaned_total += plant->contaminants.size();
361-
plant->contaminants.clear();
362-
DEBUG(log, out).print("Cleaned plant <%p>\n", plant);
363-
}
364-
}
365-
if (cleaned_total > 0)
366-
out.print("Removed %d contaminants from %d plants.\n", cleaned_total, cleaned_plants);
367-
return CR_OK;
368-
}
369-
370339
command_result spotclean(color_ostream &out, vector<string> &parameters)
371340
{ // Hotkey command, already suspended
372341
DEBUG(log, out).print("Doing spotclean.\n");
@@ -415,9 +384,9 @@ command_result clean(color_ostream &out, vector<string> &parameters)
415384
bool map_target = options.mud || options.snow || options.item_spat || options.grass;
416385
if (!options.map)
417386
{
418-
if (!options.units && !options.items && !options.plants)
387+
if (!options.units && !options.items)
419388
{
420-
out.printerr("Choose at least: --map, --units, --items, or --plants. Use --all for all.\n");
389+
out.printerr("Choose at least: --map, --units, or --items. Use --all for all.\n");
421390
return CR_WRONG_USAGE;
422391
}
423392
else if (options.item_spat && !options.items)
@@ -481,8 +450,6 @@ command_result clean(color_ostream &out, vector<string> &parameters)
481450
cleanunits(out, bounds);
482451
if(options.items)
483452
cleanitems(out, bounds);
484-
if(options.plants)
485-
cleanplants(out, bounds);
486453
return CR_OK;
487454
}
488455

0 commit comments

Comments
 (0)