Skip to content

Commit

Permalink
Fix: portal creation on top of existing trap didn't account for ammo
Browse files Browse the repository at this point in the history
Fuzzer-discovered. For some reason, the way portals are created is that
a region is defined, then the rest of the special level creation happens
(including adding traps), then in fixup_special() it actually tries to
create the portal. If the region is a single coordinate to make the
portal appear in a certain spot, and a trap already generated there, it
deletes the trap.

This is all well and good except the trap may contain ammo and if it
does, this caused an impossible since it wasn't previously expected. Now
that I know this is a legitimate possibility, explicitly handle ammo (by
deleting it).
  • Loading branch information
copperwater committed Sep 26, 2021
1 parent 64c7266 commit fb8830f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mkmaze.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ put_lregion_here(
struct trap *t = t_at(x, y);

if (t && t->ttyp != MAGIC_PORTAL && t->ttyp != VIBRATING_SQUARE)
deltrap(t);
deltrap_with_ammo(t, DELTRAP_DESTROY_AMMO);
if (bad_location(x, y, nlx, nly, nhx, nhy))
return FALSE;
}
Expand Down

0 comments on commit fb8830f

Please sign in to comment.