Fix #10983: [AdminPort] Correct order of messages

(cherry picked from commit 49c3215751)
This commit is contained in:
Damian Laczak
2023-06-26 02:11:04 +02:00
committed by Jonathan G Rennison
parent 5c35a87ed7
commit 2aa574a48f
4 changed files with 10 additions and 11 deletions

View File

@@ -965,6 +965,11 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
break;
}
/* Send new companies, before potentially setting the password. Otherwise,
* the password update could be sent when the company is not yet known. */
NetworkAdminCompanyNew(c);
NetworkServerNewCompany(c, ci);
/* This is the client (or non-dedicated server) who wants a new company */
if (client_id == _network_own_client_id) {
assert(_local_company == COMPANY_SPECTATOR);
@@ -984,7 +989,6 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
MarkWholeScreenDirty();
}
NetworkServerNewCompany(c, ci);
DEBUG(desync, 1, "new_company: %s, company_id: %u", debug_date_dumper().HexDate(), c->index);
break;
}
@@ -1002,6 +1006,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32_t p1, uin
Company *c = DoStartupNewCompany(DSNC_AI, company_id);
if (c != nullptr) {
NetworkAdminCompanyNew(c);
NetworkServerNewCompany(c, nullptr);
DEBUG(desync, 1, "new_company_ai: %s, company_id: %u", debug_date_dumper().HexDate(), c->index);
}