mirror of https://github.com/OpenTTD/OpenTTD.git
This situation occurs when loading a savegame in single-player which only has AI companies.
This commit is contained in:
parent
7460fdb298
commit
c18a171028
|
@ -828,18 +828,6 @@ bool AfterLoadGame()
|
|||
* version. It didn't show up before r12070. */
|
||||
if (IsSavegameVersionBefore(SLV_87)) UpdateVoidTiles();
|
||||
|
||||
/* If Load Scenario / New (Scenario) Game is used,
|
||||
* a company does not exist yet. So create one here.
|
||||
* 1 exception: network-games. Those can have 0 companies
|
||||
* But this exception is not true for non-dedicated network servers! */
|
||||
if (!_networking || (_networking && _network_server && !_network_dedicated)) {
|
||||
CompanyID first_human_company = GetFirstPlayableCompanyID();
|
||||
if (!Company::IsValidID(first_human_company)) {
|
||||
Company *c = DoStartupNewCompany(false, first_human_company);
|
||||
c->settings = _settings_client.company;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix the cache for cargo payments. */
|
||||
for (CargoPayment *cp : CargoPayment::Iterate()) {
|
||||
cp->front->cargo_payment = cp;
|
||||
|
@ -3232,9 +3220,22 @@ bool AfterLoadGame()
|
|||
|
||||
AfterLoadLinkGraphs();
|
||||
|
||||
/* Start the scripts. This MUST happen after everything else. */
|
||||
/* Start the scripts. This MUST happen after everything else except
|
||||
* starting a new company. */
|
||||
StartScripts();
|
||||
|
||||
/* If Load Scenario / New (Scenario) Game is used,
|
||||
* a company does not exist yet. So create one here.
|
||||
* 1 exception: network-games. Those can have 0 companies
|
||||
* But this exception is not true for non-dedicated network servers! */
|
||||
if (!_networking || (_networking && _network_server && !_network_dedicated)) {
|
||||
CompanyID first_human_company = GetFirstPlayableCompanyID();
|
||||
if (!Company::IsValidID(first_human_company)) {
|
||||
Company *c = DoStartupNewCompany(false, first_human_company);
|
||||
c->settings = _settings_client.company;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue