Skip to content
Snippets Groups Projects
Commit 1e171319 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

add comparison and startship operators to hexagon

parent 6464d0e7
No related branches found
No related tags found
No related merge requests found
Pipeline #3652 passed
......@@ -22,6 +22,7 @@
#include <array>
#include <vector>
#include <cmath>
#include <compare>
#include <fggl/math/fmath.hpp>
......@@ -83,6 +84,12 @@ namespace fggl::grid {
return { m_pos[0] - other.m_pos[0], m_pos[1] - other.m_pos[1] };
}
bool operator==(const HexPointT<T>& other) const {
return m_pos[0] == other.m_pos[0] && m_pos[1] == m_pos[1];
}
auto operator<=>(const HexPointT<T>& other) const = default;
T distance(const HexPointT& other) const {
auto vec = *this - other;
return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment