1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-07-26 23:32:25 +01:00

Merge pull request #1177 from gebulmer/fix/direction-selection

Prevent overflow in setting directions at start
This commit is contained in:
Chris-plus-alphanumericgibberish 2020-09-12 14:15:55 -04:00 committed by GitHub
commit a20c705af2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6353,7 +6353,8 @@ char sym;
if(iflags.num_pad) sdp = ndir; else sdp = sdir; /* DICE workaround */
u.dz = 0;
if(!(dp = index(sdp, sym))) return 0;
/* sym defaults to null at game start, causing dp - sdp to be 10, overflowing */
if(!sym || !(dp = index(sdp, sym))) return 0;
u.dx = xdir[dp-sdp];
u.dy = ydir[dp-sdp];
u.dz = zdir[dp-sdp];