Skip to content

Commit

Permalink
Fix CTalkMonster::RunTask not properly initializing variable
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Nov 29, 2021
1 parent 12d4107 commit 55a1e89
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions dlls/talkmonster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,22 +476,17 @@ void CTalkMonster::RunTask(Task_t* pTask)
switch (pTask->iTask)
{
case TASK_TLK_CLIENT_STARE:
case TASK_TLK_LOOK_AT_CLIENT:

edict_t* pPlayer;
case TASK_TLK_LOOK_AT_CLIENT: {
// Get edict for one player
edict_t* pPlayer = g_engfuncs.pfnPEntityOfEntIndex(1);

// track head to the client for a while.
if (m_MonsterState == MONSTERSTATE_IDLE &&
if (pPlayer &&
m_MonsterState == MONSTERSTATE_IDLE &&
!IsMoving() &&
!IsTalking())
{
// Get edict for one player
pPlayer = g_engfuncs.pfnPEntityOfEntIndex(1);

if (pPlayer)
{
IdleHeadTurn(pPlayer->v.origin);
}
IdleHeadTurn(pPlayer->v.origin);
}
else
{
Expand Down Expand Up @@ -522,6 +517,7 @@ void CTalkMonster::RunTask(Task_t* pTask)
TaskComplete();
}
break;
}

case TASK_FACE_PLAYER: {
// Get edict for one player
Expand Down

0 comments on commit 55a1e89

Please sign in to comment.