MCPcopy Create free account
hub / github.com/NetHack/NetHack / is_drawbridge_wall

Function is_drawbridge_wall

src/dbridge.c:136–162  ·  view source on GitHub ↗

* We want to know whether a wall (or a door) is the portcullis (passageway) * of an eventual drawbridge. * * Return value: the direction of the drawbridge, or -1 if not valid */

Source from the content-addressed store, hash-verified

134 * Return value: the direction of the drawbridge, or -1 if not valid
135 */
136int
137is_drawbridge_wall(coordxy x, coordxy y)
138{
139 struct rm *lev;
140
141 if (!isok(x, y))
142 return -1;
143
144 lev = &levl[x][y];
145 if (lev->typ != DOOR && lev->typ != DBWALL)
146 return -1;
147
148 if (isok(x + 1, y) && IS_DRAWBRIDGE(levl[x + 1][y].typ)
149 && (levl[x + 1][y].drawbridgemask & DB_DIR) == DB_WEST)
150 return DB_WEST;
151 if (isok(x - 1, y) && IS_DRAWBRIDGE(levl[x - 1][y].typ)
152 && (levl[x - 1][y].drawbridgemask & DB_DIR) == DB_EAST)
153 return DB_EAST;
154 if (isok(x, y - 1) && IS_DRAWBRIDGE(levl[x][y - 1].typ)
155 && (levl[x][y - 1].drawbridgemask & DB_DIR) == DB_SOUTH)
156 return DB_SOUTH;
157 if (isok(x, y + 1) && IS_DRAWBRIDGE(levl[x][y + 1].typ)
158 && (levl[x][y + 1].drawbridgemask & DB_DIR) == DB_NORTH)
159 return DB_NORTH;
160
161 return -1;
162}
163
164/*
165 * Use is_db_wall where you want to verify that a

Callers 14

furniture_handledFunction · 0.85
digholeFunction · 0.85
pick_lockFunction · 0.85
doopen_indirFunction · 0.85
docloseFunction · 0.85
do_play_instrumentFunction · 0.85
dfeature_atFunction · 0.85
count_feat_lastseentypFunction · 0.85
blow_up_landmineFunction · 0.85
zap_updownFunction · 0.85
kick_ouchFunction · 0.85
use_defensiveFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected