From 1bdcf576ddbd436d5483b6ceb1c89c9b6796b833 Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 13 Dec 2024 08:01:37 +0100 Subject: [PATCH] Arena: Make arena team name check case insensitive --- src/game/Globals/ObjectMgr.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index dfd7146228..75c066f4d3 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -198,11 +198,19 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const return nullptr; } +bool ichar_equals(char a, char b) +{ + return std::tolower(static_cast(a)) == std::tolower(static_cast(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; }