diff options
Diffstat (limited to 'Source/Randomizer2Core.cpp')
-rw-r--r-- | Source/Randomizer2Core.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Source/Randomizer2Core.cpp b/Source/Randomizer2Core.cpp index 8ef2301..5cae049 100644 --- a/Source/Randomizer2Core.cpp +++ b/Source/Randomizer2Core.cpp | |||
@@ -18,7 +18,9 @@ std::vector<Pos> Randomizer2Core::CutSymmetricalEdgePairs(const Puzzle& p, size_ | |||
18 | Puzzle copy = p; | 18 | Puzzle copy = p; |
19 | assert(p.symmetry != Puzzle::Symmetry::NONE); | 19 | assert(p.symmetry != Puzzle::Symmetry::NONE); |
20 | if (p.symmetry == Puzzle::Symmetry::X) { | 20 | if (p.symmetry == Puzzle::Symmetry::X) { |
21 | if (p.width%4 == 1) { // Puzzle is even, so we need to prevent cutting the centerline | 21 | if (p.width%4 == 1) { |
22 | // The puzle has an even width (e.g. 4x4), so it has a midline for symmetry. | ||
23 | // Since this midline is unusable, we cut it pre-emptively. | ||
22 | for (int y=0; y<p.height; y++) { | 24 | for (int y=0; y<p.height; y++) { |
23 | copy.grid[p.width/2][y].gap = Cell::Gap::FULL; | 25 | copy.grid[p.width/2][y].gap = Cell::Gap::FULL; |
24 | } | 26 | } |
@@ -147,23 +149,19 @@ std::tuple<std::vector<std::vector<int>>, int> Randomizer2Core::CreateColorGrid( | |||
147 | for (int x=0; x<p.width; x++) { | 149 | for (int x=0; x<p.width; x++) { |
148 | colorGrid[x].resize(p.height); | 150 | colorGrid[x].resize(p.height); |
149 | for (int y=0; y<p.height; y++) { | 151 | for (int y=0; y<p.height; y++) { |
152 | if (x%2 == 1 && y%2 == 1) continue; | ||
150 | // Mark all unbroken edges and intersections as 'do not color' | 153 | // Mark all unbroken edges and intersections as 'do not color' |
151 | if (x%2 != y%2) { | 154 | if (p.grid[x][y].gap == Cell::Gap::NONE) colorGrid[x][y] = 1; |
152 | if (p.grid[x][y].gap == Cell::Gap::NONE) colorGrid[x][y] = 1; | ||
153 | } else if (x%2 == 0 && y%2 == 0) { | ||
154 | // @Future: What about empty intersections? | ||
155 | colorGrid[x][y] = 1; // do not color intersections | ||
156 | } | ||
157 | } | 155 | } |
158 | } | 156 | } |
159 | 157 | ||
160 | // @Future: Skip this loop if pillar = true; | 158 | // @Future: Skip this loop if pillar = true; |
161 | for (int y=1; y<p.height; y+=2) { | 159 | for (int y=0; y<p.height; y++) { |
162 | FloodFillOutside(p, colorGrid, 0, y); | 160 | FloodFillOutside(p, colorGrid, 0, y); |
163 | FloodFillOutside(p, colorGrid, p.width - 1, y); | 161 | FloodFillOutside(p, colorGrid, p.width - 1, y); |
164 | } | 162 | } |
165 | 163 | ||
166 | for (int x=1; x<p.width; x+=2) { | 164 | for (int x=0; x<p.width; x++) { |
167 | FloodFillOutside(p, colorGrid, x, 0); | 165 | FloodFillOutside(p, colorGrid, x, 0); |
168 | FloodFillOutside(p, colorGrid, x, p.height - 1); | 166 | FloodFillOutside(p, colorGrid, x, p.height - 1); |
169 | } | 167 | } |