summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-04-09 10:04:43 +0100
committerPeterN <peter@fuzzle.org>2019-04-11 13:00:25 +0100
commit0130f3be459fd906c6f75f08230293184aff73db (patch)
treec7a334b0c505a502de6ba4746716eff74d1d3506 /src
parent4ad981a98e8a3dae5bc975babd9f10eb15f738a3 (diff)
downloadopenttd-0130f3be459fd906c6f75f08230293184aff73db.tar.xz
Fix #7491: Send company update admin message when bankruptcy counter changes.
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 8fc717956..b4b298836 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -570,8 +570,10 @@ static void CompanyCheckBankrupt(Company *c)
{
/* If the company has money again, it does not go bankrupt */
if (c->money - c->current_loan >= -_economy.max_loan) {
+ int previous_months_of_bankruptcy = CeilDiv(c->months_of_bankruptcy, 3);
c->months_of_bankruptcy = 0;
c->bankrupt_asked = 0;
+ if (previous_months_of_bankruptcy != 0) CompanyAdminUpdate(c);
return;
}
@@ -640,10 +642,15 @@ static void CompanyCheckBankrupt(Company *c)
* that changing the current company is okay. In case of single
* player we are sure (the above check) that we are not the local
* company and thus we won't be moved. */
- if (!_networking || _network_server) DoCommandP(0, CCA_DELETE | (c->index << 16) | (CRR_BANKRUPT << 24), 0, CMD_COMPANY_CTRL);
+ if (!_networking || _network_server) {
+ DoCommandP(0, CCA_DELETE | (c->index << 16) | (CRR_BANKRUPT << 24), 0, CMD_COMPANY_CTRL);
+ return;
+ }
break;
}
}
+
+ if (CeilDiv(c->months_of_bankruptcy, 3) != CeilDiv(c->months_of_bankruptcy - 1, 3)) CompanyAdminUpdate(c);
}
/**