summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2018-03-11 12:46:05 +0000
committerfrosch <frosch@openttd.org>2018-03-11 12:46:05 +0000
commitdb54db00df7390443cdb35139a702af14cb79b90 (patch)
tree1710010c85a84c9a6a9ae3b73cf4e609fe77b9ba /src/economy.cpp
parent91464af7379ad659748332f870917aa2db5d185b (diff)
downloadopenttd-db54db00df7390443cdb35139a702af14cb79b90.tar.xz
(svn r27981) -Change [FS#6679]: Check companies for bankruptcy before subtracting reoccuring monthly costs. (Samu)
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 0106e87e1..e97f61d6e 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -654,12 +654,16 @@ static void CompanyCheckBankrupt(Company *c)
*/
static void CompaniesGenStatistics()
{
- Station *st;
+ /* Check for bankruptcy each month */
+ Company *c;
+ FOR_ALL_COMPANIES(c) {
+ CompanyCheckBankrupt(c);
+ }
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
- Company *c;
if (!_settings_game.economy.infrastructure_maintenance) {
+ Station *st;
FOR_ALL_STATIONS(st) {
cur_company.Change(st->owner);
CommandCost cost(EXPENSES_PROPERTY, _price[PR_STATION_VALUE] >> 1);
@@ -688,11 +692,6 @@ static void CompaniesGenStatistics()
}
cur_company.Restore();
- /* Check for bankruptcy each month */
- FOR_ALL_COMPANIES(c) {
- CompanyCheckBankrupt(c);
- }
-
/* Only run the economic statics and update company stats every 3rd month (1st of quarter). */
if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month)) return;