-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nextStep can return -1 in Monster.c:2020 #70
Comments
Thanks for the report. On what turn do you get these errors? And do they cause an out-of-sync error? I get an out-of-sync error on turn 686, does that seem right? |
Yeah, the errors happen at turn 686, however I do not get an out-of-sync error. |
I also have a out-of-sync at turn 686 when view your recording. You press "j" to go in water. Can we find seed in the recording file ? Or have you the seed ? |
The seed is 232800572 |
Ok! Looks like this is an out-of-sync bug. Good find, now we need to work out the cause. |
I found another recording with this issue at turn 790, if that helps. |
I've found the cause of this issue. If you go to turn 686 on your first recording, there are two small pools, each containing an eel. By some strange dungeon generation (bug?), those two eels are actually part of the same horde: one is a follower of the other. So the follower, being more than 2 cells away from its leader (condition in monstersTurn at Monsters.c:3350), tries to path towards the other eel with pathTowardCreature. However, there is no traversable path to follow - so nextStep returns -1, which isn't checked, and hence invalid access occurs. This is a really good find, thanks for the report! |
Previously, if nextStep returned NO_DIRECTION (-1) an invalid access would occur, causing an out-of-sync error. (#70) This also slightly changes the logic. Previously, if moveMonsterPassivelyTowards failed, a random step would be tried. Now a random step is only tried if nextStep fails. I think this should be almost the same, since nextStep checks whether it can pass any adjacent monsters, which seems to be why the moveMonsterPassivelyTowards return value was checked.
Amazing work guys! |
Hi,
I built BrogueCE with
-fsanitize=undefined
and noticed the following errors:this suggests that
dir
is-1
in the following snippet:The errors reliably occur for me in this zipped recording at turn 686 with BrogueCE a53673d compiled with clang 9.
I am not really familiar with the codebase and cannot tell if this results in an actual observable bug or how to fix this in a good way. Feel free to close this issue if this is something that can be ignored.
The text was updated successfully, but these errors were encountered: