viz_array[][] type

viz_array[][] is indexed by coordinates but the data it contains has
nothing to do with them so it shouldn't have been changed to coordxy.
'char' was sufficient; 'uchar' would have been better; this invents
'seenV' instead.  This led to a cascade of required changes.  The
result is warning free and seems to be working but my fingers are
crosssed....
This commit is contained in:
PatR
2022-07-15 13:48:29 -07:00
parent 5aca2fc590
commit b37f922cf7
7 changed files with 92 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 decl.h $NHDT-Date: 1655161560 2022/06/13 23:06:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.298 $ */
/* NetHack 3.7 decl.h $NHDT-Date: 1657918080 2022/07/15 20:48:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.303 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1247,10 +1247,10 @@ struct instance_globals {
short nocreate4;
/* uhitm.c */
boolean override_confirmation; /* Used to flag attacks caused by
Stormbringer's maliciousness. */
* Stormbringer's maliciousness. */
/* vision.c */
coordxy **viz_array; /* used in cansee() and couldsee() macros */
seenV **viz_array; /* used in cansee() and couldsee() macros */
coordxy *viz_rmin; /* min could see indices */
coordxy *viz_rmax; /* max could see indices */
boolean vision_full_recalc;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1655065134 2022/06/12 20:18:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1121 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1657918089 2022/07/15 20:48:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1132 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1193,7 +1193,7 @@ extern int dosuspend(void);
extern void new_light_source(coordxy, coordxy, int, int, union any *);
extern void del_light_source(int, union any *);
extern void do_light_sources(coordxy **);
extern void do_light_sources(seenV **);
extern void show_transient_light(struct obj *, coordxy, coordxy);
extern void transient_light_cleanup(void);
extern struct monst *find_mid(unsigned, unsigned);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 global.h $NHDT-Date: 1646322467 2022/03/03 15:47:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */
/* NetHack 3.7 global.h $NHDT-Date: 1657918090 2022/07/15 20:48:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.144 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -85,6 +85,11 @@ typedef schar boolean; /* 0 or 1 */
#endif
#endif
/* vision seen vectors: viz_array[][] and levl[][].seenv, which use different
values from each other but are close enough in size to share a type;
viz_array contains 8-bit bitmasks, lev->seenv is a 5-bit bitfield */
typedef unsigned char seenV; /* no need for uint8_t */
/* Type for third parameter of read(2) */
#if defined(BSD) || defined(ULTRIX)
typedef int readLenType;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 rm.h $NHDT-Date: 1651099392 2022/04/27 22:43:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.94 $ */
/* NetHack 3.7 rm.h $NHDT-Date: 1657918091 2022/07/15 20:48:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.96 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2017. */
/* NetHack may be freely redistributed. See license for details. */
@@ -309,15 +309,15 @@ struct rm {
* directions. If we know the type of wall and the directions from which
* it has been seen, then we can determine what it looks like to the hero.
*/
#define SV0 0x01
#define SV1 0x02
#define SV2 0x04
#define SV3 0x08
#define SV4 0x10
#define SV5 0x20
#define SV6 0x40
#define SV7 0x80
#define SVALL 0xFF
#define SV0 ((seenV) 0x01)
#define SV1 ((seenV) 0x02)
#define SV2 ((seenV) 0x04)
#define SV3 ((seenV) 0x08)
#define SV4 ((seenV) 0x10)
#define SV5 ((seenV) 0x20)
#define SV6 ((seenV) 0x40)
#define SV7 ((seenV) 0x80)
#define SVALL ((seenV) 0xFF)
/* if these get changed or expanded, make sure wizard-mode wishing becomes
aware of the new usage */