Skip to content

Commit de79196

Browse files
committed
Don't teleport if there are is nowhere valid to teleport to
1 parent f573b89 commit de79196

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/gameplay.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,14 +682,16 @@ void trigger_step(u8 mob) {
682682
update_tile(pos, TILE_SAW_BROKEN);
683683
nop_saw_anim(pos);
684684
} else if (tile == TILE_TELEPORTER && !teleported) {
685+
u8 can_teleport = 0;
685686
u8 newpos = 0;
686687
do {
687688
if (tmap[newpos] == TILE_TELEPORTER && !IS_MOB(newpos)) {
689+
can_teleport = 1;
688690
break;
689691
}
690692
} while(++newpos);
691693

692-
if (pos != newpos) {
694+
if (can_teleport && pos != newpos) {
693695
// Move mob position in mobmap
694696
mobmap[pos] = 0;
695697
mobmap[newpos] = mob + 1;

0 commit comments

Comments
 (0)