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

Method _turn_around

src/engine/engine.cpp:801–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799 _ctx.controller->set_last_dir(Enums::Map::Direction::EAST);
800 _ctx.controller->set_can_undo(false);
801
802 const auto at{_ctx.game->state->get_player_pos()};
803 if (_ctx.game->state->level->at(at).has_spinner()) {
804
805 auto new_facing{static_cast<Enums::Map::Direction>(
806 _ctx.get_random(Enums::System::Random::ZERO_TO_3))};
807 _ctx.game->state->set_player_facing(new_facing);
808
809 DEBUG_LOG("Player triggered spinner");
810 }
811}
812
813auto Sorcery::Engine::_turn_around() -> void {
814
815 switch (_ctx.game->state->get_player_facing()) {
816 using enum Enums::Map::Direction;
817 case NORTH:
818 _ctx.game->state->set_player_facing(SOUTH);
819 break;
820 case SOUTH:
821 _ctx.game->state->set_player_facing(NORTH);
822 break;
823 case EAST:
824 _ctx.game->state->set_player_facing(WEST);
825 break;
826 case WEST:
827 _ctx.game->state->set_player_facing(EAST);
828 break;
829 default:
830 break;
831 }
832
833 _ctx.controller->set_last_dir(Enums::Map::Direction::SOUTH);
834 _ctx.controller->set_can_undo(false);
835
836 const auto at{_ctx.game->state->get_player_pos()};

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