From e2d5013e01bb0543f311bb7a6864936d511f12fc Mon Sep 17 00:00:00 2001 From: nhkeni Date: Thu, 17 Mar 2022 17:17:13 -0400 Subject: [PATCH] Typedef getloc_flags_t for struct unpacked_coord.getloc_flags and related. --- include/sp_lev.h | 3 ++- src/sp_lev.c | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/sp_lev.h b/include/sp_lev.h index bb0de837e..a55f3bdb0 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -97,9 +97,10 @@ struct sp_coder { */ #define packed_coord long +typedef uint32_t getloc_flags_t; typedef struct { xchar is_random; - long getloc_flags; + getloc_flags_t getloc_flags; int x, y; } unpacked_coord; diff --git a/src/sp_lev.c b/src/sp_lev.c index a7e5ed483..2c2641a0b 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -37,8 +37,8 @@ static void maybe_add_door(int, int, struct mkroom *); static void link_doors_rooms(void); static int rnddoor(void); static int rndtrap(void); -static void get_location(xchar *, xchar *, int, struct mkroom *); -static boolean is_ok_location(xchar, xchar, int); +static void get_location(xchar *, xchar *, getloc_flags_t, struct mkroom *); +static boolean is_ok_location(xchar, xchar, getloc_flags_t); static unpacked_coord get_unpacked_coord(long, int); static void get_room_loc(xchar *, xchar *, struct mkroom *); static void get_free_room_loc(xchar *, xchar *, struct mkroom *, @@ -1081,11 +1081,11 @@ rndtrap(void) * Coordinates in special level files are handled specially: * * if x or y is < 0, we generate a random coordinate. - * The "humidity" flag is used to insure that engravings aren't + * The "humidity" flag is used to ensure that engravings aren't * created underwater, or eels on dry land. */ static void -get_location(xchar *x, xchar *y, int humidity, struct mkroom* croom) +get_location(xchar *x, xchar *y, getloc_flags_t humidity, struct mkroom* croom) { int cpt = 0; int mx, my, sx, sy; @@ -1152,7 +1152,7 @@ get_location(xchar *x, xchar *y, int humidity, struct mkroom* croom) } static boolean -is_ok_location(xchar x, xchar y, int humidity) +is_ok_location(xchar x, xchar y, getloc_flags_t humidity) { register int typ = levl[x][y].typ; @@ -1193,7 +1193,7 @@ get_unpacked_coord(long loc, int defhumidity) if (loc & SP_COORD_IS_RANDOM) { c.x = c.y = -1; c.is_random = 1; - c.getloc_flags = (loc & ~SP_COORD_IS_RANDOM); + c.getloc_flags = (getloc_flags_t)(loc & ~SP_COORD_IS_RANDOM); if (!c.getloc_flags) c.getloc_flags = defhumidity; } else { -- 2.50.1