bridgefall: Fix harmless coordinate normalization bug
bridgefall() wants to do this: for all possible pairs of directions (i, j) if i and j cancel out continue do stuff It does it by adding direction offsets to start coordinates, and comparing the resulting coordinates to the start coordinates. Fine, except it neglects to normalize the resulting coordinates. Harmless in practice, because you can get an incorrect result only when the path goes around the world, which it can do only in a 4x2 world. Fix it anyway, by testing "directions cancel out" directly. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
296f3272e2
commit
f5244d4702
1 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Steve McClure, 1998
|
* Steve McClure, 1998
|
||||||
* Markus Armbruster, 2004-2010
|
* Markus Armbruster, 2004-2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -92,10 +92,10 @@ bridgefall(struct sctstr *sp)
|
||||||
if (sect.sct_type != SCT_BSPAN)
|
if (sect.sct_type != SCT_BSPAN)
|
||||||
continue;
|
continue;
|
||||||
for (j = 1; j <= 6; j++) {
|
for (j = 1; j <= 6; j++) {
|
||||||
|
if (j == DIR_BACK(i))
|
||||||
|
continue;
|
||||||
nnx = nx + diroff[j][0];
|
nnx = nx + diroff[j][0];
|
||||||
nny = ny + diroff[j][1];
|
nny = ny + diroff[j][1];
|
||||||
if (nnx == sp->sct_x && nny == sp->sct_y)
|
|
||||||
continue;
|
|
||||||
getsect(nnx, nny, &bh_sect);
|
getsect(nnx, nny, &bh_sect);
|
||||||
if (bh_sect.sct_type == SCT_BHEAD &&
|
if (bh_sect.sct_type == SCT_BHEAD &&
|
||||||
bh_sect.sct_newtype == SCT_BHEAD)
|
bh_sect.sct_newtype == SCT_BHEAD)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue