Skip to content

Commit

Permalink
safe checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Vaqtincha committed Jun 12, 2021
1 parent 2a4e5c0 commit 46deaf5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions regamedll/game_shared/bot/bot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,19 @@ const char *CBotManager::GetNavMapFilename() const
void CBotManager::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
{
#ifdef REGAMEDLL_ADD
if (event == EVENT_PLAYER_TOOK_DAMAGE)
if (event == EVENT_PLAYER_TOOK_DAMAGE && pOther->IsPlayer())
{
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(pOther);

if (pAttacker && !pAttacker->IsBot())
{
CBot *bot = static_cast<CBot *>(pEntity);
bot->OnEvent(event, pEntity, pOther);
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);

if (pPlayer && pPlayer->IsBot())
{
CBot *bot = static_cast<CBot *>(pPlayer);
bot->OnEvent(event, pEntity, pOther);
}
}
}
else
Expand Down

0 comments on commit 46deaf5

Please sign in to comment.