Added const cast Entity::CastToBot()

This commit is contained in:
Uleat 2019-06-21 06:00:58 -04:00
parent ca874cb861
commit e903b06c22
4 changed files with 29 additions and 12 deletions

View File

@ -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);

View File

@ -286,6 +286,17 @@ Bot *Entity::CastToBot()
#endif
return static_cast<Bot *>(this);
}
const Bot *Entity::CastToBot() const
{
#ifdef _EQDEBUG
if (!IsBot()) {
std::cout << "CastToBot error" << std::endl;
return 0;
}
#endif
return static_cast<const Bot *>(this);
}
#endif
EntityList::EntityList()

View File

@ -116,6 +116,7 @@ public:
#ifdef BOTS
Bot* CastToBot();
const Bot* CastToBot() const;
#endif
protected:

View File

@ -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()) {
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");
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");
}
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()) {
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");
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");
}
else {
Log(Logs::Detail, Logs::None,
"[CLIENT] Perl(XS_Client_MovePCInstance) attempted to process an Unknown type reference");