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

Function set_corn

src/display.c:3207–3236  ·  view source on GitHub ↗

Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */

Source from the content-addressed store, hash-verified

3205
3206/* Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */
3207staticfn int
3208set_corn(
3209 coordxy x1, coordxy y1,
3210 coordxy x2, coordxy y2,
3211 coordxy x3, coordxy y3,
3212 coordxy x4, coordxy y4)
3213{
3214 coordxy wmode, is_1, is_2, is_3, is_4;
3215
3216 is_1 = check_pos(x1, y1, 1);
3217 is_2 = check_pos(x2, y2, 1);
3218 is_3 = check_pos(x3, y3, 1);
3219 is_4 = check_pos(x4, y4, 1); /* inner location */
3220
3221 /*
3222 * All 4 should not be true. So if the inner location is rock,
3223 * use it. If all of the outer 3 are true, use outer. We currently
3224 * can't cover the case where only part of the outer is rock, so
3225 * we just say that all the walls are finished (if not overridden
3226 * by the inner section).
3227 */
3228 if (is_4) {
3229 wmode = WM_C_INNER;
3230 } else if (is_1 && is_2 && is_3)
3231 wmode = WM_C_OUTER;
3232 else
3233 wmode = 0; /* finished walls on all sides */
3234
3235 return wmode;
3236}
3237
3238/* Return mode for a crosswall. */
3239staticfn int

Callers 1

xy_set_wall_stateFunction · 0.85

Calls 1

check_posFunction · 0.85

Tested by

no test coverage detected