diff --git a/common/strings.cpp b/common/strings.cpp index 4dbd9610c..46aeed759 100644 --- a/common/strings.cpp +++ b/common/strings.cpp @@ -770,3 +770,16 @@ int Strings::ToInt(const std::string &s, int fallback) { return Strings::IsNumber(s) ? std::stoi(s) : fallback; } + +std::string Strings::RemoveNumbers(std::string s) +{ + int current = 0; + for (int i = 0; i < s.length(); i++) { + if (!isdigit(s[i])) { + s[current] = s[i]; + current++; + } + } + + return s.substr(0, current); +} diff --git a/common/strings.h b/common/strings.h index 80bba11cf..2291a9e50 100644 --- a/common/strings.h +++ b/common/strings.h @@ -88,6 +88,7 @@ public: static bool Contains(const std::string& subject, const std::string& search); static int ToInt(const std::string &s, int fallback = 0); static bool IsNumber(const std::string &s); + static std::string RemoveNumbers(std::string s); static bool IsFloat(const std::string &s); static const std::string ToLower(std::string s); static const std::string ToUpper(std::string s); diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 6b8f85bba..5cfdd9f15 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -999,7 +999,13 @@ void Mob::AI_Process() { } if (door->GetTriggerDoorID() > 0) { - continue; + auto trigger_door = entity_list.GetDoorsByDoorID(door->GetTriggerDoorID()); + if (trigger_door) { + if (Strings::RemoveNumbers(door->GetDoorName()) != + Strings::RemoveNumbers(trigger_door->GetDoorName())) { + continue; + } + } } if (door->GetDoorParam() > 0) {