From 5702b3951cb4b3f398aec76f5016b0ae9766c562 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 2 Jun 2014 18:18:35 +0000 Subject: [PATCH] (svn r26625) [1.4] -Backport from trunk: - Fix: First send packages about new company, then clients joining it to admin port [FS#6025] (r26616) --- src/network/network_server.cpp | 8 +++++++- src/os/windows/win32.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 22940853f3..9cb3bcfcae 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -2191,11 +2191,17 @@ void NetworkServerNewCompany(const Company *c, NetworkClientInfo *ci) ci->client_playas = c->index; NetworkUpdateClientInfo(ci->client_id); NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, c->index); - NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, c->index + 1); } /* Announce new company on network. */ NetworkAdminCompanyInfo(c, true); + + if (ci != NULL) { + /* ci is NULL when replaying, or for AIs. In neither case there is a client. + We need to send Admin port update here so that they first know about the new company + and then learn about a possibly joining client (see FS#6025) */ + NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, c->index + 1); + } } #endif /* ENABLE_NETWORK */ diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index d7ea4ab356..1511214f42 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -19,7 +19,7 @@ #include #include #include /* SHGetFolderPath */ -#include +#include #include "win32.h" #include "../../core/alloc_func.hpp" #include "../../openttd.h"