Core/Misc: reduced amount of string memory allocations (Step I)
This commit is contained in:
1 parent
ca85c3b475
commit
013fb1f4d9
91 files changed
+881
-890
No files matched your search
@@ -92,7 +92,8 @@ WorldObject::~WorldObject()
|
||||
{
|
||||
if (GetTypeId() == TYPEID_CORPSE)
|
||||
{
|
||||
sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
|
||||
sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!",
|
||||
GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
|
||||
ASSERT(false);
|
||||
}
|
||||
ResetMap();
|
||||
@@ -767,23 +768,6 @@ void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) cons
|
||||
BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
|
||||
}
|
||||
|
||||
void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 count)
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
Tokenizer tokens(data, ' ', count);
|
||||
|
||||
if (tokens.size() != count)
|
||||
return;
|
||||
|
||||
for (uint32 index = 0; index < count; ++index)
|
||||
{
|
||||
m_uint32Values[startOffset + index] = atol(tokens[index]);
|
||||
_changedFields[startOffset + index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const
|
||||
{
|
||||
// This function assumes updatefield index is always valid
|
||||
@@ -844,6 +828,23 @@ bool Object::IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool
|
||||
return false;
|
||||
}
|
||||
|
||||
void Object::_LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count)
|
||||
{
|
||||
if (data.empty())
|
||||
return;
|
||||
|
||||
Tokenizer tokens(data, ' ', count);
|
||||
|
||||
if (tokens.size() != count)
|
||||
return;
|
||||
|
||||
for (uint32 index = 0; index < count; ++index)
|
||||
{
|
||||
m_uint32Values[startOffset + index] = atol(tokens[index]);
|
||||
_changedFields[startOffset + index] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
|
||||
{
|
||||
bool* indexes = _changedFields;
|
||||
@@ -2124,13 +2125,13 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const
|
||||
void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const &name, uint64 targetGuid) const
|
||||
{
|
||||
*data << (uint8)msgtype;
|
||||
*data << (uint32)language;
|
||||
*data << (uint64)GetGUID();
|
||||
*data << (uint32)0; // 2.1.0
|
||||
*data << (uint32)(strlen(name)+1);
|
||||
*data << (uint32)(name.size()+1);
|
||||
*data << name;
|
||||
*data << (uint64)targetGuid; // Unit Target
|
||||
if (targetGuid && !IS_PLAYER_GUID(targetGuid))
|
||||
|
||||
Reference in new issue
Block a user