Skip to content

Commit

Permalink
Tweak a few puzzles
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma144 committed Jul 22, 2020
1 parent 2ca1a49 commit 678610f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion App/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define MAJOR 1
#define MINOR 1
#define PATCH 0
#define PATCH 1

#define VERSION_STR TO_STRING(MAJOR) L"." TO_STRING(MINOR) L"." TO_STRING(PATCH)
#define VERSION MAJOR, MINOR, PATCH
Expand Down
13 changes: 13 additions & 0 deletions Source/Generate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ bool Generate::place_shapes(const std::vector<int>& colors, const std::vector<in
removeFlag(Generate::Config::MountainFloorH);
}
int totalArea = 0;
int minx = _panel->_width, miny = _panel->_height, maxx = 0, maxy = 0;
int colorIndex = Random::rand() % colors.size();
int colorIndexN = Random::rand() % (negativeColors.size() + 1);
bool shapesCanceled = false, shapesCombined = false;
Expand Down Expand Up @@ -1483,10 +1484,22 @@ bool Generate::place_shapes(const std::vector<int>& colors, const std::vector<in
}
open2.erase(pos);
_openpos.erase(pos);
if (_panel->symmetry && Point::pillarWidth == 0 && originalAmount >= 3) {
for (const Point& p : shape) {
if (p.first < minx) minx = p.first;
if (p.second < miny) miny = p.second;
if (p.first > maxx) maxx = p.first;
if (p.second > maxy) maxy = p.second;
}
}
}
} //Do some final checks - make sure targetArea has been reached, all shapes have been placed, and that config requirements have been met
if (totalArea < targetArea || numNegative > 0 || hasFlag(Config::RequireCancelShapes) && !shapesCanceled || hasFlag(Config::RequireCombineShapes) && !shapesCombined)
return false;
//If symmetry, make sure it didn't shove all the shapes to one side
if (_panel->symmetry && Point::pillarWidth == 0 && originalAmount >= 3 &&
(minx >= _panel->_width / 2 || maxx <= _panel->_width / 2 || miny >= _panel->_height / 2 || maxy <= _panel->_height / 2))
return false;
return true;
}

Expand Down
1 change: 1 addition & 0 deletions Source/PuzzleSymbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct PuzzleSymbols {
if (any(Decoration::Star)) style |= Panel::Style::HAS_STARS;
if (any(Decoration::Poly)) style |= Panel::Style::HAS_SHAPERS;
if (any(Decoration::Triangle)) style |= Panel::Style::HAS_TRIANGLES;
if (any(Decoration::Arrow)) style |= Panel::Style::HAS_TRIANGLES;
}
};

2 changes: 1 addition & 1 deletion Source/Special.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ void Special::generateCenterPerspective(int id, const std::vector<std::pair<int,
do {
generator->setFlagOnce(Generate::Config::DisableWrite);
generator->generate(id, symbolVec);
} while (generator->get_symbol_type(generator->get(5, 5)) != symbolType);
} while ((generator->get(5, 5) & 0xFF00) != symbolType);
generator->write(id);
}

Expand Down

0 comments on commit 678610f

Please sign in to comment.