mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 08:33:47 +00:00
feat(Core/Common): delete old Tokenizer (#10121)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Tokenize.h"
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
||||
@@ -43,10 +44,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;
|
||||
@@ -55,7 +56,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