Skip to content

Commit

Permalink
Fix: trapped without a trap (fmon). This is something strange I picke…
Browse files Browse the repository at this point in the history
…d up in the fuzzer. A green slime was able to engulf a monster while being trapped in a pit. After finishing the engulf attack, the slime was placed outside of the trap but still was marked as trapped.
  • Loading branch information
elunna committed Oct 27, 2023
1 parent ac030a2 commit c03d2cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/steed.c
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,12 @@ int x, y;
mon->mstate, buf);
return;
}
/* If monster was trapped, it's possible that while engulfing it
* may change position. Ex: A green slime engulfing a monster can end
* up in a different position than it started after finishing the engulf. */
if (mon->mtrapped && mon->mx != x && mon->my != y)
mon->mtrapped = 0;

mon->mx = x, mon->my = y;
level.monsters[x][y] = mon;
}
Expand Down

0 comments on commit c03d2cd

Please sign in to comment.