cansee() and couldsee()
cansee(), couldsee(), and templit() are macros which are described as boolean and used as if boolean, but they've been using bit masking to return integer values greater than 1. That works since C treats any non-zero as True but doesn't match boolean intent.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 vision.h $NHDT-Date: 1596498568 2020/08/03 23:49:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.13 $ */
|
||||
/* NetHack 3.7 vision.h $NHDT-Date: 1666478832 2022/10/22 22:47:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
|
||||
/* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
* couldsee() - Returns true if the hero has a clear line of sight to
|
||||
* the location.
|
||||
*/
|
||||
#define cansee(x, y) (g.viz_array[y][x] & IN_SIGHT)
|
||||
#define couldsee(x, y) (g.viz_array[y][x] & COULD_SEE)
|
||||
#define templit(x, y) (g.viz_array[y][x] & TEMP_LIT)
|
||||
#define cansee(x, y) ((g.viz_array[y][x] & IN_SIGHT) != 0)
|
||||
#define couldsee(x, y) ((g.viz_array[y][x] & COULD_SEE) != 0)
|
||||
#define templit(x, y) ((g.viz_array[y][x] & TEMP_LIT) != 0)
|
||||
|
||||
/*
|
||||
* The following assume the monster is not blind.
|
||||
|
||||
Reference in New Issue
Block a user