mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
[Doors] Have NPCs trigger double doors (#2821)
This commit is contained in:
parent
2b224d42ad
commit
0a114fae9a
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user