From bec6f657f405cb27939ec42ae35c0cc9d524bbb9 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 1 Nov 2023 18:07:04 -0400 Subject: invisible symmetry! --- ext/wittle_generator/Generate.cpp | 4 ++++ ext/wittle_generator/Panel.cpp | 10 +++++++--- ext/wittle_generator/Panel.h | 3 +++ ext/wittle_generator/Serializer.h | 3 ++- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'ext/wittle_generator') diff --git a/ext/wittle_generator/Generate.cpp b/ext/wittle_generator/Generate.cpp index ed5f2f5..a5c0af9 100644 --- a/ext/wittle_generator/Generate.cpp +++ b/ext/wittle_generator/Generate.cpp @@ -136,6 +136,10 @@ void Generate::initPanel() { if (pathWidth != 1) _panel->pathWidth = pathWidth; // Init path scale. "1" is considered the // default, and therefore means no change. + + if (hasFlag(Config::WriteInvisible)) { + _panel->SetInvisibleSymmetry(true); + } } // Place a specific symbol into the puzzle at the specified location. The diff --git a/ext/wittle_generator/Panel.cpp b/ext/wittle_generator/Panel.cpp index 892d4cc..879d205 100644 --- a/ext/wittle_generator/Panel.cpp +++ b/ext/wittle_generator/Panel.cpp @@ -225,9 +225,13 @@ std::string Panel::Write() { } serializer.writeInt(0); - serializer.writeByte(Serializer::NegationsCancelNegations | - Serializer::PrecisePolyominos | - Serializer::FlashForErrors); + + char settings = Serializer::NegationsCancelNegations | + Serializer::PrecisePolyominos | Serializer::FlashForErrors; + if (_invisible_symmetry) { + settings |= Serializer::InvisibleSymmetry; + } + serializer.writeByte(settings); return serializer.str(); } diff --git a/ext/wittle_generator/Panel.h b/ext/wittle_generator/Panel.h index b8dec2f..95832b5 100644 --- a/ext/wittle_generator/Panel.h +++ b/ext/wittle_generator/Panel.h @@ -169,6 +169,8 @@ class Panel { int get(int x, int y) { return _grid[x][y]; } void set(int x, int y, int val) { _grid[x][y] = val; } + void SetInvisibleSymmetry(bool val) { _invisible_symmetry = val; } + std::string Write(); enum Style { @@ -447,6 +449,7 @@ class Panel { float minx, miny, maxx, maxy, unitWidth, unitHeight; int _style; bool _resized; + bool _invisible_symmetry = false; }; #endif /* end of include guard: PANEL_H_FC471D68 */ diff --git a/ext/wittle_generator/Serializer.h b/ext/wittle_generator/Serializer.h index 86b262d..6eeb887 100644 --- a/ext/wittle_generator/Serializer.h +++ b/ext/wittle_generator/Serializer.h @@ -56,7 +56,8 @@ class Serializer { PrecisePolyominos = 4, FlashForErrors = 8, FatStartpoints = 16, - CustomMechanics = 32 + CustomMechanics = 32, + InvisibleSymmetry = 64, }; enum GapType : char { GapNone = 0, GapBreak = 1, GapFull = 2 }; -- cgit 1.4.1