Prevent inappropriate diagonal dismounts
Dismounting a steed checked whether the target spot was accessible and whether there was a monster on it, but not whether it could actually be accessed by the hero through normal movement. As a result, dismounting allowed the hero to pass between diagonal gaps that would normally cause a "you are carrying too much to get through" pline; this could leave them in a position where they are effectively stuck, unable to remount their steed or move away without dropping their inventory. This also could be abused by dismounting in Sokoban to squeeze between boulders in a way that would normally be impossible. Using a successful result test_move as one of the requirements for a spot to be valid prevents this and limits valid dismount targets to squares that would normally be accessible through standard movement.
This commit is contained in:
committed by
Pasi Kallinen
parent
0b638592a4
commit
e7e418c1ec
@@ -454,7 +454,8 @@ int forceit;
|
||||
if (!isok(x, y) || (x == u.ux && y == u.uy))
|
||||
continue;
|
||||
|
||||
if (accessible(x, y) && !MON_AT(x, y)) {
|
||||
if (accessible(x, y) && !MON_AT(x, y)
|
||||
&& test_move(u.ux, u.uy, x - u.ux, y - u.uy, TEST_MOVE)) {
|
||||
distance = distu(x, y);
|
||||
if (min_distance < 0 || distance < min_distance
|
||||
|| (distance == min_distance && rn2(2))) {
|
||||
|
||||
Reference in New Issue
Block a user