address issue #1490 - rolling boulder segfault
Issue reported by BartekCupial: segfault occurred and was tracked to behavior of a rolling boulder trap. Suggested fix was included, but it assumes that the destination spot is valid so is suspect. A comment pointed out that the path is validated when a rolling boulder trap is created so the segfault should be impossible. I didn't find an explanation but am adding a fix based on the one in the issue report. Closes #1490
This commit is contained in:
@@ -1602,6 +1602,7 @@ when starting a new game as a monk, newsym(0,0) was being called (adjabil ->
|
|||||||
postadjabil -> see_monsters when initializing See_invisible as hero
|
postadjabil -> see_monsters when initializing See_invisible as hero
|
||||||
became level 1; seen 'monster' was the hero who hadn't been placed
|
became level 1; seen 'monster' was the hero who hadn't been placed
|
||||||
on the map yet)
|
on the map yet)
|
||||||
|
incorporate a fix to prevent segfault due to rolling boulder trap
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
||||||
|
|||||||
+17
@@ -3375,6 +3375,23 @@ launch_obj(
|
|||||||
while (tmp-- > 0)
|
while (tmp-- > 0)
|
||||||
nh_delay_output();
|
nh_delay_output();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TEMPORARY? github issue #1490 by BartekCupial reports a
|
||||||
|
* segfault when boulder rolls out of bounds. That should be
|
||||||
|
* impossible because trap creation validates the path that
|
||||||
|
* the boulder will traverse.
|
||||||
|
*
|
||||||
|
* The suggested fix increments bhitpos, verifies with isok(),
|
||||||
|
* then undoes the increment if not ok. This is simpler.
|
||||||
|
*/
|
||||||
|
if (!isok(gb.bhitpos.x + dx, gb.bhitpos.y + dy)) {
|
||||||
|
x2 = x, y2 = y; /* use current spot for final boulder placement */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* end TEMPORARY?
|
||||||
|
*/
|
||||||
|
|
||||||
x = (gb.bhitpos.x += dx);
|
x = (gb.bhitpos.x += dx);
|
||||||
y = (gb.bhitpos.y += dy);
|
y = (gb.bhitpos.y += dy);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user