display.h reformatting

A couple of macros with comments in the midst of their expansions got
badly mangled by the automated reformat and one ended up with a line
that was over 150 characters wide.
This commit is contained in:
PatR
2015-11-16 18:57:11 -08:00
parent fa8ac8a2ce
commit 1f3253541a
+37 -36
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 display.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */ /* NetHack 3.6 display.h $NHDT-Date: 1447729027 2015/11/17 02:57:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */ /* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -29,11 +29,13 @@
*/ */
#define tp_sensemon(mon) \ #define tp_sensemon(mon) \
(/* The hero can always sense a monster IF: */ \ (/* The hero can always sense a monster IF: */ \
(!mindless(mon->data)) && /* 1. the monster has a brain to sense AND */ \ /* 1. the monster has a brain to sense */ \
((Blind && Blind_telepat) \ (!mindless(mon->data)) \
|| /* 2a. hero is blind and telepathic OR */ /* 2b. hero is using a \ /* AND 2a. hero is blind and telepathic */ \
telepathy inducing */ /* object and in range */ \ && ((Blind && Blind_telepat) \
(Unblind_telepat \ /* OR 2b. hero is using a telepathy inducing */ \
/* object and in range */ \
|| (Unblind_telepat \
&& (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM))))) && (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))))
#define sensemon(mon) \ #define sensemon(mon) \
@@ -57,11 +59,10 @@
* Infravision is not taken into account. * Infravision is not taken into account.
*/ */
#define mon_visible(mon) \ #define mon_visible(mon) \
(/* The hero can see the monster */ /* IF the monster */ \ (/* The hero can see the monster IF the monster */ \
(!mon->minvis || See_invisible) && /* 1. is not invisible AND */ \ (!mon->minvis || See_invisible) /* 1. is not invisible */ \
(!mon->mundetected) && /* 2. not an undetected hider */ \ && !mon->mundetected /* AND 2. not an undetected hider */ \
(!(mon->mburied || u.uburied)) /* 3. neither you or it is buried */ \ && !(mon->mburied || u.uburied)) /* AND 3. neither you nor it is buried */
)
/* /*
* see_with_infrared() * see_with_infrared()
@@ -179,8 +180,7 @@
#define DISP_BEAM (-1) /* Keep all glyphs showing & clean up at end. */ #define DISP_BEAM (-1) /* Keep all glyphs showing & clean up at end. */
#define DISP_ALL (-2) /* Like beam, but still displayed if not visible. */ #define DISP_ALL (-2) /* Like beam, but still displayed if not visible. */
#define DISP_FLASH (-3) /* Clean up each glyph before displaying new one. */ #define DISP_FLASH (-3) /* Clean up each glyph before displaying new one. */
#define DISP_ALWAYS (-4) /* Like flash, but still displayed if not visible. \ #define DISP_ALWAYS (-4) /* Like flash, but still displayed if not visible. */
*/
#define DISP_CHANGE (-5) /* Change glyph. */ #define DISP_CHANGE (-5) /* Change glyph. */
#define DISP_END (-6) /* Clean up. */ #define DISP_END (-6) /* Clean up. */
#define DISP_FREEMEM (-7) /* Free all memory during exit only. */ #define DISP_FREEMEM (-7) /* Free all memory during exit only. */
@@ -200,15 +200,14 @@
#define display_self() \ #define display_self() \
show_glyph(u.ux, u.uy, \ show_glyph(u.ux, u.uy, \
maybe_display_usteed( \ maybe_display_usteed((youmonst.m_ap_type == M_AP_NOTHING) \
youmonst.m_ap_type == M_AP_NOTHING \
? hero_glyph \ ? hero_glyph \
: youmonst.m_ap_type == M_AP_FURNITURE \ : (youmonst.m_ap_type == M_AP_FURNITURE) \
? cmap_to_glyph(youmonst.mappearance) \ ? cmap_to_glyph(youmonst.mappearance) \
: youmonst.m_ap_type == M_AP_OBJECT \ : (youmonst.m_ap_type == M_AP_OBJECT) \
? objnum_to_glyph(youmonst.mappearance) \ ? objnum_to_glyph(youmonst.mappearance) \
: /* else M_AP_MONSTER */ \ /* else M_AP_MONSTER */ \
monnum_to_glyph(youmonst.mappearance))) : monnum_to_glyph(youmonst.mappearance)))
/* /*
* A glyph is an abstraction that represents a _unique_ monster, object, * A glyph is an abstraction that represents a _unique_ monster, object,
@@ -276,7 +275,6 @@
#define MAX_GLYPH (NUMMONS + GLYPH_STATUE_OFF) #define MAX_GLYPH (NUMMONS + GLYPH_STATUE_OFF)
#define NO_GLYPH MAX_GLYPH #define NO_GLYPH MAX_GLYPH
#define GLYPH_INVISIBLE GLYPH_INVIS_OFF #define GLYPH_INVISIBLE GLYPH_INVIS_OFF
#define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF) #define warning_to_glyph(mwarnlev) ((mwarnlev) + GLYPH_WARNING_OFF)
@@ -297,15 +295,16 @@
: otg_temp + GLYPH_OBJ_OFF) : otg_temp + GLYPH_OBJ_OFF)
#define obj_to_glyph(obj) \ #define obj_to_glyph(obj) \
((obj)->otyp == STATUE \ (((obj)->otyp == STATUE) \
? statue_to_glyph(obj) \ ? statue_to_glyph(obj) \
: Hallucination ? random_obj_to_glyph() \ : Hallucination \
: (obj)->otyp == CORPSE \ ? random_obj_to_glyph() \
: ((obj)->otyp == CORPSE) \
? (int) (obj)->corpsenm + GLYPH_BODY_OFF \ ? (int) (obj)->corpsenm + GLYPH_BODY_OFF \
: (int) (obj)->otyp + GLYPH_OBJ_OFF) : (int) (obj)->otyp + GLYPH_OBJ_OFF)
/* MRKR: Statues now have glyphs corresponding to the monster they */ /* MRKR: Statues now have glyphs corresponding to the monster they */
/* brepresent and look like monsters when you are hallucinating. */ /* represent and look like monsters when you are hallucinating. */
#define statue_to_glyph(obj) \ #define statue_to_glyph(obj) \
(Hallucination ? random_monster() + GLYPH_MON_OFF \ (Hallucination ? random_monster() + GLYPH_MON_OFF \
@@ -313,7 +312,7 @@
#define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF) #define cmap_to_glyph(cmap_idx) ((int) (cmap_idx) + GLYPH_CMAP_OFF)
#define explosion_to_glyph(expltype, idx) \ #define explosion_to_glyph(expltype, idx) \
((((expltype) *MAXEXPCHARS) + ((idx) -S_explode1)) + GLYPH_EXPLODE_OFF) ((((expltype) * MAXEXPCHARS) + ((idx) - S_explode1)) + GLYPH_EXPLODE_OFF)
#define trap_to_glyph(trap) \ #define trap_to_glyph(trap) \
cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp))) cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp)))
@@ -349,31 +348,33 @@
*/ */
#define glyph_to_mon(glyph) \ #define glyph_to_mon(glyph) \
(glyph_is_normal_monster(glyph) \ (glyph_is_normal_monster(glyph) \
? ((glyph) -GLYPH_MON_OFF) \ ? ((glyph) - GLYPH_MON_OFF) \
: glyph_is_pet(glyph) \ : glyph_is_pet(glyph) \
? ((glyph) -GLYPH_PET_OFF) \ ? ((glyph) - GLYPH_PET_OFF) \
: glyph_is_detected_monster(glyph) \ : glyph_is_detected_monster(glyph) \
? ((glyph) -GLYPH_DETECT_OFF) \ ? ((glyph) - GLYPH_DETECT_OFF) \
: glyph_is_ridden_monster(glyph) \ : glyph_is_ridden_monster(glyph) \
? ((glyph) -GLYPH_RIDDEN_OFF) \ ? ((glyph) - GLYPH_RIDDEN_OFF) \
: glyph_is_statue(glyph) \ : glyph_is_statue(glyph) \
? ((glyph) -GLYPH_STATUE_OFF) \ ? ((glyph) - GLYPH_STATUE_OFF) \
: NO_GLYPH) : NO_GLYPH)
#define glyph_to_obj(glyph) \ #define glyph_to_obj(glyph) \
(glyph_is_body(glyph) ? CORPSE : glyph_is_statue(glyph) \ (glyph_is_body(glyph) \
? CORPSE \
: glyph_is_statue(glyph) \
? STATUE \ ? STATUE \
: glyph_is_normal_object(glyph) \ : glyph_is_normal_object(glyph) \
? ((glyph) -GLYPH_OBJ_OFF) \ ? ((glyph) - GLYPH_OBJ_OFF) \
: NO_GLYPH) : NO_GLYPH)
#define glyph_to_trap(glyph) \ #define glyph_to_trap(glyph) \
(glyph_is_trap(glyph) ? ((int) defsym_to_trap((glyph) -GLYPH_CMAP_OFF)) \ (glyph_is_trap(glyph) ? ((int) defsym_to_trap((glyph) - GLYPH_CMAP_OFF)) \
: NO_GLYPH) : NO_GLYPH)
#define glyph_to_cmap(glyph) \ #define glyph_to_cmap(glyph) \
(glyph_is_cmap(glyph) ? ((glyph) -GLYPH_CMAP_OFF) : NO_GLYPH) (glyph_is_cmap(glyph) ? ((glyph) - GLYPH_CMAP_OFF) : NO_GLYPH)
#define glyph_to_swallow(glyph) \ #define glyph_to_swallow(glyph) \
(glyph_is_swallow(glyph) ? (((glyph) -GLYPH_SWALLOW_OFF) & 0x7) : 0) (glyph_is_swallow(glyph) ? (((glyph) - GLYPH_SWALLOW_OFF) & 0x7) : 0)
#define glyph_to_warning(glyph) \ #define glyph_to_warning(glyph) \
(glyph_is_warning(glyph) ? ((glyph) -GLYPH_WARNING_OFF) : NO_GLYPH); (glyph_is_warning(glyph) ? ((glyph) - GLYPH_WARNING_OFF) : NO_GLYPH);
/* /*
* Return true if the given glyph is what we want. Note that bodies are * Return true if the given glyph is what we want. Note that bodies are