1
0
Fork 0

Codechange: use std::string_view for sending a remote console command (result)

pull/14048/head
Rubidium 2025-04-20 11:33:25 +02:00 committed by rubidium42
parent d99edf2bbc
commit bb259b8e77
5 changed files with 8 additions and 8 deletions

View File

@ -462,7 +462,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendQuit()
* @param pass The password for the remote command. * @param pass The password for the remote command.
* @param command The actual command. * @param command The actual command.
*/ */
NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon(const std::string &pass, const std::string &command) NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon(std::string_view pass, std::string_view command)
{ {
Debug(net, 9, "Client::SendRCon()"); Debug(net, 9, "Client::SendRCon()");
@ -1212,7 +1212,7 @@ void NetworkClient_Connected()
* @param password The password. * @param password The password.
* @param command The command to execute. * @param command The command to execute.
*/ */
void NetworkClientSendRcon(const std::string &password, const std::string &command) void NetworkClientSendRcon(std::string_view password, std::string_view command)
{ {
MyClient::SendRCon(password, command); MyClient::SendRCon(password, command);
} }

View File

@ -90,7 +90,7 @@ public:
static NetworkRecvStatus SendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data); static NetworkRecvStatus SendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data);
static NetworkRecvStatus SendSetName(const std::string &name); static NetworkRecvStatus SendSetName(const std::string &name);
static NetworkRecvStatus SendRCon(const std::string &password, const std::string &command); static NetworkRecvStatus SendRCon(std::string_view password, std::string_view command);
static NetworkRecvStatus SendMove(CompanyID company); static NetworkRecvStatus SendMove(CompanyID company);
static bool IsConnected(); static bool IsConnected();

View File

@ -53,7 +53,7 @@ void NetworkClientsToSpectators(CompanyID cid);
bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = ""); bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = "");
void NetworkClientJoinGame(); void NetworkClientJoinGame();
void NetworkClientRequestMove(CompanyID company); void NetworkClientRequestMove(CompanyID company);
void NetworkClientSendRcon(const std::string &password, const std::string &command); void NetworkClientSendRcon(std::string_view password, std::string_view command);
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0); void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0);
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio); bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
uint NetworkMaxCompaniesAllowed(); uint NetworkMaxCompaniesAllowed();
@ -75,7 +75,7 @@ bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_na
bool NetworkCanJoinCompany(CompanyID company_id); bool NetworkCanJoinCompany(CompanyID company_id);
void NetworkServerDoMove(ClientID client_id, CompanyID company_id); void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const std::string &string); void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, std::string_view string);
void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, ClientID from_id, int64_t data = 0, bool from_admin = false); void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, ClientID from_id, int64_t data = 0, bool from_admin = false);
void NetworkServerSendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg); void NetworkServerSendExternalChat(const std::string &source, TextColour colour, const std::string &user, const std::string &msg);

View File

@ -778,7 +778,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame()
* @param colour The colour of the result. * @param colour The colour of the result.
* @param command The command that was executed. * @param command The command that was executed.
*/ */
NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult(uint16_t colour, const std::string &command) NetworkRecvStatus ServerNetworkGameSocketHandler::SendRConResult(uint16_t colour, std::string_view command)
{ {
Debug(net, 9, "client[{}] SendRConResult()", this->client_id); Debug(net, 9, "client[{}] SendRConResult()", this->client_id);
@ -2018,7 +2018,7 @@ void NetworkServerDoMove(ClientID client_id, CompanyID company_id)
* @param colour_code The colour of the text. * @param colour_code The colour of the text.
* @param string The actual reply. * @param string The actual reply.
*/ */
void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, const std::string &string) void NetworkServerSendRcon(ClientID client_id, TextColour colour_code, std::string_view string)
{ {
NetworkClientSocket::GetByClientID(client_id)->SendRConResult(colour_code, string); NetworkClientSocket::GetByClientID(client_id)->SendRConResult(colour_code, string);
} }

View File

@ -89,7 +89,7 @@ public:
NetworkRecvStatus SendQuit(ClientID client_id); NetworkRecvStatus SendQuit(ClientID client_id);
NetworkRecvStatus SendShutdown(); NetworkRecvStatus SendShutdown();
NetworkRecvStatus SendNewGame(); NetworkRecvStatus SendNewGame();
NetworkRecvStatus SendRConResult(uint16_t colour, const std::string &command); NetworkRecvStatus SendRConResult(uint16_t colour, std::string_view command);
NetworkRecvStatus SendMove(ClientID client_id, CompanyID company_id); NetworkRecvStatus SendMove(ClientID client_id, CompanyID company_id);
NetworkRecvStatus SendClientInfo(NetworkClientInfo *ci); NetworkRecvStatus SendClientInfo(NetworkClientInfo *ci);