Fix #6544: Don't join AI company when loading network game in singleplayer
This commit is contained in:
@@ -823,10 +823,12 @@ bool AfterLoadGame()
|
||||
* 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 (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated))) {
|
||||
DoStartupNewCompany(false);
|
||||
Company *c = Company::Get(COMPANY_FIRST);
|
||||
c->settings = _settings_client.company;
|
||||
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. */
|
||||
@@ -1006,10 +1008,10 @@ bool AfterLoadGame()
|
||||
/* When loading a game, _local_company is not yet set to the correct value.
|
||||
* However, in a dedicated server we are a spectator, so nothing needs to
|
||||
* happen. In case we are not a dedicated server, the local company always
|
||||
* becomes company 0, unless we are in the scenario editor where all the
|
||||
* companies are 'invalid'.
|
||||
* becomes the first available company, unless we are in the scenario editor
|
||||
* where all the companies are 'invalid'.
|
||||
*/
|
||||
Company *c = Company::GetIfValid(COMPANY_FIRST);
|
||||
Company *c = Company::GetIfValid(GetFirstPlayableCompanyID());
|
||||
if (!_network_dedicated && c != nullptr) {
|
||||
c->settings = _settings_client.company;
|
||||
}
|
||||
|
Reference in New Issue
Block a user