summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-29 19:29:14 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-30 00:01:49 +0200
commit8b9f1147dfec4efe3451dd3e111276a1dab3bb99 (patch)
tree6fc3a64443fdc40fd5ef94b69cad60fc6f075d6b /src
parentd70fb74ac669bdb64b5f594894629ec91801fd76 (diff)
downloadopenttd-8b9f1147dfec4efe3451dd3e111276a1dab3bb99.tar.xz
Codechange: [Network] Let server changing a client name use std::string
Diffstat (limited to 'src')
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/network/network_func.h2
-rw-r--r--src/network/network_server.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 39a52f0b5..e86e2a0d9 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -724,7 +724,7 @@ DEF_CONSOLE_CMD(ConClientNickChange)
return true;
}
- if (!NetworkServerChangeClientName(client_id, client_name.c_str())) {
+ if (!NetworkServerChangeClientName(client_id, client_name)) {
IConsoleError("Cannot give a client a duplicate name");
}
diff --git a/src/network/network_func.h b/src/network/network_func.h
index d30616fd0..a50166e2a 100644
--- a/src/network/network_func.h
+++ b/src/network/network_func.h
@@ -73,7 +73,7 @@ void NetworkServerUpdateGameInfo();
void NetworkServerShowStatusToConsole();
bool NetworkServerStart();
void NetworkServerNewCompany(const Company *company, NetworkClientInfo *ci);
-bool NetworkServerChangeClientName(ClientID client_id, const char *new_name);
+bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_name);
void NetworkServerDoMove(ClientID client_id, CompanyID company_id);
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index fe585c03c..b770dbda3 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1719,7 +1719,7 @@ bool NetworkFindName(char *new_name, const char *last)
* @param new_name the new name for the client
* @return true iff the name was changed
*/
-bool NetworkServerChangeClientName(ClientID client_id, const char *new_name)
+bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_name)
{
/* Check if the name's already in use */
for (NetworkClientInfo *ci : NetworkClientInfo::Iterate()) {