mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-22 12:21:44 +00:00
Try to fix monsters getting stuck by waiting forever for their enemy.
44472722e added some sanity checks to the AI code. The checks in ai_run() are likely wrong because the enemy entity might be already NULL if we arrive their. By aborting early the code is unable to determine a new enemy or return the monster to idle state, so the monster will wait forever for an enemy that'll never come. This happens only in monster vs. monster fights. Never in monster vs. player, that game ends if the player dies. In theory this change should be harmless, because if the enemy entity is gone it won't generate sound targets now be visible. If the game crashes by self->enemy being NULL we've got a problem elsewere. This was reported by @BjossiAlfreds in #483. He also suggested the fix
This commit is contained in:
parent
003a1282ad
commit
501ed1e71a
1 changed files with 1 additions and 1 deletions
|
@ -1375,7 +1375,7 @@ ai_run(edict_t *self, float dist)
|
||||||
qboolean gotcha = false;
|
qboolean gotcha = false;
|
||||||
edict_t *realEnemy;
|
edict_t *realEnemy;
|
||||||
|
|
||||||
if (!self || !self->enemy || !self->enemy->inuse)
|
if (!self)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue