#ifndef DOUWCO_HIVEMIND_MEASURE_TOOL_HPP #define DOUWCO_HIVEMIND_MEASURE_TOOL_HPP #include namespace DouwcoHivemind { static bool isNearTo(const Screeps::RoomPosition &pos1, const Screeps::RoomPosition &pos2, int dist) { int dx = pos1.x() - pos2.x(); int dy = pos1.y() - pos2.y(); int dist2 = dist * dist; return dx * dx <= dist2 && dy * dy <= dist2 && pos1.roomName() == pos2.roomName(); } } // namespace Screeps #endif // DOUWCO_HIVEMIND_MEASURE_TOOL_HPP