From 38060c54f9f923d49b019fcf90f3494fd5469b74 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Thu, 5 Dec 2019 10:23:42 -0800 Subject: Bugfix, add debug function, add dots 2 --- Source/PuzzleSerializer.cpp | 61 +++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'Source/PuzzleSerializer.cpp') diff --git a/Source/PuzzleSerializer.cpp b/Source/PuzzleSerializer.cpp index 8faede9..3732db8 100644 --- a/Source/PuzzleSerializer.cpp +++ b/Source/PuzzleSerializer.cpp @@ -318,7 +318,18 @@ void PuzzleSerializer::WriteDots(const Puzzle& p) { for (int x=0; x(_intersectionFlags.size())); - int flags = Flags::HAS_DOT; - switch (p.grid[x][y].dot) { - case Cell::Dot::BLACK: - break; - case Cell::Dot::BLUE: - flags |= DOT_IS_BLUE; - break; - case Cell::Dot::YELLOW: - flags |= DOT_IS_ORANGE; - break; - case Cell::Dot::INVISIBLE: - flags |= DOT_IS_INVISIBLE; - break; + int flags = 0; + if (p.symmetry != Puzzle::Symmetry::NONE && p.grid[x][y].dot == Cell::Dot::NONE) { + // A dot was asked to be introduced strictly for tracing reasons, don't set any flags. + } else { + flags |= Flags::HAS_DOT; + switch (p.grid[x][y].dot) { + case Cell::Dot::BLACK: + break; + case Cell::Dot::BLUE: + flags |= DOT_IS_BLUE; + break; + case Cell::Dot::YELLOW: + flags |= DOT_IS_ORANGE; + break; + case Cell::Dot::INVISIBLE: + flags |= DOT_IS_INVISIBLE; + break; + } } auto [xPos, yPos] = xy_to_pos(p, x, y); @@ -414,13 +430,11 @@ void PuzzleSerializer::WriteGaps(const Puzzle& p) { _connectionsB.push_back(gap2Location); AddIntersection(p, x, y, xPos + INTERVAL / 2, yPos, Flags::HAS_ONE_CONN | Flags::HAS_HORIZ_CONN); } - if (p.symmetry != Puzzle::Symmetry::NONE) { - if (p.grid[x][y].gap == Cell::Gap::NONE) { - // A gap was asked to be introduced strictly for interaction reasons, but it shouldn't look like a gap. - // Add a connection between two halves of the gap to cover it graphically. - _connectionsA.push_back(gap1Location); - _connectionsB.push_back(gap2Location); - } + if (p.symmetry != Puzzle::Symmetry::NONE && p.grid[x][y].gap == Cell::Gap::NONE) { + // A gap was asked to be introduced strictly for tracing reasons, but it shouldn't look like a gap. + // Add a connection between two halves of the gap to cover it graphically. + _connectionsA.push_back(gap1Location); + _connectionsB.push_back(gap2Location); } } } @@ -546,7 +560,10 @@ int PuzzleSerializer::xy_to_loc(const Puzzle& p, int x, int y) const { int PuzzleSerializer::extra_xy_to_loc(const Puzzle& p, int x, int y) const { auto search = _extraLocations.find(x * p.height + y); - if (search == _extraLocations.end()) return -1; // @Error + if (search == _extraLocations.end()) { + assert(false); + return -1; // @Error + } return search->second; } -- cgit 1.4.1