1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Change: When player joins network company, use its name instead of number in chat (#13263)

This commit is contained in:
Tyler Trahan
2025-01-31 14:02:17 -05:00
committed by GitHub
parent f8b1e3033f
commit a0fb98df53
2 changed files with 11 additions and 4 deletions

View File

@@ -1997,11 +1997,18 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
cs->SendMove(client_id, company_id);
}
/* announce the client's move */
/* Announce the client's move. */
NetworkUpdateClientInfo(client_id);
NetworkAction action = (company_id == COMPANY_SPECTATOR) ? NETWORK_ACTION_COMPANY_SPECTATOR : NETWORK_ACTION_COMPANY_JOIN;
NetworkServerSendChat(action, DESTTYPE_BROADCAST, 0, "", client_id, company_id + 1);
if (company_id == COMPANY_SPECTATOR) {
/* The client has joined spectators. */
NetworkServerSendChat(NETWORK_ACTION_COMPANY_SPECTATOR, DESTTYPE_BROADCAST, 0, "", client_id);
} else {
/* The client has joined another company. */
SetDParam(0, company_id);
std::string company_name = GetString(STR_COMPANY_NAME);
NetworkServerSendChat(NETWORK_ACTION_COMPANY_JOIN, DESTTYPE_BROADCAST, 0, company_name, client_id);
}
InvalidateWindowData(WC_CLIENT_LIST, 0);
}