From aaed751bf4430bf4b9b30cef532b8753b9f639ce Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Sep 2025 13:48:31 +0500 Subject: Replace most of C strings with string_view --- game/shared/protocol.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'game/shared/protocol.cc') diff --git a/game/shared/protocol.cc b/game/shared/protocol.cc index f8a9ba8..34b7034 100644 --- a/game/shared/protocol.cc +++ b/game/shared/protocol.cc @@ -424,18 +424,18 @@ void protocol::decode(entt::dispatcher& dispatcher, const ENetPacket* packet, EN } } -ENetPacket* protocol::utils::make_disconnect(const char* reason, enet_uint32 flags) +ENetPacket* protocol::utils::make_disconnect(std::string_view reason, enet_uint32 flags) { protocol::Disconnect packet; - packet.reason = std::string(reason); + packet.reason = reason; return protocol::encode(packet, flags); } -ENetPacket* protocol::utils::make_chat_message(const char* message, enet_uint32 flags) +ENetPacket* protocol::utils::make_chat_message(std::string_view message, enet_uint32 flags) { protocol::ChatMessage packet; packet.type = protocol::ChatMessage::TEXT_MESSAGE; - packet.message = std::string(message); + packet.message = message; return protocol::encode(packet, flags); } -- cgit