mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
feat(Core/Common): delete old Tokenizer (#10121)
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Tokenize.h"
|
||||
#include "StringConvert.h"
|
||||
|
||||
PlayerTaxi::PlayerTaxi() : _taxiSegment(0)
|
||||
{
|
||||
@@ -89,18 +91,31 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
|
||||
SetTaximaskNode(213); //Shattered Sun Staging Area
|
||||
}
|
||||
|
||||
void PlayerTaxi::LoadTaxiMask(std::string const& data)
|
||||
bool PlayerTaxi::LoadTaxiMask(std::string_view data)
|
||||
{
|
||||
Tokenizer tokens(data, ' ');
|
||||
bool warn = false;
|
||||
std::vector<std::string_view> tokens = Acore::Tokenize(data, ' ', false);
|
||||
|
||||
uint8 index;
|
||||
Tokenizer::const_iterator iter;
|
||||
for (iter = tokens.begin(), index = 0;
|
||||
(index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
|
||||
for (uint8 index = 0; (index < TaxiMaskSize) && (index < tokens.size()); ++index)
|
||||
{
|
||||
// load and set bits only for existed taxi nodes
|
||||
m_taximask[index] = sTaxiNodesMask[index] & uint32(atol(*iter));
|
||||
if (Optional<uint32> mask = Acore::StringTo<uint32>(tokens[index]))
|
||||
{
|
||||
// load and set bits only for existing taxi nodes
|
||||
m_taximask[index] = sTaxiNodesMask[index] & *mask;
|
||||
|
||||
if (m_taximask[index] != *mask)
|
||||
{
|
||||
warn = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_taximask[index] = 0;
|
||||
warn = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !warn;
|
||||
}
|
||||
|
||||
void PlayerTaxi::AppendTaximaskTo(ByteBuffer& data, bool all)
|
||||
@@ -121,12 +136,16 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, TeamI
|
||||
{
|
||||
ClearTaxiDestinations();
|
||||
|
||||
Tokenizer tokens(values, ' ');
|
||||
|
||||
for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
for (auto const& itr : Acore::Tokenize(values, ' ', false))
|
||||
{
|
||||
uint32 node = uint32(atol(*iter));
|
||||
AddTaxiDestination(node);
|
||||
if (Optional<uint32> node = Acore::StringTo<uint32>(itr))
|
||||
{
|
||||
AddTaxiDestination(*node);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check integrity
|
||||
|
||||
Reference in New Issue
Block a user