Delete spatter objects while cleaning items and creatures.

develop
Petr Mrázek 2011-10-28 04:52:20 +02:00
parent bfc8df3005
commit 4d6e93988a
1 changed files with 4 additions and 0 deletions

@ -113,6 +113,8 @@ command_result cleanitems (Core * c)
continue; continue;
if (itm->contaminants->size()) if (itm->contaminants->size())
{ {
for(int j = 0; j < itm->contaminants->size(); j++)
delete itm->contaminants->at(j);
cleaned_items++; cleaned_items++;
cleaned_total += itm->contaminants->size(); cleaned_total += itm->contaminants->size();
itm->contaminants->clear(); itm->contaminants->clear();
@ -141,6 +143,8 @@ command_result cleanunits (Core * c)
int num = unit->contaminants.size(); int num = unit->contaminants.size();
if (num) if (num)
{ {
for(int j = 0; j < unit->contaminants.size(); j++)
delete unit->contaminants.at(j);
cleaned_units++; cleaned_units++;
cleaned_total += num; cleaned_total += num;
unit->contaminants.clear(); unit->contaminants.clear();