summaryrefslogtreecommitdiffhomepage
path: root/src/global-coords.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-26 18:18:45 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-26 20:06:25 +0100
commit8a380af2b8f28400f29a5468a3a1a5629a665867 (patch)
tree7576a88b5a99a8fb043c5b4d8e8ccf7ddfed6227 /src/global-coords.cpp
parenta8bb842d388a9935342f3fa3e807551c3804d5f1 (diff)
implement formatting chunk_coords{,_} to corrade's Debug{}
Diffstat (limited to 'src/global-coords.cpp')
-rw-r--r--src/global-coords.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/global-coords.cpp b/src/global-coords.cpp
index f8d5daed..8775f9ba 100644
--- a/src/global-coords.cpp
+++ b/src/global-coords.cpp
@@ -5,6 +5,33 @@
namespace floormat {
+Debug& operator<<(Debug& dbg, const chunk_coords& c)
+{
+ dbg << "";
+ const auto flags = dbg.flags();
+
+ dbg.setFlags(flags | Debug::Flag::NoSpace);
+ dbg << "chunk{" << c.x << "," << c.y << "}";
+
+ dbg.setFlags(flags);
+ return dbg;
+}
+
+Debug& operator<<(Debug& dbg, const chunk_coords_& c)
+{
+ dbg << "";
+ const auto flags = dbg.flags();
+
+ dbg.setFlags(flags | Debug::Flag::NoSpace);
+ dbg << "chunk{" << c.x << "," << c.y;
+ if (c.z != 0)
+ dbg << "," << c.z;
+ dbg << "}";
+
+ dbg.setFlags(flags);
+ return dbg;
+}
+
namespace {
static_assert(sizeof(decltype(local_coords::x))*8 == 8);