summaryrefslogtreecommitdiff
path: root/src/network/network_client.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-29 19:52:11 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-30 00:01:49 +0200
commit806f78aa04155c667f9f2090f54898d5f66c3144 (patch)
tree2f22e2681ec7d4068ca853590bcc8f04e06a85a3 /src/network/network_client.cpp
parentfd95736bac4ef79ba36cff18d09c039a1c713f80 (diff)
downloadopenttd-806f78aa04155c667f9f2090f54898d5f66c3144.tar.xz
Codechange: [Network] Use std::string to send the client name and rcon commands
Diffstat (limited to 'src/network/network_client.cpp')
-rw-r--r--src/network/network_client.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 161bbf412..ae483508a 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -491,7 +491,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetPassword(const std::str
* Tell the server that we like to change the name of the client.
* @param name The new name.
*/
-NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName(const char *name)
+NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName(const std::string &name)
{
Packet *p = new Packet(PACKET_CLIENT_SET_NAME);
@@ -516,7 +516,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendQuit()
* @param pass The password for the remote command.
* @param command The actual command.
*/
-NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon(const std::string &pass, const char *command)
+NetworkRecvStatus ClientNetworkGameSocketHandler::SendRCon(const std::string &pass, const std::string &command)
{
Packet *p = new Packet(PACKET_CLIENT_RCON);
p->Send_string(pass);
@@ -1258,7 +1258,7 @@ void NetworkClient_Connected()
* @param password The password.
* @param command The command to execute.
*/
-void NetworkClientSendRcon(const std::string &password, const char *command)
+void NetworkClientSendRcon(const std::string &password, const std::string &command)
{
MyClient::SendRCon(password, command);
}
@@ -1355,7 +1355,7 @@ void NetworkUpdateClientName(const std::string &client_name)
/* Don't change the name if it is the same as the old name */
if (client_name.compare(ci->client_name) != 0) {
if (!_network_server) {
- MyClient::SendSetName(client_name.c_str());
+ MyClient::SendSetName(client_name);
} else {
/* Copy to a temporary buffer so no #n gets added after our name in the settings when there are duplicate names. */
char temporary_name[NETWORK_CLIENT_NAME_LENGTH];