Added debug check macro and some formats
This commit is contained in:
parent
12583220a3
commit
ec43ed7c52
@ -45,7 +45,9 @@ void Controller::fillSolveableTable() {
|
||||
|
||||
auto next_ptr = positions.begin();
|
||||
|
||||
while (!positions.empty() || (not_end && !(positions.insert(getRandLowest()), positions.empty()))) {
|
||||
while (
|
||||
!positions.empty() ||
|
||||
(not_end && !(positions.insert(getRandLowest()), positions.empty()))) {
|
||||
int id = genRandId();
|
||||
|
||||
if (id < 34) {
|
||||
@ -74,6 +76,8 @@ wxPoint Controller::getRandLowest() {
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
#ifdef WXDEBUG
|
||||
|
||||
#include <wx/file.h>
|
||||
|
||||
void print_list(const std::set<ThreePoint>& positions) {
|
||||
@ -85,10 +89,14 @@ void print_list(const std::set<ThreePoint>& positions) {
|
||||
f.Write("_ size: " + itowxS(positions.size()) + "\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Controller::emplace_rand(int id, std::set<ThreePoint>& positions,
|
||||
std::set<ThreePoint>::iterator& next_ptr,
|
||||
bool canBeUp) {
|
||||
#ifdef WXDEBUG
|
||||
print_list(positions);
|
||||
#endif
|
||||
|
||||
table[next_ptr->z][next_ptr->x][next_ptr->y] = id;
|
||||
|
||||
@ -121,6 +129,7 @@ void Controller::push_available(std::set<ThreePoint>& positions,
|
||||
const ThreePoint& pos) {
|
||||
int z = pos.z, x = pos.x, y = pos.y;
|
||||
|
||||
// clang-format off
|
||||
if (x >= 2 && table[z][x-2][y] == FREE) // left
|
||||
positions.emplace(z, x-2, y);
|
||||
if (x + 2 < gridSize.x && table[z][x+2][y] == FREE) // right
|
||||
@ -176,6 +185,7 @@ void Controller::push_available(std::set<ThreePoint>& positions,
|
||||
positions.emplace(z+1, x+1, y+1);
|
||||
}
|
||||
}
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void Controller::free_table() {
|
||||
|
@ -140,8 +140,7 @@ bool Drawer::resizeBoard(const TLVec& layout, const Dimensions& gridSize) {
|
||||
tilePixelSize.Set(gridPoint * TILE_WIDTH, gridPoint * TILE_HEIGHT);
|
||||
}
|
||||
|
||||
tablePixelRect.SetPosition(
|
||||
{(resolution.x - tablePixelRect.width) / 2,
|
||||
tablePixelRect.SetPosition({(resolution.x - tablePixelRect.width) / 2,
|
||||
(resolution.y - tablePixelRect.height) / 2});
|
||||
|
||||
if (gridPoint != prevGridPoint) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user