Warnings PR 3, remove std::move when not necessary. (#2108)

# Pull Request

std::move was being used in a few places to return a vector. Its not
necessary. A direct return allows for some optimizations that moving
wouldnt.

## How to Test the Changes

-Bots should initialize correctly 

## Complexity & Impact

- Does this change add new decision branches?
    - [x] No
    - [ ] Yes (**explain below**)

- Does this change increase per-bot or per-tick processing?
    - [x] No
    - [ ] Yes (**describe and justify impact**)

- Could this logic scale poorly under load?
    - [x] No
    - [ ] Yes (**explain why**)

---

## Defaults & Configuration

- Does this change modify default bot behavior?
    - [x] No
    - [ ] Yes (**explain why**)

If this introduces more advanced or AI-heavy logic:

- [x] Lightweight mode remains the default
- [ ] More complex behavior is optional and thereby configurable

---

## AI Assistance

- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
    - [x] No
    - [ ] Yes (**explain below**)

---

## Final Checklist

- [ ] Stability is not compromised
- [ ] Performance impact is understood, tested, and acceptable
- [ ] Added logic complexity is justified and explained
- [ ] Documentation updated if needed

---

## Notes for Reviewers

Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.

---------

Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
Keleborn
2026-02-13 09:22:27 -08:00
committed by GitHub
parent ee2a399ac8
commit 80b3823f12
8 changed files with 24 additions and 24 deletions

View File

@@ -184,7 +184,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
// // }
// // }
// return std::move(ret);
// return ret;
// }
// std::vector<TalentPath*> ChangeTalentsAction::getPremadePaths(TalentSpec* oldSpec)
@@ -201,7 +201,7 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
// // }
// // }
// return std::move(ret);
// return ret;
// }
// TalentPath* ChangeTalentsAction::getPremadePath(uint32 id)

View File

@@ -277,7 +277,7 @@ std::string const RandomPlayerbotFactory::CreateRandomBotName(NameRaceAndGender
botName.clear();
continue;
}
return std::move(botName);
return botName;
}
// TRUE RANDOM NAME GENERATION
@@ -302,11 +302,11 @@ std::string const RandomPlayerbotFactory::CreateRandomBotName(NameRaceAndGender
botName.clear();
continue;
}
return std::move(botName);
return botName;
}
LOG_ERROR("playerbots", "Random name generation failed.");
botName.clear();
return std::move(botName);
return botName;
}
// Calculates the total number of required accounts, either using the specified randomBotAccountCount
@@ -763,7 +763,7 @@ std::string const RandomPlayerbotFactory::CreateRandomGuildName()
if (!result)
{
LOG_ERROR("playerbots", "No more names left for random guilds");
return std::move(guildName);
return guildName;
}
Field* fields = result->Fetch();
@@ -777,13 +777,13 @@ std::string const RandomPlayerbotFactory::CreateRandomGuildName()
if (!result)
{
LOG_ERROR("playerbots", "No more names left for random guilds");
return std::move(guildName);
return guildName;
}
fields = result->Fetch();
guildName = fields[0].Get<std::string>();
return std::move(guildName);
return guildName;
}
void RandomPlayerbotFactory::CreateRandomArenaTeams(ArenaType type, uint32 count)
@@ -905,7 +905,7 @@ std::string const RandomPlayerbotFactory::CreateRandomArenaTeamName()
if (!result)
{
LOG_ERROR("playerbots", "No more names left for random arena teams");
return std::move(arenaTeamName);
return arenaTeamName;
}
Field* fields = result->Fetch();
@@ -920,11 +920,11 @@ std::string const RandomPlayerbotFactory::CreateRandomArenaTeamName()
if (!result)
{
LOG_ERROR("playerbots", "No more names left for random arena teams");
return std::move(arenaTeamName);
return arenaTeamName;
}
fields = result->Fetch();
arenaTeamName = fields[0].Get<std::string>();
return std::move(arenaTeamName);
return arenaTeamName;
}

View File

@@ -2680,7 +2680,7 @@ std::vector<uint32> RandomPlayerbotMgr::GetBgBots(uint32 bracket)
} while (result->NextRow());
}
return std::move(BgBots);
return BgBots;
}
CachedEvent* RandomPlayerbotMgr::FindEvent(uint32 bot, std::string const& event)

View File

@@ -1700,7 +1700,7 @@ std::vector<uint32> RandomItemMgr::GetQuestIdsForItem(uint32 itemId)
}
}
return std::move(questIds);
return questIds;
}
uint32 RandomItemMgr::GetUpgrade(Player* player, std::string spec, uint8 slot, uint32 quality, uint32 itemId)
@@ -1827,7 +1827,7 @@ std::vector<uint32> RandomItemMgr::GetUpgradeList(Player* player, std::string sp
{
std::vector<uint32> listItems;
if (!player)
return std::move(listItems);
return listItems;
// get old item statWeight
uint32 oldStatWeight = 0;
@@ -1848,7 +1848,7 @@ std::vector<uint32> RandomItemMgr::GetUpgradeList(Player* player, std::string sp
}
if (!specId)
return std::move(listItems);
return listItems;
if (itemId && itemInfoCache.find(itemId) != itemInfoCache.end())
{
@@ -1942,7 +1942,7 @@ std::vector<uint32> RandomItemMgr::GetUpgradeList(Player* player, std::string sp
LOG_INFO("playerbots", "New Items: {}, Old item:%d, New items max: {}", listItems.size(), oldStatWeight,
closestUpgradeWeight);
return std::move(listItems);
return listItems;
}
bool RandomItemMgr::HasStatWeight(uint32 itemId)

View File

@@ -317,7 +317,7 @@ std::vector<TalentSpec::TalentListEntry> TalentSpec::GetTalentTree(uint32 tabpag
if (entry.tabPage() == tabpage)
retList.push_back(entry);
return std::move(retList);
return retList;
}
uint32 TalentSpec::GetTalentPoints(int32 tabpage) { return GetTalentPoints(talents, tabpage); };
@@ -368,7 +368,7 @@ std::string const TalentSpec::GetTalentLink()
if (treeLink[2] != "0")
link = link + "-" + treeLink[2];
return std::move(link);
return link;
}
uint32 TalentSpec::highestTree()

View File

@@ -480,7 +480,7 @@ std::string const WorldPosition::getAreaName(bool fullName, bool zoneName)
}
}
return std::move(areaName);
return areaName;
}
std::set<Transport*> WorldPosition::getTransports(uint32 entry)
@@ -4022,7 +4022,7 @@ std::vector<TravelDestination*> TravelMgr::getRpgTravelDestinations(Player* bot,
retTravelLocations.push_back(dest);
}
return std::move(retTravelLocations);
return retTravelLocations;
}
std::vector<TravelDestination*> TravelMgr::getExploreTravelDestinations(Player* bot, bool ignoreFull,

View File

@@ -440,7 +440,7 @@ std::vector<std::pair<T, WorldPosition>> GetPosList(std::vector<T> oList)
for (auto& obj : oList)
retList.push_back(std::make_pair(obj, WorldPosition(obj)));
return std::move(retList);
return retList;
};
template <class T>
@@ -450,7 +450,7 @@ std::vector<std::pair<T, WorldPosition>> GetPosVector(std::vector<T> oList)
for (auto& obj : oList)
retList.push_back(make_pair(obj, WorldPosition(obj)));
return std::move(retList);
return retList;
};
class mapTransfer

View File

@@ -364,7 +364,7 @@ std::vector<TravelNode*> TravelNode::getNodeMap(bool importantOnly, std::vector<
}
}
return std::move(closeList);
return closeList;
}
bool TravelNode::isUselessLink(TravelNode* farNode)
@@ -1135,7 +1135,7 @@ std::vector<TravelNode*> TravelNodeMap::getNodes(WorldPosition pos, float range)
[pos](TravelNode* i, TravelNode* j)
{ return i->getPosition()->distance(pos) < j->getPosition()->distance(pos); });
return std::move(retVec);
return retVec;
}
TravelNode* TravelNodeMap::getNode(WorldPosition pos, [[maybe_unused]] std::vector<WorldPosition>& ppath, Unit* bot,