bubble structure contains pointer into static array. Bubble objects

are being flat-dumped into save file and this causes segfault in restore()
whenever data segment layout changes (e.g. global variables added/removed).
bmask should either be stored with the objects.
This commit is contained in:
Alex Kompel
2015-04-26 14:47:38 -07:00
parent 8624709c0d
commit 664b4eb643
2 changed files with 9 additions and 2 deletions

View File

@@ -13,6 +13,8 @@
#define WRITE_SAVE 0x2
#define FREE_SAVE 0x4
#define MAX_BMASK 4
/* operations of the various saveXXXchn & co. routines */
#define perform_bwrite(mode) ((mode) & (COUNT_SAVE|WRITE_SAVE))
#define release_data(mode) ((mode) & FREE_SAVE)
@@ -33,7 +35,7 @@ struct container {
struct bubble {
xchar x, y; /* coordinates of the upper left corner */
schar dx, dy; /* the general direction of the bubble's movement */
uchar *bm; /* pointer to the bubble bit mask */
uchar bm[MAX_BMASK+2]; /* bubble bit mask */
struct bubble *prev, *next; /* need to traverse the list up and down */
struct container *cons;
};