feat(Core/Common): delete old Tokenizer (#10121)
This commit is contained in:
parent
a25ef74de3
commit
6d7f58e6ed
24 changed files with 284 additions and 225 deletions
|
|
@ -73,6 +73,8 @@
|
|||
#include "WeatherMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Tokenize.h"
|
||||
#include "StringConvert.h"
|
||||
|
||||
// TODO: this import is not necessary for compilation and marked as unused by the IDE
|
||||
// however, for some reasons removing it would cause a damn linking issue
|
||||
|
|
@ -4878,20 +4880,19 @@ void Player::_LoadEntryPointData(PreparedQueryResult result)
|
|||
return;
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
m_entryPointData.joinPos = WorldLocation(fields[4].GetUInt32(), // Map
|
||||
fields[0].GetFloat(), // X
|
||||
fields[1].GetFloat(), // Y
|
||||
fields[2].GetFloat(), // Z
|
||||
fields[3].GetFloat()); // Orientation
|
||||
m_entryPointData.joinPos = WorldLocation(fields[4].GetUInt32(), // Map
|
||||
fields[0].GetFloat(), // X
|
||||
fields[1].GetFloat(), // Y
|
||||
fields[2].GetFloat(), // Z
|
||||
fields[3].GetFloat()); // Orientation
|
||||
|
||||
std::string taxi = fields[5].GetString();
|
||||
std::string_view taxi = fields[5].GetStringView();
|
||||
if (!taxi.empty())
|
||||
{
|
||||
Tokenizer tokens(taxi, ' ');
|
||||
for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
|
||||
for (auto const& itr : Acore::Tokenize(taxi, ' ', false))
|
||||
{
|
||||
uint32 node = uint32(atol(*iter));
|
||||
m_entryPointData.taxiPath.push_back(node);
|
||||
uint32 node = Acore::StringTo<uint32>(itr).value_or(0);
|
||||
m_entryPointData.taxiPath.emplace_back(node);
|
||||
}
|
||||
|
||||
// Check integrity
|
||||
|
|
@ -4940,23 +4941,6 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
|
|||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index)
|
||||
{
|
||||
if (index >= data.size())
|
||||
return 0;
|
||||
|
||||
return (uint32)atoi(data[index]);
|
||||
}
|
||||
|
||||
float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
|
||||
{
|
||||
float result;
|
||||
uint32 temp = Player::GetUInt32ValueFromArray(data, index);
|
||||
memcpy(&result, &temp, sizeof(result));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Player::isBeingLoaded() const
|
||||
{
|
||||
return GetSession()->PlayerLoading();
|
||||
|
|
@ -5039,8 +5023,15 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
|
|||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadIntoDataField(fields[66].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[69].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2);
|
||||
if (!_LoadIntoDataField(fields[66].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE))
|
||||
{
|
||||
FMT_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid exploredzones data ({}). Forcing partial load.", guid, fields[66].GetStringView());
|
||||
}
|
||||
|
||||
if (!_LoadIntoDataField(fields[69].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2))
|
||||
{
|
||||
FMT_LOG_WARN("entities.player.loading", "Player::LoadFromDB: Player ({}) has invalid knowntitles mask ({}). Forcing partial load.", guid, fields[69].GetStringView());
|
||||
}
|
||||
|
||||
SetObjectScale(1.0f);
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
|
||||
|
|
@ -5117,7 +5108,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
|
|||
|
||||
std::string taxi_nodes = fields[42].GetString();
|
||||
|
||||
#define RelocateToHomebind(){ mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); }
|
||||
auto RelocateToHomebind = [this, &mapId, &instanceId]() { mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); };
|
||||
|
||||
_LoadGroup();
|
||||
|
||||
|
|
@ -6063,13 +6054,21 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3
|
|||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE);
|
||||
stmt->setUInt32(0, item->GetGUID().GetCounter());
|
||||
|
||||
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
|
||||
{
|
||||
std::string strGUID = (*result)[0].GetString();
|
||||
Tokenizer GUIDlist(strGUID, ' ');
|
||||
AllowedLooterSet looters;
|
||||
for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
|
||||
looters.insert(ObjectGuid::Create<HighGuid::Player>(atol(*itr)));
|
||||
for (std::string_view guidStr : Acore::Tokenize((*result)[0].GetStringView(), ' ', false))
|
||||
{
|
||||
if (Optional<ObjectGuid::LowType> guid = Acore::StringTo<ObjectGuid::LowType>(guidStr))
|
||||
{
|
||||
looters.insert(ObjectGuid::Create<HighGuid::Player>(*guid));
|
||||
}
|
||||
else
|
||||
{
|
||||
FMT_LOG_WARN("entities.player.loading", "Player::_LoadInventory: invalid item_soulbound_trade_data GUID '%s' for item %s. Skipped.", guidStr, item->GetGUID().ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue