From 45e9e943115badd1a10ce18dc660408564e4aac9 Mon Sep 17 00:00:00 2001 From: Treeston Date: Sun, 30 Aug 2020 02:50:25 +0200 Subject: Core/ChatCommands: C++17 cleanup (again) (PR #25323) (cherry picked from commit 2f7d2ef3e979ecd0536f3a3713e56c8e59652a47) --- src/server/scripts/Commands/cs_debug.cpp | 4 ++-- src/server/scripts/Commands/cs_message.cpp | 38 ++++++++++++++---------------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 1e9c07ca554..ce9d0952f73 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1681,7 +1681,7 @@ public: return true; }; - static bool HandleDebugOutOfBounds([[maybe_unused]] ChatHandler* handler, CommandArgs* /*args*/) + static bool HandleDebugOutOfBounds([[maybe_unused]] ChatHandler* handler) { #ifdef ASAN uint8 stack_array[10] = {}; @@ -1838,7 +1838,7 @@ public: return true; } - static bool HandleDebugDummyCommand(ChatHandler* handler, CommandArgs* /*args*/) + static bool HandleDebugDummyCommand(ChatHandler* handler) { handler->SendSysMessage("This command does nothing right now. Edit your local core (cs_debug.cpp) to make it do whatever you need for testing."); return true; diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index 8fbf85fda83..157961594ab 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -130,62 +130,60 @@ public: return true; } - static bool HandleNameAnnounceCommand(ChatHandler* handler, CommandArgs* args) + static bool HandleNameAnnounceCommand(ChatHandler* handler, Tail message) { - if (!*args) + if (message.empty()) return false; std::string name("Console"); if (WorldSession* session = handler->GetSession()) name = session->GetPlayer()->GetName(); - sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args->GetFullArgs()); + sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), message.data()); return true; } - static bool HandleGMNameAnnounceCommand(ChatHandler* handler, CommandArgs* args) + static bool HandleGMNameAnnounceCommand(ChatHandler* handler, Tail message) { - if (!*args) + if (message.empty()) return false; std::string name("Console"); if (WorldSession* session = handler->GetSession()) name = session->GetPlayer()->GetName(); - sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args->GetFullArgs()); + sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), message.data()); return true; } // global announce - static bool HandleAnnounceCommand(ChatHandler* handler, char const* args) + static bool HandleAnnounceCommand(ChatHandler* handler, Tail message) { - if (!*args) + if (message.empty()) return false; - std::string str = handler->PGetParseString(LANG_SYSTEMMESSAGE, args); - - sWorld->SendServerMessage(SERVER_MSG_STRING, str); + sWorld->SendServerMessage(SERVER_MSG_STRING, Trinity::StringFormat(handler->GetTrinityString(LANG_SYSTEMMESSAGE), message.data()).c_str()); return true; } // announce to logged in GMs - static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, CommandArgs* args) + static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, Tail message) { - if (!*args) + if (message.empty()) return false; - sWorld->SendGMText(LANG_GM_BROADCAST, args->GetFullArgs()); + sWorld->SendGMText(LANG_GM_BROADCAST, message.data()); return true; } // send on-screen notification to players - static bool HandleNotifyCommand(ChatHandler* handler, CommandArgs* args) + static bool HandleNotifyCommand(ChatHandler* handler, Tail message) { - if (!*args) + if (message.empty()) return false; std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY); - str += args->GetFullArgs(); + str += message; sWorld->SendGlobalMessage(WorldPackets::Chat::PrintNotification(str).Write()); @@ -193,13 +191,13 @@ public: } // send on-screen notification to GMs - static bool HandleGMNotifyCommand(ChatHandler* handler, CommandArgs* args) + static bool HandleGMNotifyCommand(ChatHandler* handler, Tail message) { - if (!*args) + if (message.empty()) return false; std::string str = handler->GetTrinityString(LANG_GM_NOTIFY); - str += args->GetFullArgs(); + str += message; sWorld->SendGlobalGMMessage(WorldPackets::Chat::PrintNotification(str).Write()); -- cgit v1.2.3