diff --git a/Source/monster.cpp b/Source/monster.cpp index e719a5c7c..28ef5c257 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -1902,11 +1902,8 @@ bool RoundWalk(Monster &monster, Direction direction, int8_t *dir) return RandomWalk(monster, Opposite(turn90deg)); } -bool AiPlanPath(int monsterId) +bool AiPlanPath(Monster &monster) { - assert(static_cast(monsterId) < MaxMonsters); - auto &monster = Monsters[monsterId]; - if (monster.type().type != MT_GOLEM) { if (monster.activeForTicks == 0) return false; @@ -4102,7 +4099,7 @@ void GolumAi(int monsterId) StartAttack(golem); return; } - if (AiPlanPath(monsterId)) + if (AiPlanPath(golem)) return; } @@ -4203,7 +4200,7 @@ void ProcessMonsters() } } while (true) { - if ((monster.flags & MFLAG_SEARCH) == 0 || !AiPlanPath(monsterId)) { + if ((monster.flags & MFLAG_SEARCH) == 0 || !AiPlanPath(monster)) { AiProc[monster.ai](monsterId); }