mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r14750) -Fix [FS#1993]: in an MP game in SP mode no company would go bankrupt. Furthermore companies that passed the "bankrupt" period (4 quarters) wouldn't go bankrupt when loading the game back in MP. Now any company that is in MP or not "currently controlled by the player" in SP will bankrupt.
This commit is contained in:
parent
c2466d9571
commit
21fa036c21
@ -490,7 +490,8 @@ static void CompanyCheckBankrupt(Company *c)
|
||||
cni->FillData(c);
|
||||
|
||||
switch (c->quarters_of_bankrupcy) {
|
||||
default:
|
||||
case 0:
|
||||
case 1:
|
||||
free(cni);
|
||||
break;
|
||||
|
||||
@ -523,7 +524,18 @@ static void CompanyCheckBankrupt(Company *c)
|
||||
}
|
||||
/* Else, falltrue to case 4... */
|
||||
}
|
||||
case 4: {
|
||||
default:
|
||||
case 4:
|
||||
if (!_networking && _local_company == c->index) {
|
||||
/* If we are in offline mode, leave the company playing. Eg. there
|
||||
* is no THE-END, otherwise mark the client as spectator to make sure
|
||||
* he/she is no long in control of this company. However... when you
|
||||
* join another company (cheat) the "unowned" company can bankrupt. */
|
||||
c->bankrupt_asked = MAX_UVALUE(CompanyMask);
|
||||
c->bankrupt_timeout = 0x456;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Close everything the owner has open */
|
||||
DeleteCompanyWindows(c->index);
|
||||
|
||||
@ -533,29 +545,17 @@ static void CompanyCheckBankrupt(Company *c)
|
||||
SetDParamStr(2, cni->company_name);
|
||||
AddNewsItem(STR_02B6, NS_COMPANY_BANKRUPT, 0, 0, cni);
|
||||
|
||||
if (IsHumanCompany(c->index)) {
|
||||
/* XXX - If we are in offline mode, leave the company playing. Eg. there
|
||||
* is no THE-END, otherwise mark the client as spectator to make sure
|
||||
* he/she is no long in control of this company */
|
||||
if (!_networking) {
|
||||
c->bankrupt_asked = MAX_UVALUE(CompanyMask);
|
||||
c->bankrupt_timeout = 0x456;
|
||||
break;
|
||||
}
|
||||
|
||||
ChangeNetworkOwner(c->index, COMPANY_SPECTATOR);
|
||||
}
|
||||
|
||||
/* Remove the company */
|
||||
ChangeNetworkOwner(c->index, COMPANY_SPECTATOR);
|
||||
ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER);
|
||||
/* Register the company as not-active */
|
||||
|
||||
if (!IsHumanCompany(c->index) && (!_networking || _network_server) && _ai.enabled)
|
||||
/* Register the company as not-active */
|
||||
if (!IsHumanCompany(c->index) && (!_networking || _network_server) && _ai.enabled) {
|
||||
AI_CompanyDied(c->index);
|
||||
}
|
||||
|
||||
delete c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CompaniesGenStatistics()
|
||||
|
Loading…
Reference in New Issue
Block a user