about summary refs log tree commit diff stats
path: root/ext/wittle_generator
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-11-01 18:07:04 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-11-01 18:07:04 -0400
commitbec6f657f405cb27939ec42ae35c0cc9d524bbb9 (patch)
treed7cef60e532041b650ef9c54c8645607f21c3b12 /ext/wittle_generator
parent63624385ccc66f6a2f40797baad1972957e34863 (diff)
downloadwittle-bec6f657f405cb27939ec42ae35c0cc9d524bbb9.tar.gz
wittle-bec6f657f405cb27939ec42ae35c0cc9d524bbb9.tar.bz2
wittle-bec6f657f405cb27939ec42ae35c0cc9d524bbb9.zip
invisible symmetry!
Diffstat (limited to 'ext/wittle_generator')
-rw-r--r--ext/wittle_generator/Generate.cpp4
-rw-r--r--ext/wittle_generator/Panel.cpp10
-rw-r--r--ext/wittle_generator/Panel.h3
-rw-r--r--ext/wittle_generator/Serializer.h3
4 files changed, 16 insertions, 4 deletions
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() {
136 if (pathWidth != 1) 136 if (pathWidth != 1)
137 _panel->pathWidth = pathWidth; // Init path scale. "1" is considered the 137 _panel->pathWidth = pathWidth; // Init path scale. "1" is considered the
138 // default, and therefore means no change. 138 // default, and therefore means no change.
139
140 if (hasFlag(Config::WriteInvisible)) {
141 _panel->SetInvisibleSymmetry(true);
142 }
139} 143}
140 144
141// Place a specific symbol into the puzzle at the specified location. The 145// 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() {
225 } 225 }
226 226
227 serializer.writeInt(0); 227 serializer.writeInt(0);
228 serializer.writeByte(Serializer::NegationsCancelNegations | 228
229 Serializer::PrecisePolyominos | 229 char settings = Serializer::NegationsCancelNegations |
230 Serializer::FlashForErrors); 230 Serializer::PrecisePolyominos | Serializer::FlashForErrors;
231 if (_invisible_symmetry) {
232 settings |= Serializer::InvisibleSymmetry;
233 }
234 serializer.writeByte(settings);
231 235
232 return serializer.str(); 236 return serializer.str();
233} 237}
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 {
169 int get(int x, int y) { return _grid[x][y]; } 169 int get(int x, int y) { return _grid[x][y]; }
170 void set(int x, int y, int val) { _grid[x][y] = val; } 170 void set(int x, int y, int val) { _grid[x][y] = val; }
171 171
172 void SetInvisibleSymmetry(bool val) { _invisible_symmetry = val; }
173
172 std::string Write(); 174 std::string Write();
173 175
174 enum Style { 176 enum Style {
@@ -447,6 +449,7 @@ class Panel {
447 float minx, miny, maxx, maxy, unitWidth, unitHeight; 449 float minx, miny, maxx, maxy, unitWidth, unitHeight;
448 int _style; 450 int _style;
449 bool _resized; 451 bool _resized;
452 bool _invisible_symmetry = false;
450}; 453};
451 454
452#endif /* end of include guard: PANEL_H_FC471D68 */ 455#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 {
56 PrecisePolyominos = 4, 56 PrecisePolyominos = 4,
57 FlashForErrors = 8, 57 FlashForErrors = 8,
58 FatStartpoints = 16, 58 FatStartpoints = 16,
59 CustomMechanics = 32 59 CustomMechanics = 32,
60 InvisibleSymmetry = 64,
60 }; 61 };
61 62
62 enum GapType : char { GapNone = 0, GapBreak = 1, GapFull = 2 }; 63 enum GapType : char { GapNone = 0, GapBreak = 1, GapFull = 2 };