* 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 */
| 134 | * Return value: the direction of the drawbridge, or -1 if not valid |
| 135 | */ |
| 136 | int |
| 137 | is_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 |
no test coverage detected