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

Function set_crosswall

src/display.c:3239–3271  ·  view source on GitHub ↗

Return mode for a crosswall. */

Source from the content-addressed store, hash-verified

3237
3238/* Return mode for a crosswall. */
3239staticfn int
3240set_crosswall(coordxy x, coordxy y)
3241{
3242 coordxy wmode, is_1, is_2, is_3, is_4;
3243
3244 is_1 = check_pos(x - 1, y - 1, 1);
3245 is_2 = check_pos(x + 1, y - 1, 1);
3246 is_3 = check_pos(x + 1, y + 1, 1);
3247 is_4 = check_pos(x - 1, y + 1, 1);
3248
3249 wmode = is_1 + is_2 + is_3 + is_4;
3250 if (wmode > 1) {
3251 if (is_1 && is_3 && (is_2 + is_4 == 0)) {
3252 wmode = WM_X_TLBR;
3253 } else if (is_2 && is_4 && (is_1 + is_3 == 0)) {
3254 wmode = WM_X_BLTR;
3255 } else {
3256#ifdef WA_VERBOSE
3257 error4(x, y, is_1, is_2, is_3, is_4);
3258#endif
3259 wmode = 0;
3260 }
3261 } else if (is_1)
3262 wmode = WM_X_TL;
3263 else if (is_2)
3264 wmode = WM_X_TR;
3265 else if (is_3)
3266 wmode = WM_X_BR;
3267 else if (is_4)
3268 wmode = WM_X_BL;
3269
3270 return wmode;
3271}
3272
3273/* called for every <x,y> by set_wall_state() and for specific <x,y> during
3274 vault wall repair */

Callers 1

xy_set_wall_stateFunction · 0.85

Calls 2

check_posFunction · 0.85
error4Function · 0.85

Tested by

no test coverage detected