| 2460 | } |
| 2461 | |
| 2462 | staticfn boolean |
| 2463 | avoid_moving_on_liquid( |
| 2464 | coordxy x, coordxy y, |
| 2465 | boolean msg) |
| 2466 | { |
| 2467 | boolean in_air = (Levitation || Flying); |
| 2468 | |
| 2469 | /* don't stop if you're not on a transition between terrain types... */ |
| 2470 | if ((levl[x][y].typ == levl[u.ux][u.uy].typ |
| 2471 | /* or you are using shift-dir running and the transition isn't |
| 2472 | dangerous... */ |
| 2473 | || (svc.context.run < 2 && (!is_lava(x, y) || in_air)) |
| 2474 | || svc.context.travel) |
| 2475 | /* and you know you won't fall in */ |
| 2476 | && (in_air || Known_lwalking || (is_pool(x, y) && Known_wwalking)) |
| 2477 | && !(IS_WATERWALL(levl[x][y].typ) || levl[x][y].typ == LAVAWALL)) { |
| 2478 | /* XXX: should send 'is_clinger(gy.youmonst.data)' here once clinging |
| 2479 | polyforms are allowed to move over water */ |
| 2480 | return FALSE; /* liquid is safe to traverse */ |
| 2481 | } else if (is_pool_or_lava(x, y) && levl[x][y].seenv) { |
| 2482 | if (msg && flags.mention_walls) { |
| 2483 | set_msg_xy(x, y); |
| 2484 | You("stop at the edge of the %s.", |
| 2485 | hliquid(is_pool(x,y) ? "water" : "lava")); |
| 2486 | } |
| 2487 | return TRUE; |
| 2488 | } |
| 2489 | return FALSE; |
| 2490 | } |
| 2491 | |
| 2492 | /* when running/rushing, avoid stepping on a known trap or pool of liquid. |
| 2493 | returns TRUE if avoided. */ |
no test coverage detected