summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-14 17:25:16 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-30 10:15:22 +0200
commit8a918ce1709cb80191ba8e5195ec8ef02d484d9e (patch)
tree175190e9998dc4f5732fa3620a9549afeac8eb5b /src/network/core
parent97c461d1e73f228dd366cd8f062701062edd9bd1 (diff)
downloadopenttd-8a918ce1709cb80191ba8e5195ec8ef02d484d9e.tar.xz
Codechange: [Network] Make admin name and version std::string
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_admin.cpp8
-rw-r--r--src/network/core/tcp_admin.h6
2 files changed, 6 insertions, 8 deletions
diff --git a/src/network/core/tcp_admin.cpp b/src/network/core/tcp_admin.cpp
index 0b48b419b..234ab2e25 100644
--- a/src/network/core/tcp_admin.cpp
+++ b/src/network/core/tcp_admin.cpp
@@ -30,8 +30,6 @@ static_assert((int)CRR_END == (int)ADMIN_CRR_END);
NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) : status(ADMIN_STATUS_INACTIVE)
{
this->sock = s;
- this->admin_name[0] = '\0';
- this->admin_version[0] = '\0';
}
NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection(bool error)
@@ -89,9 +87,9 @@ NetworkRecvStatus NetworkAdminSocketHandler::HandlePacket(Packet *p)
default:
if (this->HasClientQuit()) {
- DEBUG(net, 0, "[tcp/admin] Received invalid packet type %d from '%s' (%s)", type, this->admin_name, this->admin_version);
+ DEBUG(net, 0, "[tcp/admin] Received invalid packet type %d from '%s' (%s)", type, this->admin_name.c_str(), this->admin_version.c_str());
} else {
- DEBUG(net, 0, "[tcp/admin] Received illegal packet from '%s' (%s)", this->admin_name, this->admin_version);
+ DEBUG(net, 0, "[tcp/admin] Received illegal packet from '%s' (%s)", this->admin_name.c_str(), this->admin_version.c_str());
}
this->CloseConnection();
@@ -125,7 +123,7 @@ NetworkRecvStatus NetworkAdminSocketHandler::ReceivePackets()
*/
NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket(PacketAdminType type)
{
- DEBUG(net, 0, "[tcp/admin] Received illegal packet type %d from admin %s (%s)", type, this->admin_name, this->admin_version);
+ DEBUG(net, 0, "[tcp/admin] Received illegal packet type %d from admin %s (%s)", type, this->admin_name.c_str(), this->admin_version.c_str());
return NETWORK_RECV_STATUS_MALFORMED_PACKET;
}
diff --git a/src/network/core/tcp_admin.h b/src/network/core/tcp_admin.h
index 8b4a738bf..6d498ce5d 100644
--- a/src/network/core/tcp_admin.h
+++ b/src/network/core/tcp_admin.h
@@ -109,9 +109,9 @@ enum AdminCompanyRemoveReason {
/** Main socket handler for admin related connections. */
class NetworkAdminSocketHandler : public NetworkTCPSocketHandler {
protected:
- char admin_name[NETWORK_CLIENT_NAME_LENGTH]; ///< Name of the admin.
- char admin_version[NETWORK_REVISION_LENGTH]; ///< Version string of the admin.
- AdminStatus status; ///< Status of this admin.
+ std::string admin_name; ///< Name of the admin.
+ std::string admin_version; ///< Version string of the admin.
+ AdminStatus status; ///< Status of this admin.
NetworkRecvStatus ReceiveInvalidPacket(PacketAdminType type);