aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-07 22:38:21 +0100
committerShauren <shauren.trinity@gmail.com>2023-01-07 22:38:21 +0100
commita53e4a57565d3375a978effbbc32d3eed6aac7e3 (patch)
tree070e7bd084fde9b62769c7ad1e4dbb52e82a10d9 /src
parent7830e5a7a1b93b0cd083baa3b70a0cfeb475f5f5 (diff)
Core/Misc: Replace enable_if overload selection with if constexpr
Diffstat (limited to 'src')
-rw-r--r--src/common/Containers/Utilities/MapUtils.h51
-rw-r--r--src/common/Utilities/Containers.h76
-rw-r--r--src/common/Utilities/Util.cpp2
-rw-r--r--src/common/Utilities/Util.h19
-rw-r--r--src/server/game/Chat/ChatCommands/ChatCommandArgs.h6
-rw-r--r--src/server/game/Grids/Dynamic/TypeContainerFunctions.h253
-rw-r--r--src/server/game/Spells/TraitMgr.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp2
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
9 files changed, 186 insertions, 227 deletions
diff --git a/src/common/Containers/Utilities/MapUtils.h b/src/common/Containers/Utilities/MapUtils.h
new file mode 100644
index 00000000000..7cf07243b0a
--- /dev/null
+++ b/src/common/Containers/Utilities/MapUtils.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITYCORE_MAP_UTILS_H
+#define TRINITYCORE_MAP_UTILS_H
+
+#include <type_traits>
+
+namespace Trinity::Containers
+{
+/**
+ * Returns a pointer to mapped value (or the value itself if map stores pointers)
+ */
+template<class M>
+auto MapGetValuePtr(M& map, typename M::key_type const& key)
+{
+ auto itr = map.find(key);
+ if constexpr (std::is_pointer_v<typename M::mapped_type>)
+ return itr != map.end() ? itr->second : nullptr;
+ else
+ return itr != map.end() ? &itr->second : nullptr;
+}
+
+template<class K, class V, template<class, class, class...> class M, class... Rest>
+void MultimapErasePair(M<K, V, Rest...>& multimap, K const& key, V const& value)
+{
+ auto range = multimap.equal_range(key);
+ for (auto itr = range.first; itr != range.second;)
+ {
+ if (itr->second == value)
+ itr = multimap.erase(itr);
+ else
+ ++itr;
+ }
+}
+}
+#endif // TRINITYCORE_MAP_UTILS_H
diff --git a/src/common/Utilities/Containers.h b/src/common/Utilities/Containers.h
index b9a42a7ab3b..85e52887655 100644
--- a/src/common/Utilities/Containers.h
+++ b/src/common/Utilities/Containers.h
@@ -19,6 +19,7 @@
#define TRINITY_CONTAINERS_H
#include "Define.h"
+#include "MapUtils.h"
#include "Random.h"
#include <algorithm>
#include <iterator>
@@ -29,18 +30,6 @@
namespace Trinity
{
- template<class T>
- constexpr inline T* AddressOrSelf(T* ptr)
- {
- return ptr;
- }
-
- template<class T>
- constexpr inline T* AddressOrSelf(T& not_ptr)
- {
- return std::addressof(not_ptr);
- }
-
template <class T>
class CheckedBufferOutputIterator
{
@@ -252,55 +241,44 @@ namespace Trinity
return false;
}
- /**
- * Returns a pointer to mapped value (or the value itself if map stores pointers)
- */
- template<class M>
- inline auto MapGetValuePtr(M& map, typename M::key_type const& key) -> decltype(AddressOrSelf(map.find(key)->second))
- {
- auto itr = map.find(key);
- return itr != map.end() ? AddressOrSelf(itr->second) : nullptr;
- }
-
- template<class K, class V, template<class, class, class...> class M, class... Rest>
- inline void MultimapErasePair(M<K, V, Rest...>& multimap, K const& key, V const& value)
+ namespace Impl
{
- auto range = multimap.equal_range(key);
- for (auto itr = range.first; itr != range.second;)
+ template <typename Container, typename Predicate>
+ void EraseIfMoveAssignable(Container& c, Predicate p)
{
- if (itr->second == value)
- itr = multimap.erase(itr);
- else
- ++itr;
+ auto wpos = c.begin();
+ for (auto rpos = c.begin(), end = c.end(); rpos != end; ++rpos)
+ {
+ if (!p(*rpos))
+ {
+ if (rpos != wpos)
+ std::swap(*rpos, *wpos);
+ ++wpos;
+ }
+ }
+ c.erase(wpos, c.end());
}
- }
- template <typename Container, typename Predicate>
- std::enable_if_t<std::is_move_assignable_v<decltype(*std::declval<Container>().begin())>, void> EraseIf(Container& c, Predicate p)
- {
- auto wpos = c.begin();
- for (auto rpos = c.begin(), end = c.end(); rpos != end; ++rpos)
+ template <typename Container, typename Predicate>
+ void EraseIfNotMoveAssignable(Container& c, Predicate p)
{
- if (!p(*rpos))
+ for (auto it = c.begin(); it != c.end();)
{
- if (rpos != wpos)
- std::swap(*rpos, *wpos);
- ++wpos;
+ if (p(*it))
+ it = c.erase(it);
+ else
+ ++it;
}
}
- c.erase(wpos, c.end());
}
template <typename Container, typename Predicate>
- std::enable_if_t<!std::is_move_assignable_v<decltype(*std::declval<Container>().begin())>, void> EraseIf(Container& c, Predicate p)
+ void EraseIf(Container& c, Predicate p)
{
- for (auto it = c.begin(); it != c.end();)
- {
- if (p(*it))
- it = c.erase(it);
- else
- ++it;
- }
+ if constexpr (std::is_move_assignable_v<decltype(*c.begin())>)
+ Impl::EraseIfMoveAssignable(c, std::ref(p));
+ else
+ Impl::EraseIfNotMoveAssignable(c, std::ref(p));
}
/**
diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp
index 0bdce5ee8f6..269784a0bfd 100644
--- a/src/common/Utilities/Util.cpp
+++ b/src/common/Utilities/Util.cpp
@@ -893,7 +893,7 @@ bool StringCompareLessI(std::string_view a, std::string_view b)
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), [](char c1, char c2) { return std::tolower(c1) < std::tolower(c2); });
}
-std::string GetTypeName(std::type_info const& info)
+std::string Trinity::Impl::GetTypeName(std::type_info const& info)
{
return boost::core::demangle(info.name());
}
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index caf8dd88bb1..57523ca558f 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -485,11 +485,24 @@ Ret* Coalesce(T1* first, T*... rest)
return static_cast<Ret*>(first);
}
-TC_COMMON_API std::string GetTypeName(std::type_info const&);
+namespace Trinity
+{
+namespace Impl
+{
+ TC_COMMON_API std::string GetTypeName(std::type_info const&);
+}
+
template <typename T>
-std::string GetTypeName() { return GetTypeName(typeid(T)); }
+std::string GetTypeName() { return Impl::GetTypeName(typeid(T)); }
template <typename T>
-std::enable_if_t<!std::is_same_v<std::decay_t<T>, std::type_info>, std::string> GetTypeName(T&& v) { return GetTypeName(typeid(v)); }
+std::string GetTypeName(T&& v)
+{
+ if constexpr (std::is_same_v<std::remove_cv_t<T>, std::type_info>)
+ return Impl::GetTypeName(v);
+ else
+ return Impl::GetTypeName(typeid(v));
+}
+}
template<typename T>
struct NonDefaultConstructible
diff --git a/src/server/game/Chat/ChatCommands/ChatCommandArgs.h b/src/server/game/Chat/ChatCommands/ChatCommandArgs.h
index 7788e9f50ee..f574b1c5d11 100644
--- a/src/server/game/Chat/ChatCommands/ChatCommandArgs.h
+++ b/src/server/game/Chat/ChatCommands/ChatCommandArgs.h
@@ -62,12 +62,12 @@ namespace Trinity::Impl::ChatCommands
if (Optional<T> v = StringTo<T>(token, 0))
val = *v;
else
- return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(token), GetTypeName<T>().c_str());
+ return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(token), Trinity::GetTypeName<T>().c_str());
if constexpr (std::is_floating_point_v<T>)
{
if (!std::isfinite(val))
- return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(token), GetTypeName<T>().c_str());
+ return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(token), Trinity::GetTypeName<T>().c_str());
}
return tail;
@@ -200,7 +200,7 @@ namespace Trinity::Impl::ChatCommands
}
if (next1)
- return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(strVal), GetTypeName<T>().c_str());
+ return FormatTrinityString(handler, LANG_CMDPARSER_STRING_VALUE_INVALID, STRING_VIEW_FMT_ARG(strVal), Trinity::GetTypeName<T>().c_str());
else
return next1;
}
diff --git a/src/server/game/Grids/Dynamic/TypeContainerFunctions.h b/src/server/game/Grids/Dynamic/TypeContainerFunctions.h
index e7dec91baf6..d138ccff2d7 100644
--- a/src/server/game/Grids/Dynamic/TypeContainerFunctions.h
+++ b/src/server/game/Grids/Dynamic/TypeContainerFunctions.h
@@ -31,210 +31,127 @@ namespace Trinity
{
// Helpers
// Insert helpers
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Insert(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
+ template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
+ inline bool Insert(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
{
- auto i = elements._element.find(handle);
- if (i == elements._element.end())
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
{
- elements._element[handle] = obj;
- return true;
+ auto i = elements._elements._element.find(handle);
+ if (i == elements._elements._element.end())
+ {
+ elements._elements._element[handle] = obj;
+ return true;
+ }
+ else
+ {
+ ASSERT(i->second == obj, "Object with certain key already in but objects are different!");
+ return false;
+ }
}
- else
- {
- ASSERT(i->second == obj, "Object with certain key already in but objects are different!");
- return false;
- }
- }
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Insert(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return false;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
- bool Insert(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return false;
+ if constexpr (std::is_same_v<T, TypeNull>)
+ return false;
+ else
+ return Insert(elements._TailElements, handle, obj);
}
+ // Find helpers
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
- bool Insert(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
+ inline SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
{
- bool ret = Insert(elements._elements, handle, obj);
- return ret ? ret : Insert(elements._TailElements, handle, obj);
- }
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ {
+ auto i = elements._elements._element.find(handle);
+ if (i == elements._elements._element.end())
+ return nullptr;
+ else
+ return i->second;
+ }
- // Find helpers
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- SPECIFIC_TYPE* Find(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
- {
- auto i = elements._element.find(handle);
- if (i == elements._element.end())
+ if constexpr (std::is_same_v<T, TypeNull>)
return nullptr;
else
- return i->second;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeNull, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return nullptr;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
- SPECIFIC_TYPE* Find(ContainerUnorderedMap<T, KEY_TYPE> const& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return nullptr;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
- SPECIFIC_TYPE* Find(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
- {
- SPECIFIC_TYPE* ret = Find(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
- return ret ? ret : Find(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
+ return Find(elements._TailElements, handle, obj);
}
// Erase helpers
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Remove(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
- {
- elements._element.erase(handle);
- return true;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Remove(ContainerUnorderedMap<TypeNull, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return false;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
- bool Remove(ContainerUnorderedMap<T, KEY_TYPE>& /*elements*/, KEY_TYPE const& /*handle*/, SPECIFIC_TYPE* /*obj*/)
- {
- return false;
- }
-
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
- bool Remove(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* /*obj*/)
- {
- bool ret = Remove(elements._elements, handle, (SPECIFIC_TYPE*)nullptr);
- return ret ? ret : Remove(elements._TailElements, handle, (SPECIFIC_TYPE*)nullptr);
- }
-
- // Count helpers
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Size(ContainerUnorderedMap<SPECIFIC_TYPE, KEY_TYPE> const& elements, std::size_t* size, SPECIFIC_TYPE* /*obj*/)
- {
- *size = elements._element.size();
- return true;
- }
-
- template<class SPECIFIC_TYPE, class KEY_TYPE>
- bool Size(ContainerUnorderedMap<TypeNull, KEY_TYPE> const& /*elements*/, std::size_t* /*size*/, SPECIFIC_TYPE* /*obj*/)
+ inline bool Remove(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE>& elements, KEY_TYPE const& handle, SPECIFIC_TYPE* obj)
{
- return false;
- }
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ {
+ elements._elements._element.erase(handle);
+ return true;
+ }
- template<class SPECIFIC_TYPE, class KEY_TYPE, class T>
- bool Size(ContainerUnorderedMap<T, KEY_TYPE> const& /*elements*/, std::size_t* /*size*/, SPECIFIC_TYPE* /*obj*/)
- {
- return false;
+ if constexpr (std::is_same_v<T, TypeNull>)
+ return false;
+ else
+ return Remove(elements._TailElements, handle, obj);
}
+ // Count helpers
template<class SPECIFIC_TYPE, class KEY_TYPE, class H, class T>
- bool Size(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, std::size_t* size, SPECIFIC_TYPE* /*obj*/)
+ inline bool Size(ContainerUnorderedMap<TypeList<H, T>, KEY_TYPE> const& elements, std::size_t* size, SPECIFIC_TYPE* obj)
{
- bool ret = Size(elements._elements, size, (SPECIFIC_TYPE*)nullptr);
- return ret ? ret : Size(elements._TailElements, size, (SPECIFIC_TYPE*)nullptr);
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ {
+ *size = elements._elements._element.size();
+ return true;
+ }
+
+ if constexpr (std::is_same_v<T, TypeNull>)
+ return false;
+ else
+ return Size(elements._TailElements, size, obj);
}
/* ContainerMapList Helpers */
// count functions
- template<class SPECIFIC_TYPE>
- size_t Count(ContainerMapList<SPECIFIC_TYPE> const& elements, SPECIFIC_TYPE* /*fake*/)
- {
- return elements._element.getSize();
- }
-
- template<class SPECIFIC_TYPE>
- size_t Count(ContainerMapList<TypeNull> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
- {
- return 0;
- }
-
- template<class SPECIFIC_TYPE, class T>
- size_t Count(ContainerMapList<T> const& /*elements*/, SPECIFIC_TYPE* /*fake*/)
- {
- return 0;
- }
-
- template<class SPECIFIC_TYPE, class T>
- size_t Count(ContainerMapList<TypeList<SPECIFIC_TYPE, T>> const& elements, SPECIFIC_TYPE* fake)
- {
- return Count(elements._elements, fake);
- }
-
template<class SPECIFIC_TYPE, class H, class T>
- size_t Count(ContainerMapList<TypeList<H, T>> const& elements, SPECIFIC_TYPE* fake)
+ inline size_t Count(ContainerMapList<TypeList<H, T>> const& elements, SPECIFIC_TYPE* fake)
{
- return Count(elements._TailElements, fake);
- }
-
- // non-const insert functions
- template<class SPECIFIC_TYPE>
- SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE>& elements, SPECIFIC_TYPE* obj)
- {
- //elements._element[hdl] = obj;
- obj->AddToGrid(elements._element);
- return obj;
- }
-
- template<class SPECIFIC_TYPE>
- SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
- {
- return nullptr;
- }
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ {
+ return elements._elements._element.getSize();
+ }
- // this is a missed
- template<class SPECIFIC_TYPE, class T>
- SPECIFIC_TYPE* Insert(ContainerMapList<T>& /*elements*/, SPECIFIC_TYPE* /*obj*/)
- {
- return nullptr; // a missed
+ if constexpr (std::is_same_v<T, TypeNull>)
+ return 0;
+ else
+ return Count(elements._TailElements, fake);
}
- // Recursion
+ // non-const insert functions
template<class SPECIFIC_TYPE, class H, class T>
- SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
+ inline SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
{
- SPECIFIC_TYPE* t = Insert(elements._elements, obj);
- return (t != nullptr ? t : Insert(elements._TailElements, obj));
+ if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ {
+ obj->AddToGrid(elements._elements._element);
+ return obj;
+ }
+
+ if constexpr (std::is_same_v<T, TypeNull>)
+ return nullptr;
+ else
+ return Insert(elements._TailElements, obj);
}
//// non-const remove method
- //template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<SPECIFIC_TYPE> & /*elements*/, SPECIFIC_TYPE *obj)
- //{
- // obj->GetGridRef().unlink();
- // return obj;
- //}
-
- //template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
- //{
- // return nullptr;
- //}
-
- //// this is a missed
- //template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
- //{
- // return nullptr; // a missed
- //}
-
- //template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
+ //template<class SPECIFIC_TYPE, class H, class T>
+ //SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T>>& elements, SPECIFIC_TYPE* obj)
//{
- // // The head element is bad
- // SPECIFIC_TYPE* t = Remove(elements._elements, obj);
- // return (t != nullptr ? t : Remove(elements._TailElements, obj));
+ // if constexpr (std::is_same_v<H, SPECIFIC_TYPE>)
+ // {
+ // obj->GetGridRef().unlink();
+ // return obj;
+ // }
+
+ // if constexpr (std::is_same_v<T, TypeNull>)
+ // return nullptr;
+ // else
+ // return Remove(elements._TailElements, obj);
//}
}
#endif
diff --git a/src/server/game/Spells/TraitMgr.cpp b/src/server/game/Spells/TraitMgr.cpp
index 694cfd31ec7..20bae857fdb 100644
--- a/src/server/game/Spells/TraitMgr.cpp
+++ b/src/server/game/Spells/TraitMgr.cpp
@@ -16,10 +16,10 @@
*/
#include "TraitMgr.h"
-#include "Containers.h"
#include "DB2Stores.h"
#include "IteratorPair.h"
#include "Player.h"
+#include "MapUtils.h"
#include "TraitPacketsCommon.h"
namespace TraitMgr
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 4a20f423892..2f84c6e9f77 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -566,7 +566,7 @@ public:
handler->PSendSysMessage(LANG_GOINFO_SIZE, gameObjectInfo->size);
handler->PSendSysMessage(LANG_OBJECTINFO_AIINFO, gameObjectInfo->AIName.c_str(), sObjectMgr->GetScriptName(gameObjectInfo->ScriptId).c_str());
if (GameObjectAI const* ai = thisGO ? thisGO->AI() : nullptr)
- handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, GetTypeName(*ai).c_str());
+ handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, Trinity::GetTypeName(*ai).c_str());
if (GameObjectDisplayInfoEntry const* modelInfo = sGameObjectDisplayInfoStore.LookupEntry(displayId))
handler->PSendSysMessage(LANG_GOINFO_MODEL, modelInfo->GeoBoxMax.X, modelInfo->GeoBoxMax.Y, modelInfo->GeoBoxMax.Z, modelInfo->GeoBoxMin.X, modelInfo->GeoBoxMin.Y, modelInfo->GeoBoxMin.Z);
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 6a6b543b6d0..5d0c0113a42 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -539,7 +539,7 @@ public:
STRING_VIEW_FMT_ARG(target->GetStringIds()[1]), STRING_VIEW_FMT_ARG(target->GetStringIds()[2]));
handler->PSendSysMessage(LANG_NPCINFO_REACTSTATE, DescribeReactState(target->GetReactState()));
if (CreatureAI const* ai = target->AI())
- handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, GetTypeName(*ai).c_str());
+ handler->PSendSysMessage(LANG_OBJECTINFO_AITYPE, Trinity::GetTypeName(*ai).c_str());
handler->PSendSysMessage(LANG_NPCINFO_FLAGS_EXTRA, cInfo->flags_extra);
for (CreatureFlagsExtra flag : EnumUtils::Iterate<CreatureFlagsExtra>())
if (cInfo->flags_extra & flag)