MCPcopy Create free account
hub / github.com/davemoore22/sorcery / _turn_right

Method _turn_right

src/engine/engine.cpp:767–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765
766 const auto at{_ctx.game->state->get_player_pos()};
767 if (_ctx.game->state->level->at(at).has_spinner()) {
768
769 auto new_facing{static_cast<Enums::Map::Direction>(
770 _ctx.get_random(Enums::System::Random::ZERO_TO_3))};
771 _ctx.game->state->set_player_facing(new_facing);
772
773 DEBUG_LOG("Player triggered spinner");
774 }
775}
776
777auto Sorcery::Engine::_turn_right() -> void {
778
779 switch (_ctx.game->state->get_player_facing()) {
780 using enum Enums::Map::Direction;
781 case NORTH:
782 _ctx.game->state->set_player_facing(EAST);
783 break;
784 case SOUTH:
785 _ctx.game->state->set_player_facing(WEST);
786 break;
787 case EAST:
788 _ctx.game->state->set_player_facing(SOUTH);
789 break;
790 case WEST:
791 _ctx.game->state->set_player_facing(NORTH);
792 break;
793 default:
794 break;
795 }
796
797 _ctx.controller->set_last_dir(Enums::Map::Direction::EAST);
798 _ctx.controller->set_can_undo(false);
799
800 const auto at{_ctx.game->state->get_player_pos()};
801 if (_ctx.game->state->level->at(at).has_spinner()) {
802

Callers

nothing calls this directly

Calls 8

get_player_facingMethod · 0.80
set_player_facingMethod · 0.80
set_last_dirMethod · 0.80
set_can_undoMethod · 0.80
get_player_posMethod · 0.80
has_spinnerMethod · 0.80
get_randomMethod · 0.80
atMethod · 0.45

Tested by

no test coverage detected