A crash bug was reported in DaJAngband recently and I've narrowed it down to a certain part of the earthquake function (a part that I added to the function), but I can't figure out why it's making it crash. It's not a nessesary part of the function so I can just comment it out to fix it, but that seems like a cop out and I'd rather find out why it's making it crash and fix it.
any help?
(spacing changed to hopefully make it more readable in the post)
(PS: not sure whether I should post this in the variants section or the development section, but I figured development was for V stuff.)
any help?
Code:
/* Examine the quaked region */
for (dy = -r; dy <= r; dy++)
{
for (dx = -r; dx <= r; dx++)
{
s16b this_o_idx, next_o_idx = 0;
int qbreak;
/* Extract the location */
yy = cy + dy;
xx = cx + dx;
/* Skip unaffected grids */
if (!map[16+yy-cy][16+xx-cx])
{
/* some fragile objects get destroyed even in unaffected grids */
for (this_o_idx = cave_o_idx[yy][xx]; this_o_idx; this_o_idx = next_o_idx)
{
/* get the object */
object_type *o_ptr = &o_list[this_o_idx];
/* Get the next object */
next_o_idx = o_ptr->next_o_idx; /* <<< */
/* this is the line the debugger points to when it crashes */
/* get odds for object to break (TRUE makes things much less likely to break because it's not a destroyed grid) */
qbreak = quake_break(o_ptr, TRUE);
if (artifact_p(o_ptr)) qbreak = 0;
/* roll for destruction */
if (rand_int(100) < qbreak)
{
/* message */
if (player_can_see_bold(yy, xx))
{
char o_name[80];
object_desc(o_name, sizeof(o_name), o_ptr, FALSE, 0);
msg_format("The %s breaks!", o_name);
}
delete_object_idx(this_o_idx);
}
}
(PS: not sure whether I should post this in the variants section or the development section, but I figured development was for V stuff.)
Comment