| 607 | _ctx.game->state->set_player_prev_depth( |
| 608 | _ctx.game->state->get_depth()); |
| 609 | _ctx.game->state->set_depth(to_level); |
| 610 | _set_tile_explored(_ctx.game->state->get_player_pos()); |
| 611 | |
| 612 | _ctx.controller->unset_flag("want_take_stairs_down"); |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | _ctx.controller->unset_flag("want_take_stairs_up"); |
| 617 | } |
| 618 | |
| 619 | auto Sorcery::Engine::_move_backward() -> bool { |
| 620 | |
| 621 | // Work out our new position |
| 622 | auto at_loc{_ctx.game->state->get_player_pos()}; |
| 623 | auto x_d{at_loc.x}; |
| 624 | auto y_d{at_loc.y}; |
| 625 | |
| 626 | switch (_ctx.game->state->get_player_facing()) { |
| 627 | using enum Enums::Map::Direction; |
| 628 | case NORTH: |
| 629 | --y_d; |
| 630 | break; |
| 631 | case SOUTH: |
| 632 | ++y_d; |
| 633 | break; |
| 634 | case EAST: |
| 635 | --x_d; |
| 636 | break; |
| 637 | case WEST: |
| 638 | ++x_d; |
| 639 | break; |
| 640 | default: |
| 641 | break; |
| 642 | } |
| 643 | |
| 644 | if (x_d < 0) |
| 645 | x_d = MAP_SIZE - 1; |
| 646 | else if (x_d > MAP_SIZE - 1) |
| 647 | x_d = 0; |
| 648 | if (y_d < 0) |
| 649 | y_d = MAP_SIZE - 1; |
| 650 | else if (y_d > MAP_SIZE - 1) |
| 651 | y_d = 0; |
| 652 | |
| 653 | const auto next_loc{Coordinate{x_d, y_d}}; |
| 654 | |
| 655 | // Check for walls etc between current square and new square |
| 656 | auto this_tile{_ctx.game->state->level->at(at_loc)}; |
| 657 | const auto &next_tile{_ctx.game->state->level->at(next_loc)}; |
| 658 | |
| 659 | auto this_wall_to_check{Enums::Map::Direction::NO_DIRECTION}; |
| 660 | switch (_ctx.game->state->get_player_facing()) { |
| 661 | using enum Enums::Map::Direction; |
| 662 | case NORTH: |
| 663 | this_wall_to_check = SOUTH; |
| 664 | break; |
| 665 | case SOUTH: |
| 666 | this_wall_to_check = NORTH; |
nothing calls this directly
no test coverage detected