From: nethack.allison Date: Sun, 2 Jan 2005 13:04:56 +0000 (+0000) Subject: region player_flags follow-up correction [trunk only] X-Git-Tag: MOVE2GIT~1374 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10e8c11c0acdc891fc370aea42cd5a5ba310d322;p=nethack region player_flags follow-up correction [trunk only] --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 2f96a793a..a2753c441 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -136,4 +136,4 @@ move all flags that are system or port specific from flag struct to sysflags all fields in flags struct are unconditionally present monst cham field now a short and uses mons[] index rearrange some monster ordering to follow rule #2 listed at top of monst.c - +change region player_flags to more appropriate unsigned int instead of boolean diff --git a/include/patchlevel.h b/include/patchlevel.h index 4a83ec18e..1d0ab35e3 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -13,7 +13,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 17 +#define EDITLEVEL 18 #define COPYRIGHT_BANNER_A \ "NetHack, Copyright 1985-2004" diff --git a/include/region.h b/include/region.h index 247817625..4f182e2cb 100644 --- a/include/region.h +++ b/include/region.h @@ -21,6 +21,14 @@ typedef boolean FDECL((*callback_proc), (genericptr_t, genericptr_t)); #define set_heros_fault(r) ((r)->player_flags &= ~REG_NOT_HEROS) #define clear_heros_fault(r) ((r)->player_flags |= REG_NOT_HEROS) +/* + * Note: if you change the size/type of any of the fields below, + * or add any/remove any fields, you must update the + * bwrite() calls in save_regions(), and the + * mread() calls in rest_regions() in src/region.c + * to reflect the changes. + */ + typedef struct { NhRect bounding_box; /* Bounding box of the region */ NhRect *rects; /* Rectangles composing the region */ diff --git a/src/region.c b/src/region.c index 02c37adee..636b1e59b 100644 --- a/src/region.c +++ b/src/region.c @@ -646,7 +646,7 @@ int mode; bwrite(fd, (genericptr_t) ®ions[i]->can_leave_f, sizeof (short)); bwrite(fd, (genericptr_t) ®ions[i]->leave_f, sizeof (short)); bwrite(fd, (genericptr_t) ®ions[i]->inside_f, sizeof (short)); - bwrite(fd, (genericptr_t) ®ions[i]->player_flags, sizeof (boolean)); + bwrite(fd, (genericptr_t) ®ions[i]->player_flags, sizeof (unsigned int)); bwrite(fd, (genericptr_t) ®ions[i]->n_monst, sizeof (short)); for (j = 0; j < regions[i]->n_monst; j++) bwrite(fd, (genericptr_t) ®ions[i]->monsters[j], @@ -721,7 +721,7 @@ boolean ghostly; /* If a bones file restore */ mread(fd, (genericptr_t) ®ions[i]->can_leave_f, sizeof (short)); mread(fd, (genericptr_t) ®ions[i]->leave_f, sizeof (short)); mread(fd, (genericptr_t) ®ions[i]->inside_f, sizeof (short)); - mread(fd, (genericptr_t) ®ions[i]->player_flags, sizeof (boolean)); + mread(fd, (genericptr_t) ®ions[i]->player_flags, sizeof (unsigned int)); if (ghostly) { /* settings pertained to old player */ clear_hero_inside(regions[i]); clear_heros_fault(regions[i]);