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

Function IsPlayerAdjacentToObject

Source/player.cpp:1112–1121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112bool IsPlayerAdjacentToObject(Player &player, Object &object)
1113{
1114 int x = abs(player.position.tile.x - object.position.x);
1115 int y = abs(player.position.tile.y - object.position.y);
1116 if (y > 1 && object.position.y >= 1 && FindObjectAtPosition(object.position + Direction::NorthEast) == &object) {
1117 // special case for activating a large object from the north-east side
1118 y = abs(player.position.tile.y - object.position.y + 1);
1119 }
1120 return x <= 1 && y <= 1;
1121}
1122
1123void TryDisarm(const Player &player, Object &object)
1124{

Callers 1

CheckNewPathFunction · 0.85

Calls 2

FindObjectAtPositionFunction · 0.85
absFunction · 0.50

Tested by

no test coverage detected