From 413e1f0aaae961660781675158e38520126c11b6 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Sat, 9 Nov 2019 12:13:14 -0800 Subject: Gaps working now --- Source/Panel.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'Source/Panel.cpp') diff --git a/Source/Panel.cpp b/Source/Panel.cpp index 4ed5c51..b204a28 100644 --- a/Source/Panel.cpp +++ b/Source/Panel.cpp @@ -227,8 +227,8 @@ void PuzzleSerializer::WriteIntersections(const Puzzle& p, int id) { // Dots for (int x=0; x(intersectionFlags.size()); // This endpoint - - connections_a.push_back(other_connection); - connections_b.push_back(static_cast(intersectionFlags.size() + 1)); // Next endpoint - break; - } - } - // Add the two halves of this gap to the end float xPos = min + (x/2.0f) * width_interval; float yPos = max - (y/2.0f) * height_interval; // Reminder: Y goes from 0.0 (bottom) to 1.0 (top) if (x%2 == 0) { // Vertical gap + connections_a.push_back(xy_to_loc(p, x, y-1)); + connections_b.push_back(static_cast(intersectionFlags.size())); // This endpoint intersectionLocations.push_back(xPos); intersectionLocations.push_back(yPos + verti_gap_size / 2); + intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_VERTI_CONN); + + connections_a.push_back(xy_to_loc(p, x, y+1)); + connections_b.push_back(static_cast(intersectionFlags.size())); // This endpoint intersectionLocations.push_back(xPos); intersectionLocations.push_back(yPos - verti_gap_size / 2); intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_VERTI_CONN); - intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_VERTI_CONN); } else if (y%2 == 0) { // Horizontal gap + connections_a.push_back(xy_to_loc(p, x-1, y)); + connections_b.push_back(static_cast(intersectionFlags.size())); // This endpoint intersectionLocations.push_back(xPos - horiz_gap_size / 2); intersectionLocations.push_back(yPos); + intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_HORIZ_CONN); + + connections_a.push_back(xy_to_loc(p, x+1, y)); + connections_b.push_back(static_cast(intersectionFlags.size())); // This endpoint intersectionLocations.push_back(xPos + horiz_gap_size / 2); intersectionLocations.push_back(yPos); - intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_VERTI_CONN); - intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_VERTI_CONN); + intersectionFlags.push_back(Flags::HAS_NO_CONN | Flags::HAS_HORIZ_CONN); } } } -- cgit 1.4.1