Browse Source

♻️ Remove monsterId from AiPlanPath

pull/5106/head
Cesar Canassa 4 years ago committed by Anders Jenbo
parent
commit
f12e636abb
  1. 9
      Source/monster.cpp

9
Source/monster.cpp

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

Loading…
Cancel
Save