summary refs log tree commit diff stats
path: root/Source/Randomizer2Core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Randomizer2Core.cpp')
-rw-r--r--Source/Randomizer2Core.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Randomizer2Core.cpp b/Source/Randomizer2Core.cpp index 0310ae2..c34fec6 100644 --- a/Source/Randomizer2Core.cpp +++ b/Source/Randomizer2Core.cpp
@@ -77,15 +77,22 @@ std::vector<Pos> Randomizer2Core::CutEdgesInternal(const Puzzle& p, std::vector<
77 return cutEdges; 77 return cutEdges;
78} 78}
79 79
80#ifndef NDEBUG
81#include <Windows.h>
82#endif
83
80void Randomizer2Core::DebugColorGrid(const std::vector<std::vector<int>>& colorGrid) { 84void Randomizer2Core::DebugColorGrid(const std::vector<std::vector<int>>& colorGrid) {
85#ifndef NDEBUG
81 for (int y=0; y<colorGrid[0].size(); y++) { 86 for (int y=0; y<colorGrid[0].size(); y++) {
82 std::string row; 87 std::string row;
83 for (int x=0; x<colorGrid.size(); x++) { 88 for (int x=0; x<colorGrid.size(); x++) {
84 row += std::to_string(colorGrid[x][y]); 89 row += std::to_string(colorGrid[x][y]);
85 } 90 }
86 std::cerr << row << std::endl; 91 row += "\n";
92 OutputDebugStringA(row.c_str());
87 } 93 }
88 std::cerr << std::endl; 94 OutputDebugStringA("\n");
95#endif
89} 96}
90 97
91void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int color, int x, int y) { 98void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int color, int x, int y) {
@@ -102,7 +109,7 @@ void Randomizer2Core::FloodFill(const Puzzle& p, std::vector<std::vector<int>>&
102void Randomizer2Core::FloodFillOutside(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int x, int y) { 109void Randomizer2Core::FloodFillOutside(const Puzzle& p, std::vector<std::vector<int>>& colorGrid, int x, int y) {
103 if (!p.SafeCell(x, y)) return; 110 if (!p.SafeCell(x, y)) return;
104 if (colorGrid[x][y] != 0) return; // Already processed. 111 if (colorGrid[x][y] != 0) return; // Already processed.
105 if (x%2 != y%2 && p.grid[x][y].gap != Cell::Gap::FULL) return; // Only flood-fill through full gaps 112 if (x%2 != y%2 && p.grid[x][y].gap == Cell::Gap::NONE) return; // Only flood-fill through gaps
106 colorGrid[x][y] = 1; // Outside color 113 colorGrid[x][y] = 1; // Outside color
107 114
108 FloodFillOutside(p, colorGrid, x, y+1); 115 FloodFillOutside(p, colorGrid, x, y+1);