Skip to content

Commit

Permalink
Arena: Make arena team name check case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Dec 13, 2024
1 parent a3b3626 commit 1bdcf57
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,19 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
return nullptr;
}

bool ichar_equals(char a, char b)
{
return std::tolower(static_cast<unsigned char>(a)) == std::tolower(static_cast<unsigned char>(b));
}

ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
{
for (const auto& itr : mArenaTeamMap)
if (itr.second->GetName() == arenateamname)
{
std::string const& teamName = itr.second->GetName();
if (std::equal(teamName.begin(), teamName.end(), arenateamname.begin(), arenateamname.end(), ichar_equals))
return itr.second;
}

return nullptr;
}
Expand Down

0 comments on commit 1bdcf57

Please sign in to comment.