region save/restore
When shortening/splitting wide lines I noticed that the save and restore code for regions had a bunch of those and they could be shortened by using an intermediate variable. Easier to read too. Also, change several 'unsigned int' to just 'unsigned' as is used in most of the rest of the code. At one point I omitted a (genericptr_t) cast (which should no longer be necessary...) and discovered that bwrite() wasn't declaring the input buffer it never modifies as 'const'.
This commit is contained in:
@@ -2299,12 +2299,12 @@ extern void closelog(NHFILE *);
|
||||
/* ### sfstruct.c ### */
|
||||
|
||||
#ifndef TRACEBUFFERING
|
||||
extern void newread(NHFILE *, int, int, genericptr_t, unsigned int);
|
||||
extern void newread(NHFILE *, int, int, genericptr_t, unsigned);
|
||||
extern void bufon(int);
|
||||
extern void bufoff(int);
|
||||
extern void bflush(int);
|
||||
extern void bwrite(int, genericptr_t, unsigned int);
|
||||
extern void mread(int, genericptr_t, unsigned int);
|
||||
extern void bwrite(int, const genericptr_t, unsigned);
|
||||
extern void mread(int, genericptr_t, unsigned);
|
||||
extern void minit(void);
|
||||
extern void bclose(int);
|
||||
#else
|
||||
@@ -2319,11 +2319,11 @@ extern void bclose(int);
|
||||
extern void Bufon(int, const char *, int);
|
||||
extern void Bufoff(int, const char *, int);
|
||||
extern void Bflush(int, const char *, int);
|
||||
extern void Bwrite(int, genericptr_t, unsigned int, const char *, int);
|
||||
extern void Bread(int, genericptr_t, unsigned int, const char *, int);
|
||||
extern void Bwrite(int, const genericptr_t, unsigned, const char *, int);
|
||||
extern void Bread(int, genericptr_t, unsigned, const char *, int);
|
||||
extern void Binit(const char *, int);
|
||||
extern void Bclose(int, const char *, int);
|
||||
extern void Mread(int, genericptr_t, unsigned int, const char *, int);
|
||||
extern void Mread(int, genericptr_t, unsigned, const char *, int);
|
||||
extern void Minit(const char *, int);
|
||||
#if defined(ZEROCOMP)
|
||||
extern void zerocomp_bclose(int);
|
||||
|
||||
@@ -30,37 +30,36 @@ typedef boolean (*callback_proc)(genericptr_t, genericptr_t);
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
NhRect bounding_box; /* Bounding box of the region */
|
||||
NhRect *rects; /* Rectangles composing the region */
|
||||
short nrects; /* Number of rectangles */
|
||||
boolean attach_2_u; /* Region attached to player ? */
|
||||
unsigned int attach_2_m; /* Region attached to monster ? */
|
||||
NhRect bounding_box; /* Bounding box of the region */
|
||||
NhRect *rects; /* Rectangles composing the region */
|
||||
short nrects; /* Number of rectangles */
|
||||
boolean attach_2_u; /* Region attached to player ? */
|
||||
unsigned attach_2_m; /* Region attached to monster ? */
|
||||
/*struct obj *attach_2_o;*/ /* Region attached to object ? UNUSED YET */
|
||||
const char *enter_msg; /* Message when entering */
|
||||
const char *leave_msg; /* Message when leaving */
|
||||
long ttl; /* Time to live. -1 is forever */
|
||||
short expire_f; /* Function to call when region's ttl expire */
|
||||
short can_enter_f; /* Function to call to check whether the player
|
||||
can, or can not, enter the region */
|
||||
short enter_f; /* Function to call when the player enters*/
|
||||
short can_leave_f; /* Function to call to check whether the player
|
||||
can, or can not, leave the region */
|
||||
short leave_f; /* Function to call when the player leaves */
|
||||
short inside_f; /* Function to call every turn if player's
|
||||
inside */
|
||||
unsigned int player_flags; /* (see above) */
|
||||
unsigned int *monsters; /* Monsters currently inside this region */
|
||||
short n_monst; /* Number of monsters inside this region */
|
||||
short max_monst; /* Maximum number of monsters that can be
|
||||
listed without having to grow the array */
|
||||
const char *enter_msg; /* Message when entering */
|
||||
const char *leave_msg; /* Message when leaving */
|
||||
long ttl; /* Time to live. -1 is forever */
|
||||
short expire_f; /* Function to call when region's ttl expire */
|
||||
short can_enter_f; /* Function to call to check whether the player
|
||||
* can, or can not, enter the region */
|
||||
short enter_f; /* Function to call when the player enters*/
|
||||
short can_leave_f; /* Function to call to check whether the player
|
||||
* can, or can not, leave the region */
|
||||
short leave_f; /* Function to call when the player leaves */
|
||||
short inside_f; /* Function to call every turn if player's inside */
|
||||
unsigned player_flags; /* (see above) */
|
||||
unsigned *monsters; /* Monsters currently inside this region */
|
||||
short n_monst; /* Number of monsters inside this region */
|
||||
short max_monst; /* Maximum number of monsters that can be
|
||||
* listed without having to grow the array */
|
||||
#define MONST_INC 5
|
||||
|
||||
/* Should probably do the same thing about objects */
|
||||
|
||||
boolean visible; /* Is the region visible ? */
|
||||
int glyph; /* Which glyph to use if visible */
|
||||
anything arg; /* Optional user argument (Ex: strength of
|
||||
force field, damage of a fire zone, ...*/
|
||||
boolean visible; /* Is the region visible ? */
|
||||
int glyph; /* Which glyph to use if visible */
|
||||
anything arg; /* Optional user argument (Ex: strength of
|
||||
* force field, damage of a fire zone, ...*/
|
||||
} NhRegion;
|
||||
|
||||
#endif /* REGION_H */
|
||||
|
||||
Reference in New Issue
Block a user