Update to 12.0-RC1

This commit is contained in:
dP
2021-09-26 20:30:12 +03:00
parent c9765f712f
commit 4eb8b29dbf
173 changed files with 31125 additions and 9485 deletions

View File

@@ -14,6 +14,7 @@
#include "../date_func.h"
#include "network_admin.h"
#include "network_client.h"
#include "network_query.h"
#include "network_server.h"
#include "network_content.h"
#include "network_udp.h"
@@ -216,7 +217,7 @@ bool NetworkCompanyIsPassworded(CompanyID company_id)
/* This puts a text-message to the console, or in the future, the chat-box,
* (to keep it all a bit more general)
* If 'self_send' is true, this is the client who is sending the message */
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const std::string &name, const std::string &str, int64 data)
void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send, const std::string &name, const std::string &str, int64 data, const std::string &data_str)
{
StringID strid;
switch (action) {
@@ -247,6 +248,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
case NETWORK_ACTION_CHAT_COMPANY: strid = self_send ? STR_NETWORK_CHAT_TO_COMPANY : STR_NETWORK_CHAT_COMPANY; break;
case NETWORK_ACTION_CHAT_CLIENT: strid = self_send ? STR_NETWORK_CHAT_TO_CLIENT : STR_NETWORK_CHAT_CLIENT; break;
case NETWORK_ACTION_KICKED: strid = STR_NETWORK_MESSAGE_KICKED; break;
case NETWORK_ACTION_EXTERNAL_CHAT: strid = STR_NETWORK_CHAT_EXTERNAL; break;
default: strid = STR_NETWORK_CHAT_ALL; break;
}
@@ -254,6 +256,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
SetDParamStr(0, name);
SetDParamStr(1, str);
SetDParam(2, data);
SetDParamStr(3, data_str);
/* All of these strings start with "***". These characters are interpreted as both left-to-right and
* right-to-left characters depending on the context. As the next text might be an user's name, the
@@ -264,7 +267,7 @@ void NetworkTextMessage(NetworkAction action, TextColour colour, bool self_send,
Debug(desync, 1, "msg: {:08x}; {:02x}; {}", _date, _date_fract, message);
IConsolePrint(colour, message);
NetworkAddChatMessage((TextColour)colour, _settings_client.gui.network_chat_timeout, message);
NetworkAddChatMessage(colour, _settings_client.gui.network_chat_timeout, message);
}
/* Calculate the frame-lag of a client */
@@ -631,16 +634,14 @@ public:
void OnFailure() override
{
NetworkGameList *item = NetworkGameListAddItem(connection_string);
item->online = false;
item->status = NGLS_OFFLINE;
UpdateNetworkGameWindow();
}
void OnConnect(SOCKET s) override
{
_networking = true;
new ClientNetworkGameSocketHandler(s, this->connection_string);
MyClient::SendInformationQuery();
QueryNetworkGameSocketHandler::QueryServer(s, this->connection_string);
}
};
@@ -652,8 +653,6 @@ void NetworkQueryServer(const std::string &connection_string)
{
if (!_network_available) return;
NetworkInitialize();
new TCPQueryConnecter(connection_string);
}
@@ -1020,6 +1019,7 @@ void NetworkBackgroundLoop()
_network_coordinator_client.SendReceive();
TCPConnecter::CheckCallbacks();
NetworkHTTPSocketHandler::HTTPReceive();
QueryNetworkGameSocketHandler::SendReceive();
NetworkBackgroundUDPLoop();
}