iolivia / rust-sokoban

Rust Sokoban book and code samples
https://sokoban.iolivia.me
MIT License
156 stars 30 forks source link

Box can move in situation where it shouldn't move #71

Open danieldeankon opened 4 years ago

danieldeankon commented 4 years ago

Steps to reproduce:

I was able to stop the behaviour by changing the match expression on line 173 to

                            match immov.get(&pos) {
                                Some(id) => {
                                    to_move.clear();
                                    break
                                },
                                None => break,
                            }

I haven't tested rigorously to see whether or not this introduces any new unwanted behaviour, but it seems to not do so.

L-F-Stack-Exchange commented 4 years ago

Since the attached video seems corrupt, here's the result:

image

where the box is moved even though it is obstructed by a wall.

desttinghim commented 4 years ago

This fix also prevents multiple of the same sounds playing at the same time when audio is introduced. When this happens it appears that the sounds suddenly got louder, but that's just what happens when the same sound is played simultaneously.