From: Holger Schemel Date: Sat, 28 Jan 2023 13:29:08 +0000 (+0100) Subject: fixed overloading laser due to duplicated tiles in damage list in MM engine X-Git-Tag: 4.3.5.0~25 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f8aec4470bbcfcd92e976580cee1b6e05e4e8683;p=rocksndiamonds.git fixed overloading laser due to duplicated tiles in damage list in MM engine Repeatedly adding tiles to the damage list that have already been added before for the same laser edge can cause filling up the list very quickly, causing the laser to overload as a result. --- diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 63e892c5..641aa4fd 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -825,6 +825,13 @@ void AddLaserEdge(int lx, int ly) void AddDamagedField(int ex, int ey) { + // prevent adding the same field position again + if (laser.num_damages > 0 && + laser.damage[laser.num_damages - 1].x == ex && + laser.damage[laser.num_damages - 1].y == ey && + laser.damage[laser.num_damages - 1].edge == laser.num_edges) + return; + laser.damage[laser.num_damages].is_mirror = FALSE; laser.damage[laser.num_damages].angle = laser.current_angle; laser.damage[laser.num_damages].edge = laser.num_edges;