mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 09:33:47 +00:00
Big update.
This commit is contained in:
@@ -16,13 +16,12 @@
|
||||
*/
|
||||
|
||||
#include "ServerMotd.h"
|
||||
#include "Common.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Tokenize.h"
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
namespace
|
||||
{
|
||||
@@ -44,10 +43,10 @@ void Motd::SetMotd(std::string motd)
|
||||
|
||||
WorldPacket data(SMSG_MOTD); // new in 2.0.1
|
||||
|
||||
Tokenizer motdTokens(motd, '@');
|
||||
std::vector<std::string_view> motdTokens = Acore::Tokenize(motd, '@', true);
|
||||
data << uint32(motdTokens.size()); // line count
|
||||
|
||||
for (Tokenizer::const_reference token : motdTokens)
|
||||
for (std::string_view token : motdTokens)
|
||||
data << token;
|
||||
|
||||
MotdPacket = data;
|
||||
@@ -56,7 +55,7 @@ void Motd::SetMotd(std::string motd)
|
||||
return;
|
||||
|
||||
std::ostringstream oss;
|
||||
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<char const*>(oss, "\n"));
|
||||
std::copy(motdTokens.begin(), motdTokens.end() - 1, std::ostream_iterator<std::string_view>(oss, "\n"));
|
||||
oss << *(motdTokens.end() - 1); // copy back element
|
||||
FormattedMotd = oss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user