NitroHack icon indicating copy to clipboard operation
NitroHack copied to clipboard

Extra turn spent when auto-travelling into obstacles

Open tung opened this issue 13 years ago • 0 comments

Rather than describe it in bug form, I'll just quote how I fixed it.

Fix extra turn spent travelling into obstacles

This actually fixes two closely-related bugs: travelling into a wall when adjacent to it, and when not adjacent to it. In both cases, you must target the stone behind the wall to trigger the bug.

The core problem was that domove() was continuing to do moving logic after travelling hit an obstacle, causing it to return 1 even though the player hadn't moved.

From there, travelling into a wall when next to it spent a turn because it itself always returned 1 instead of the result of domove(). Travelling into a wall when not starting next to it spent a turn because the result of domove() in command_input() didn't set flags.move to 0 like do_command() normally does.

This also removes useless lines in domove() that set flags.move to 0, since NitroHack already does this when a command function returns 0.

This bug also exists in upstream NitroHack.

https://github.com/tung/NitroHack/commit/4f43437b4393b6b8b1c707765ba7f19256809ab0

tung avatar Sep 01 '12 12:09 tung