Track income by cargo type in company economy stats

This commit is contained in:
dP
2020-07-01 22:35:30 +03:00
parent b054653146
commit 46bd8ab608
12 changed files with 114 additions and 0 deletions

View File

@@ -2,6 +2,8 @@
#include "cm_game.hpp"
#include "../company_base.h"
#include "../safeguards.h"
namespace citymania {
@@ -78,6 +80,10 @@ Game::Game() {
town->cm.real_population += HouseSpec::Get(house_id)->population;
}
});
this->events.listen<event::CargoAccepted>([this] (const event::CargoAccepted &event) {
event.company->cur_economy.cm.cargo_income[event.cargo_type] += event.profit;
});
}
} // namespace citymania