diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 4e3c33886..8a3da1092 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -735,6 +735,7 @@ type', in which case, the answer is yes. } #ifdef BOTS + // this is HIGHLY inefficient bool HasRuleDefined = false; bool IsBotAttackAllowed = false; IsBotAttackAllowed = Bot::IsBotAttackAllowed(mob1, mob2, HasRuleDefined); diff --git a/zone/entity.cpp b/zone/entity.cpp index 1b636d329..d1ecfc990 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -286,6 +286,17 @@ Bot *Entity::CastToBot() #endif return static_cast(this); } + +const Bot *Entity::CastToBot() const +{ +#ifdef _EQDEBUG + if (!IsBot()) { + std::cout << "CastToBot error" << std::endl; + return 0; + } +#endif + return static_cast(this); +} #endif EntityList::EntityList() diff --git a/zone/entity.h b/zone/entity.h index b815dc396..fb9b1f09b 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -116,6 +116,7 @@ public: #ifdef BOTS Bot* CastToBot(); + const Bot* CastToBot() const; #endif protected: diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 148aa7731..be1bf2a8e 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -1233,15 +1233,17 @@ XS(XS_Client_MovePC) { if (THIS->IsMerc()) { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Merc reference"); - } else if (THIS->IsNPC()) { + } +#ifdef BOTS + else if (THIS->IsBot()) { + Log(Logs::Detail, Logs::None, + "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); + } +#endif + else if (THIS->IsNPC()) { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type NPC reference"); } -#ifdef BOTS - else if (THIS->IsBot()) { - Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process a type Bot reference"); - } -#endif else { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePC) attempted to process an Unknown type reference"); @@ -1283,15 +1285,17 @@ XS(XS_Client_MovePCInstance) { if (THIS->IsMerc()) { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Merc reference"); - } else if (THIS->IsNPC()) { + } +#ifdef BOTS + else if (THIS->IsBot()) { + Log(Logs::Detail, Logs::None, + "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); + } +#endif + else if (THIS->IsNPC()) { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type NPC reference"); } -#ifdef BOTS - else if (THIS->IsBot()) { - Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process a type Bot reference"); - } -#endif else { Log(Logs::Detail, Logs::None, "[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");