Mercurial > hg > early-roguelike
diff urogue/state.c @ 262:c7c6c5a7d840
UltraRogue: fix a segfault related to restoring monsters.
The functions for restoring saved games failed to properly correct the
t_chasee pointer of monsters chasing the player. Such monsters would
attempt to chase NULL instead, with predictable results.
author | John "Elwin" Edwards |
---|---|
date | Tue, 14 Feb 2017 20:42:33 -0500 |
parents | b80e1bf4eaec |
children | 08057be02f47 |
line wrap: on
line diff
--- a/urogue/state.c Sun Feb 12 20:16:57 2017 -0500 +++ b/urogue/state.c Tue Feb 14 20:42:33 2017 -0500 @@ -678,7 +678,7 @@ { while(l != NULL) { - if (l->data.th->t_chasee == (void *) -1L) + if (l->data.th->chasee_index == -1L) l->data.th->t_chasee = &player; else l->data.th->t_chasee = find_thing(mlist, l->data.th->chasee_index); @@ -1340,7 +1340,7 @@ beast = find_thing(mlist, i); ur_fixup_monsters(fam_ptr); - ur_fixup_monsters(fam_ptr); + ur_fixup_monsters(mlist); DUMPSTRING i = ur_read_int(savef);