diff options
| author | Alexander Gavrilov | 2012-09-17 21:15:51 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-17 21:15:51 +0400 |
| commit | 36e44c682cc2cecb552eca8dfc75ad1a436086cc (patch) | |
| tree | 60793f2c17ceeb9a2849e60e819551e21fbf8c90 /plugins/cleaners.cpp | |
| parent | 613063cef4d87b3b4307144b85da60dc40daceb3 (diff) | |
| download | dfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.gz dfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.bz2 dfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.xz | |
Add a plugin implementing 'add spatter to item' reactions.
Diffstat (limited to 'plugins/cleaners.cpp')
| -rw-r--r-- | plugins/cleaners.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/cleaners.cpp b/plugins/cleaners.cpp index c0301de7..319b83c1 100644 --- a/plugins/cleaners.cpp +++ b/plugins/cleaners.cpp @@ -81,11 +81,18 @@ command_result cleanitems (color_ostream &out) df::item_actual *item = (df::item_actual *)world->items.all[i]; if (item->contaminants && item->contaminants->size()) { + std::vector<df::contaminant*> saved; for (size_t j = 0; j < item->contaminants->size(); j++) - delete item->contaminants->at(j); + { + auto obj = (*item->contaminants)[j]; + if (obj->flags.whole & 0x8000) // DFHack-generated contaminant + saved.push_back(obj); + else + delete obj; + } cleaned_items++; - cleaned_total += item->contaminants->size(); - item->contaminants->clear(); + cleaned_total += item->contaminants->size() - saved.size(); + item->contaminants->swap(saved); } } if (cleaned_total) |
