diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/ai-bots.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/hdb/ai-bots.cpp b/engines/hdb/ai-bots.cpp index 33a15c08dd..ac4b24197c 100644 --- a/engines/hdb/ai-bots.cpp +++ b/engines/hdb/ai-bots.cpp @@ -1407,6 +1407,8 @@ void aiLaserAction(AIEntity *e) { AIEntity *hit = e; int moveOK = 0; + int moveCount = 0; + do { int nx = hit->tileX; int ny = hit->tileY; @@ -1541,6 +1543,13 @@ void aiLaserAction(AIEntity *e) { hit = NULL; } } + + moveCount++; + + // It is possible to set a configuration which leads to a closed loop. + // Thus, we're breaking it here + if (moveCount > 1000) + hit = NULL; } while (hit && hit->type == AI_DIVERTER); } |