V811 Decreased performance. Excessive type casting: string -> char * -> string. Consider inspecting third argument of the function sendChatMessage. AIInterface.cpp 1532

V811 Decreased performance. Excessive type casting: string -> char * -> string. Consider inspecting third argument of the function sendChatMessage. AIInterface.cpp 3746
V811 Decreased performance. Excessive type casting: string -> char * -> string. Consider inspecting third argument of the function sendChatMessage. AIInterface.cpp 3849
V823 Decreased performance. Object may be created in-place in the 'm_specs[s].talents' container. Consider replacing methods: 'insert' -> 'emplace'. Player.cpp 14462
V823 Decreased performance. Object may be created in-place in the 'mAISpellEmote' container. Consider replacing methods: 'push_back' -> 'emplace_back'. AIInterface.cpp 3736
V836 Expression's value is copied at the 'wayPoint' variable declaration. The variable is never modified. Consider declaring it as a reference. AIInterface.cpp 3381
V836 Expression's value is copied at the 'wayPoint' variable declaration. The variable is never modified. Consider declaring it as a reference. AIInterface.cpp 3429
V836 Expression's value is copied at the 'cd' variable declaration. The variable is never modified. Consider declaring it as a reference. SmsgInitialSpells.h 100
This commit is contained in:
Zyres
2023-07-08 19:42:38 +02:00
parent 174a14ccde
commit 4645858346
3 changed files with 8 additions and 8 deletions

View File

@@ -1529,7 +1529,7 @@ void AIInterface::handleAgentFlee(uint32_t p_time)
getUnit()->setControlled(true, UNIT_STATE_FLEEING);
std::string msg = "%s attempts to run away in fear!";
getUnit()->sendChatMessage(CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, msg.c_str());
getUnit()->sendChatMessage(CHAT_MSG_MONSTER_EMOTE, LANG_UNIVERSAL, msg);
// On Flee Scripts
for (auto onFleeScript : onFleeScripts)
@@ -3378,7 +3378,7 @@ bool AIInterface::activateShowWayPoints(Player* player, bool /*showBackwards*/)
mShowWayPoints = true;
for (auto wayPoint : mWayPointMap->nodes)
for (auto &wayPoint : mWayPointMap->nodes)
{
Creature* targetCreature = static_cast<Creature*>(getUnit());
@@ -3426,7 +3426,7 @@ bool AIInterface::hideWayPoints(Player* player)
mShowWayPoints = false;
for (auto wayPoint : mWayPointMap->nodes)
for (auto &wayPoint : mWayPointMap->nodes)
{
uint64_t guid = ((uint64_t)HIGHGUID_TYPE_WAYPOINT << 32) | wayPoint.id;
WoWGuid wowguid(guid);
@@ -3733,7 +3733,7 @@ void CreatureAISpells::addDBEmote(uint32_t textId)
void CreatureAISpells::addEmote(std::string pText, uint8_t pType, uint32_t pSoundId)
{
if (!pText.empty() || pSoundId)
mAISpellEmote.push_back(AISpellEmotes(pText, pType, pSoundId));
mAISpellEmote.emplace_back(AISpellEmotes(pText, pType, pSoundId));
}
void CreatureAISpells::sendRandomEmote(Unit* creatureAI)
@@ -3743,7 +3743,7 @@ void CreatureAISpells::sendRandomEmote(Unit* creatureAI)
sLogger.debug("AISpellEmotes::sendRandomEmote() : called");
uint32_t randomUInt = (mAISpellEmote.size() > 1) ? Util::getRandomUInt(static_cast<uint32_t>(mAISpellEmote.size() - 1)) : 0;
creatureAI->sendChatMessage(mAISpellEmote[randomUInt].mType, LANG_UNIVERSAL, mAISpellEmote[randomUInt].mText.c_str());
creatureAI->sendChatMessage(mAISpellEmote[randomUInt].mType, LANG_UNIVERSAL, mAISpellEmote[randomUInt].mText);
if (mAISpellEmote[randomUInt].mSoundId != 0)
creatureAI->PlaySoundToSet(mAISpellEmote[randomUInt].mSoundId);
@@ -3846,7 +3846,7 @@ void CreatureAISpells::sendAnnouncement(Unit* pUnit)
{
sLogger.debug("AISpellEmotes::sendAnnouncement() : called");
pUnit->sendChatMessage(CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, mAnnouncement.c_str());
pUnit->sendChatMessage(CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, mAnnouncement);
}
}

View File

@@ -14459,7 +14459,7 @@ void Player::loadFromDBProc(QueryResultVector& results)
uint8_t rank = (uint8_t)atol(start);
start = end + 1;
m_specs[s].talents.insert(std::pair<uint32_t, uint8_t>(talentid, rank));
m_specs[s].talents.emplace(std::pair<uint32_t, uint8_t>(talentid, rank));
}
}
#else

View File

@@ -97,7 +97,7 @@ namespace AscEmu::Packets
packet << uint16_t(spell_cooldowns.size());
for (auto cd : spell_cooldowns)
for (auto &cd : spell_cooldowns)
{
#if VERSION_STRING <= TBC
packet << uint16_t(cd.spell_id);