fixed errors in cost calculation
This commit is contained in:
@ -10,11 +10,14 @@ void CostPipeline::addCostComponent(const std::shared_ptr<ICostComponent> &compo
|
||||
}
|
||||
|
||||
void CostPipeline::calculateFinalCost() {
|
||||
for (auto &component: this->components) {
|
||||
iterateCommunity(component);
|
||||
for (size_t i = 0; i < this->components.size() - 1; i++) {
|
||||
iterateCommunity(this->components[i]);
|
||||
}
|
||||
// Ensure CalculateFinalSums is last
|
||||
iterateCommunity(this->components.back());
|
||||
}
|
||||
|
||||
|
||||
void CostPipeline::iterateCommunity(std::shared_ptr<ICostComponent> &component) const {
|
||||
for (auto &community: this->communities) {
|
||||
iterateBuilding(community, component);
|
||||
|
||||
Reference in New Issue
Block a user