diff --git a/Source/engine.h b/Source/engine.h index 246a56ec2..a5042a478 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -190,6 +190,18 @@ struct Point { return (approx + 512) / 1024; } + + Point Absolute() const + { + return { abs(x), abs(y) }; + } + + int ManhattanDistance(Point other) const + { + Point offset = (*this - other).Absolute(); + + return offset.x + offset.y; + } }; struct Size {