From a95f6b1754dc7bbaf2ed21b757412ba8ad989ae2 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 22 Aug 2021 11:15:45 +0200 Subject: [PATCH] [hellfire] Bugfix: Correctly detect nultiple walls Fixes #2656 --- Source/monster.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Source/monster.cpp b/Source/monster.cpp index a3f2403f3..7cb584599 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -2009,29 +2009,22 @@ bool IsTileSafe(const MonsterStruct &monster, Point position) return true; } - bool fire = false; - bool lightning = false; + bool fearsFire = (monster.mMagicRes & IMMUNE_FIRE) == 0 || monster.MType->mtype == MT_DIABLO; + bool fearsLightning = (monster.mMagicRes & IMMUNE_LIGHTNING) == 0 || monster.MType->mtype == MT_DIABLO; for (int j = 0; j < ActiveMissileCount; j++) { uint8_t mi = ActiveMissiles[j]; auto &missile = Missiles[mi]; if (missile.position.tile == position) { - if (missile._mitype == MIS_FIREWALL) { - fire = true; - break; + if (fearsFire && missile._mitype == MIS_FIREWALL) { + return false; } - if (missile._mitype == MIS_LIGHTWALL) { - lightning = true; - break; + if (fearsLightning && missile._mitype == MIS_LIGHTWALL) { + return false; } } } - if (fire && ((monster.mMagicRes & IMMUNE_FIRE) == 0 || monster.MType->mtype == MT_DIABLO)) - return false; - if (lightning && ((monster.mMagicRes & IMMUNE_LIGHTNING) == 0 || monster.MType->mtype == MT_DIABLO)) - return false; - return true; }