MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / GetTargetPosition

Method GetTargetPosition

Source/player.cpp:1736–1752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1734}
1735
1736Point Player::GetTargetPosition() const
1737{
1738 // clang-format off
1739 constexpr int DirectionOffsetX[8] = { 0,-1, 1, 0,-1, 1, 1,-1 };
1740 constexpr int DirectionOffsetY[8] = { -1, 0, 0, 1,-1,-1, 1, 1 };
1741 // clang-format on
1742 Point target = position.future;
1743 for (auto step : walkpath) {
1744 if (step == WALK_NONE)
1745 break;
1746 if (step > 0) {
1747 target.x += DirectionOffsetX[step - 1];
1748 target.y += DirectionOffsetY[step - 1];
1749 }
1750 }
1751 return target;
1752}
1753
1754bool Player::IsPositionInPath(Point pos)
1755{

Callers 4

SavePlayerFunction · 0.80
NetReceivePlayerDataFunction · 0.80
RepeatWalkFunction · 0.80
DebugCmdPlayerInfoFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected