diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -830,10 +830,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. */ @@ -1013,10 +1015,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; }