Remove lambdas from dwarfmonitor and resume.

develop
Alexander Gavrilov 2013-10-03 16:30:06 +04:00
parent ccc1d936df
commit 32a6073dad
2 changed files with 13 additions and 14 deletions

@ -179,9 +179,9 @@ public:
addDwarfActivity(unit, *entry); addDwarfActivity(unit, *entry);
} }
for_each_(dwarf_activity_values[unit], auto &values = dwarf_activity_values[unit];
[&] (const pair<activity_type, size_t> &x) for (auto it = values.begin(); it != values.end(); ++it)
{ dwarf_activity_values[unit][x.first] = getPercentage(x.second, dwarf_total); } ); it->second = getPercentage(it->second, dwarf_total);
dwarves_column.add(getUnitName(unit), unit); dwarves_column.add(getUnitName(unit), unit);
} }
@ -212,9 +212,8 @@ public:
vector<pair<activity_type, size_t>> rev_vec(dwarf_activities->begin(), dwarf_activities->end()); vector<pair<activity_type, size_t>> rev_vec(dwarf_activities->begin(), dwarf_activities->end());
sort(rev_vec.begin(), rev_vec.end(), less_second<activity_type, size_t>()); sort(rev_vec.begin(), rev_vec.end(), less_second<activity_type, size_t>());
for_each_(rev_vec, for (auto it = rev_vec.begin(); it != rev_vec.end(); ++it)
[&] (pair<activity_type, size_t> x) dwarf_activity_column.add(getActivityItem(it->first, it->second), it->first);
{ dwarf_activity_column.add(getActivityItem(x.first, x.second), x.first); });
} }
dwarf_activity_column.fixWidth(); dwarf_activity_column.fixWidth();
@ -754,9 +753,8 @@ public:
vector<pair<df::unit *, size_t>> rev_vec(dwarf_activities->begin(), dwarf_activities->end()); vector<pair<df::unit *, size_t>> rev_vec(dwarf_activities->begin(), dwarf_activities->end());
sort(rev_vec.begin(), rev_vec.end(), less_second<df::unit *, size_t>()); sort(rev_vec.begin(), rev_vec.end(), less_second<df::unit *, size_t>());
for_each_(rev_vec, for (auto it = rev_vec.begin(); it != rev_vec.end(); ++it)
[&] (pair<df::unit *, size_t> x) dwarf_activity_column.add(getDwarfAverage(it->first, it->second), it->first);
{ dwarf_activity_column.add(getDwarfAverage(x.first, x.second), x.first); });
} }
} }
@ -778,9 +776,8 @@ public:
vector<pair<activity_type, size_t>> rev_vec(category_activities->begin(), category_activities->end()); vector<pair<activity_type, size_t>> rev_vec(category_activities->begin(), category_activities->end());
sort(rev_vec.begin(), rev_vec.end(), less_second<activity_type, size_t>()); sort(rev_vec.begin(), rev_vec.end(), less_second<activity_type, size_t>());
for_each_(rev_vec, for (auto it = rev_vec.begin(); it != rev_vec.end(); ++it)
[&] (pair<activity_type, size_t> x) category_breakdown_column.add(getBreakdownAverage(it->first, it->second), it->first);
{ category_breakdown_column.add(getBreakdownAverage(x.first, x.second), x.first); });
} }
category_breakdown_column.fixWidth(); category_breakdown_column.fixWidth();

@ -125,8 +125,10 @@ void scan_for_suspended_buildings()
SuspendedBuilding sb(bld); SuspendedBuilding sb(bld);
sb.is_planned = job->job_items.size() == 1 && job->job_items[0]->item_type == item_type::NONE; sb.is_planned = job->job_items.size() == 1 && job->job_items[0]->item_type == item_type::NONE;
auto it = find_if(resumed_buildings.begin(), resumed_buildings.end(), auto it = resumed_buildings.begin();
[&] (SuspendedBuilding &rsb) { return rsb.bld == bld; });
for (; it != resumed_buildings.end(); ++it)
if (it->bld == bld) break;
sb.was_resumed = it != resumed_buildings.end(); sb.was_resumed = it != resumed_buildings.end();